Code clean-up
This commit is contained in:
parent
d5dad5f5c2
commit
5e5a8ae16f
@ -1043,13 +1043,11 @@ namespace DerpingDrivers.Util
|
||||
if (IsWindows10) return 10;
|
||||
var exactVersion = RegistryRead(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion",
|
||||
"CurrentVersion", "");
|
||||
if (!string.IsNullOrEmpty(exactVersion))
|
||||
{
|
||||
var splitVersion = exactVersion.Split('.');
|
||||
return int.Parse(splitVersion[0]);
|
||||
}
|
||||
|
||||
return Environment.OSVersion.Version.Major;
|
||||
if (string.IsNullOrEmpty(exactVersion)) return Environment.OSVersion.Version.Major;
|
||||
|
||||
var splitVersion = exactVersion.Split('.');
|
||||
return int.Parse(splitVersion[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1067,13 +1065,11 @@ namespace DerpingDrivers.Util
|
||||
if (IsWindows10) return 0;
|
||||
var exactVersion = RegistryRead(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion",
|
||||
"CurrentVersion", "");
|
||||
if (!string.IsNullOrEmpty(exactVersion))
|
||||
{
|
||||
var splitVersion = exactVersion.Split('.');
|
||||
return int.Parse(splitVersion[1]);
|
||||
}
|
||||
|
||||
return Environment.OSVersion.Version.Minor;
|
||||
if (string.IsNullOrEmpty(exactVersion)) return Environment.OSVersion.Version.Minor;
|
||||
|
||||
var splitVersion = exactVersion.Split('.');
|
||||
return int.Parse(splitVersion[1]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
{
|
||||
var fnPtr = GetProcAddress(handle, "IsWow64Process");
|
||||
if (handle == IntPtr.Zero) return null;
|
||||
|
||||
if (fnPtr != IntPtr.Zero)
|
||||
return (IsWow64ProcessDelegate) Marshal.GetDelegateForFunctionPointer(fnPtr,
|
||||
typeof(IsWow64ProcessDelegate));
|
||||
}
|
||||
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