qol: remove this

This commit is contained in:
Gary Sharp
2025-07-20 11:39:42 +10:00
parent b4e54c9edf
commit 4e518d6684
56 changed files with 282 additions and 282 deletions
@@ -27,28 +27,28 @@ namespace Disco.ClientBootstrapper.Interop
private void UpdateFromWmi(ManagementObject wmiObject)
{
this.WmiPath = (string)wmiObject.GetPropertyValue("__PATH");
this.Index = (UInt32)wmiObject.GetPropertyValue("Index");
this.Guid = Guid.Parse((string)wmiObject.GetPropertyValue("GUID"));
this.MACAddress = (string)wmiObject.GetPropertyValue("MACAddress");
this.Name = (string)wmiObject.GetPropertyValue("Name");
this.NetConnectionID = (string)wmiObject.GetPropertyValue("NetConnectionID");
this.Speed = (UInt64)wmiObject.GetPropertyValue("Speed");
WmiPath = (string)wmiObject.GetPropertyValue("__PATH");
Index = (UInt32)wmiObject.GetPropertyValue("Index");
Guid = Guid.Parse((string)wmiObject.GetPropertyValue("GUID"));
MACAddress = (string)wmiObject.GetPropertyValue("MACAddress");
Name = (string)wmiObject.GetPropertyValue("Name");
NetConnectionID = (string)wmiObject.GetPropertyValue("NetConnectionID");
Speed = (UInt64)wmiObject.GetPropertyValue("Speed");
var connectionStatus = ConnectionStatus;
this.IsWireless = true;
IsWireless = true;
try
{
var wirelessConnectionStatus = WirelessConnectionStatus;
}
catch (Exception) {
this.IsWireless = false;
IsWireless = false;
};
}
public int WirelessConnectionStatus
{
get {
if (this.IsWireless)
if (IsWireless)
{
IntPtr handle = IntPtr.Zero;
uint negotiatedVersion;
@@ -61,17 +61,17 @@ namespace Disco.ClientBootstrapper.Interop
uint dataSize;
var interfaceGuid = this.Guid;
var interfaceGuid = Guid;
if (NetworkInterop.WlanQueryInterface(handle, ref interfaceGuid, NetworkInterop.WLAN_INTF_OPCODE.wlan_intf_opcode_interface_state, IntPtr.Zero, out dataSize, ref ptr, IntPtr.Zero) != 0)
throw new NotSupportedException("This network adapter does not support Wireless");
this.LastWirelessConnectionStatus = Marshal.ReadInt32(ptr);
LastWirelessConnectionStatus = Marshal.ReadInt32(ptr);
NetworkInterop.WlanFreeMemory(ptr);
return this.LastWirelessConnectionStatus;
return LastWirelessConnectionStatus;
}
finally
{
@@ -115,11 +115,11 @@ namespace Disco.ClientBootstrapper.Interop
{
get
{
using (var wmiObject = new ManagementObject(this.WmiPath))
using (var wmiObject = new ManagementObject(WmiPath))
{
this.LastConnectionStatus = (UInt16)wmiObject.GetPropertyValue("NetConnectionStatus");
LastConnectionStatus = (UInt16)wmiObject.GetPropertyValue("NetConnectionStatus");
}
return this.LastConnectionStatus;
return LastConnectionStatus;
}
}
public string ConnectionStatusMeaning(UInt16 status)
@@ -239,7 +239,7 @@ namespace Disco.ClientBootstrapper.Interop
public bool AddProfile(IntPtr WlanHandle, Guid interfaceGuid)
{
var pInterfaceGuid = interfaceGuid;
var pProfileXml = this.ProfileXml;
var pProfileXml = ProfileXml;
uint pFlag = 0;
uint failReason;
return (WlanSetProfile(WlanHandle, ref pInterfaceGuid, pFlag, pProfileXml, null, true, IntPtr.Zero, out failReason) == 0);
@@ -80,20 +80,20 @@ namespace Disco.ClientBootstrapper.Interop
uint regHive = (uint)hive;
this.Hive = hive;
this.SubKey = subKey;
Hive = hive;
SubKey = subKey;
RegLoadKey(regHive, subKey, filePath);
this.IsUnloaded = false;
IsUnloaded = false;
}
public void Unload()
{
if (!IsUnloaded)
{
uint regHive = (uint)this.Hive;
string subKey = this.SubKey;
uint regHive = (uint)Hive;
string subKey = SubKey;
RegUnLoadKey(regHive, subKey);
this.IsUnloaded = true;
IsUnloaded = true;
}
}
@@ -480,7 +480,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
//
//Never commit changes when destroying this object.
//
this.DismountImage(false);
DismountImage(false);
}
GC.KeepAlive(this);
}