Code clean-up
This commit is contained in:
parent
d5dad5f5c2
commit
5e5a8ae16f
@ -1043,14 +1043,12 @@ namespace DerpingDrivers.Util
|
||||
if (IsWindows10) return 10;
|
||||
var exactVersion = RegistryRead(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion",
|
||||
"CurrentVersion", "");
|
||||
if (!string.IsNullOrEmpty(exactVersion))
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(exactVersion)) return Environment.OSVersion.Version.Major;
|
||||
|
||||
var splitVersion = exactVersion.Split('.');
|
||||
return int.Parse(splitVersion[0]);
|
||||
}
|
||||
|
||||
return Environment.OSVersion.Version.Major;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion MAJOR
|
||||
@ -1067,14 +1065,12 @@ namespace DerpingDrivers.Util
|
||||
if (IsWindows10) return 0;
|
||||
var exactVersion = RegistryRead(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion",
|
||||
"CurrentVersion", "");
|
||||
if (!string.IsNullOrEmpty(exactVersion))
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(exactVersion)) return Environment.OSVersion.Version.Minor;
|
||||
|
||||
var splitVersion = exactVersion.Split('.');
|
||||
return int.Parse(splitVersion[1]);
|
||||
}
|
||||
|
||||
return Environment.OSVersion.Version.Minor;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion MINOR
|
||||
@ -1084,14 +1080,7 @@ namespace DerpingDrivers.Util
|
||||
/// <summary>
|
||||
/// Gets the revision version number of the operating system running on this computer.
|
||||
/// </summary>
|
||||
public static int RevisionVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsWindows10) return 0;
|
||||
return Environment.OSVersion.Version.Revision;
|
||||
}
|
||||
}
|
||||
public static int RevisionVersion => IsWindows10 ? 0 : Environment.OSVersion.Version.Revision;
|
||||
|
||||
#endregion REVISION
|
||||
|
||||
@ -1103,14 +1092,13 @@ namespace DerpingDrivers.Util
|
||||
{
|
||||
var handle = LoadLibrary("kernel32");
|
||||
|
||||
if (handle != IntPtr.Zero)
|
||||
{
|
||||
if (handle == IntPtr.Zero) return null;
|
||||
|
||||
var fnPtr = GetProcAddress(handle, "IsWow64Process");
|
||||
|
||||
if (fnPtr != IntPtr.Zero)
|
||||
return (IsWow64ProcessDelegate) Marshal.GetDelegateForFunctionPointer(fnPtr,
|
||||
typeof(IsWow64ProcessDelegate));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -1121,12 +1109,9 @@ namespace DerpingDrivers.Util
|
||||
|
||||
if (fnDelegate == null) return false;
|
||||
|
||||
bool isWow64;
|
||||
var retVal = fnDelegate.Invoke(Process.GetCurrentProcess().Handle, out isWow64);
|
||||
var retVal = fnDelegate.Invoke(Process.GetCurrentProcess().Handle, out var isWow64);
|
||||
|
||||
if (retVal == false) return false;
|
||||
|
||||
return isWow64;
|
||||
return retVal && isWow64;
|
||||
}
|
||||
|
||||
#endregion 64 BIT OS DETECTION
|
||||
|
Loading…
Reference in New Issue
Block a user