Skip to content

Portable Tool for an Ideal Windows Setup

-fix crash (#21) & re

Greedeksa6298f0863a8
diff --git a/.Source/GTweak/Core/ViewModel/InterfaceVM.cs b/.Source/GTweak/Core/ViewModel/InterfaceVM.cs
index 6accac5e..5ae4e27a 100644
--- a/.Source/GTweak/Core/ViewModel/InterfaceVM.cs
+++ b/.Source/GTweak/Core/ViewModel/InterfaceVM.cs
@@ -5,7 +5,7 @@ namespace GTweak.Core.ViewModel
{
internal class InterfaceVM : ViewModelBase
{
- public bool IsBlockForWin10 => SystemDiagnostics.WindowsClientVersion.Contains("11");
+ public bool IsBlockForWin10 => SystemDiagnostics.IsWindowsVersion[11];
public bool IsBlockWithoutLicense => WindowsLicense.IsWindowsActivated;
}
}
diff --git a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
index 4d57d740..0e0dd9ca 100644
--- a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
+++ b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
@@ -40,6 +40,8 @@ namespace GTweak.Utilities.Configuration
internal static string WindowsClientVersion { get; set; } = string.Empty;
+ internal static Dictionary<byte, bool> IsWindowsVersion = default;
+
internal static readonly Dictionary<string, string> HardwareData = new Dictionary<string, string>()
{
{ "Windows", Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", string.Empty)?.ToString() ?? string.Empty },
@@ -144,7 +146,7 @@ namespace GTweak.Utilities.Configuration
private void GeVideoInfo()
{
- static (bool, int) GetMemorySize(string name)
+ static (bool, int, string) GetMemorySize(string name)
{
using RegistryKey baseKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}");
if (baseKey != null)
@@ -156,9 +158,8 @@ namespace GTweak.Utilities.Configuration
{
string adapterString = regKey.GetValue("HardwareInformation.AdapterString") as string;
string driverDesc = regKey.GetValue("DriverDesc") as string;
- string chipType = regKey.GetValue("HardwareInformation.ChipType") as string;
- if ((!string.IsNullOrEmpty(adapterString) && adapterString.Contains(name)) || (!string.IsNullOrEmpty(driverDesc) && driverDesc.Contains(name)) || (!string.IsNullOrEmpty(chipType) && chipType.Contains(name)))
+ if (name == null || (!string.IsNullOrEmpty(adapterString) && adapterString.Contains(name)) || (!string.IsNullOrEmpty(driverDesc) && driverDesc.Contains(name)))
{
object memorySizeValue = regKey.GetValue("HardwareInformation.qwMemorySize") ?? regKey.GetValue("HardwareInformation.MemorySize");
if (memorySizeValue != null)
@@ -182,25 +183,26 @@ namespace GTweak.Utilities.Configuration
_ => 0
};
}
- return (true, (int)Math.Round(memorySize / (1024.0 * 1024.0 * 1024.0)));
+ return (true, (int)Math.Round(memorySize / (1024.0 * 1024.0 * 1024.0)), driverDesc);
}
}
}
}
}
- return (false, 0);
+ return (false, 0, string.Empty);
}
foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Name, AdapterRAM from Win32_VideoController", new EnumerationOptions { ReturnImmediately = true }).Get())
{
- string data = (string)managementObj["Name"];
+ string data = managementObj["Name"] as string;
+ (bool isFound, int dataMemoryReg, string driverDesc) = GetMemorySize(data);
int dataMemory = (int)Math.Round((uint)managementObj["AdapterRAM"] / (1024.0 * 1024.0 * 1024.0));
- (bool isFound, int dataMemoryReg) = GetMemorySize(data);
- HardwareData["GPU"] += $"{data}, {(isFound ? dataMemoryReg : dataMemory)} GB\n";
+ HardwareData["GPU"] += $"{(data == null && !string.IsNullOrEmpty(driverDesc) ? driverDesc : data)}, {(isFound ? dataMemoryReg : dataMemory)} GB\n";
}
HardwareData["GPU"] = HardwareData["GPU"].TrimEnd('\n');
}
+
private void GetMemoryInfo()
{
foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Manufacturer, Capacity, ConfiguredClockSpeed, Speed, SMBIOSMemoryType from Win32_PhysicalMemory", new EnumerationOptions { ReturnImmediately = true }).Get())
@@ -225,26 +227,58 @@ namespace GTweak.Utilities.Configuration
private static void GetStorageDevices()
{
HardwareData["Storage"] = string.Empty;
- foreach (var managementObj in new ManagementObjectSearcher(@"\\.\root\microsoft\windows\storage", "select FriendlyName, MediaType, Size, BusType from MSFT_PhysicalDisk", new EnumerationOptions { ReturnImmediately = true }).Get())
+ try
{
- ushort mediaType = managementObj["MediaType"] != null ? (ushort)managementObj["MediaType"] : (ushort)0;
- string storageType = mediaType switch
+ foreach (var managementObj in new ManagementObjectSearcher(@"root\microsoft\windows\storage", "select FriendlyName, Model, Description, MediaType, Size, BusType from MSFT_PhysicalDisk", new EnumerationOptions { ReturnImmediately = true }).Get())
{
- 3 => "(HDD)",
- 4 => "(SSD)",
- 5 => "(SCM)",
- _ => "(Unspecified)"
- };
+ string data = new[] { "FriendlyName", "Model", "Description" }.Select(prop => managementObj[prop] as string).FirstOrDefault(info => !string.IsNullOrEmpty(info)) ?? string.Empty;
+ ushort mediaType = managementObj["MediaType"] != null ? (ushort)managementObj["MediaType"] : (ushort)0;
+ string storageType = mediaType switch
+ {
+ 3 => "(HDD)",
+ 4 => "(SSD)",
+ 5 => "(SCM)",
+ _ => "(Unspecified)"
+ };
- if (storageType == "(Unspecified)" && ((ushort)managementObj["BusType"]) == 7)
- storageType = "(Media-Type)";
+ if (storageType == "(Unspecified)" && ((ushort)managementObj["BusType"]) == 7)
+ storageType = "(Media-Type)";
- ulong getSizeGB = (ulong)managementObj["Size"] / (1024 * 1024 * 1024);
- string size = getSizeGB >= 1024 ? $"{Math.Round(getSizeGB / 1024.0, 2):G} TB" : $"{getSizeGB} GB";
+ ulong getSizeGB = (ulong)managementObj["Size"] / (1024 * 1024 * 1024);
+ string size = getSizeGB >= 1024 ? $"{Math.Round(getSizeGB / 1024.0, 2):G} TB" : $"{getSizeGB} GB";
+
+ HardwareData["Storage"] += $"{size} [{data}] {storageType}\n";
+ }
+ }
+ catch
+ {
- HardwareData["Storage"] += $"{size} [{(string)managementObj["FriendlyName"]}] {storageType}\n";
+ foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Model, Caption, Size, MediaType, InterfaceType from Win32_DiskDrive", new EnumerationOptions { ReturnImmediately = true }).Get())
+ {
+ string data = new[] { "Model", "Caption" }.Select(prop => managementObj[prop] as string).FirstOrDefault(info => !string.IsNullOrEmpty(info)) ?? string.Empty;
+ string mediaType = managementObj["MediaType"] as string ?? string.Empty;
+ string storageType = mediaType switch
+ {
+ "Removable Media" => "(HDD)",
+ "Fixed hard disk media" => "(SSD)",
+ "Unknown" => "(SCM)",
+ _ => "(Unspecified)"
+ };
+
+ string interfaceType = managementObj["InterfaceType"] as string ?? string.Empty;
+ if ((storageType == "(Unspecified)" || storageType == "(HDD)") && (string.IsNullOrEmpty(interfaceType) || string.Equals(interfaceType, "USB", StringComparison.OrdinalIgnoreCase)))
+ storageType = "(Media-Type)";
+
+ ulong getSizeGB = (ulong)managementObj["Size"] / (1024 * 1024 * 1024);
+ string size = getSizeGB >= 1024 ? $"{Math.Round(getSizeGB / 1024.0, 2):G} TB" : $"{getSizeGB} GB";
+
+ HardwareData["Storage"] += $"{size} [{data}] {storageType}\n";
+ }
+ }
+ finally
+ {
+ HardwareData["Storage"] = HardwareData["Storage"].TrimEnd('\n');
}
- HardwareData["Storage"] = HardwareData["Storage"].TrimEnd('\n');
}
private void GetAudioDevices()
diff --git a/.Source/GTweak/Utilities/Control/BlockRunTweaker.cs b/.Source/GTweak/Utilities/Control/BlockRunTweaker.cs
index 052d2449..b9d38555 100644
--- a/.Source/GTweak/Utilities/Control/BlockRunTweaker.cs
+++ b/.Source/GTweak/Utilities/Control/BlockRunTweaker.cs
@@ -1,6 +1,7 @@
using GTweak.Utilities.Configuration;
using GTweak.Windows;
using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Management;
@@ -48,10 +49,17 @@ namespace GTweak.Utilities.Control
Parallel.Invoke(() =>
{
foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Caption from Win32_OperatingSystem", new EnumerationOptions { ReturnImmediately = true }).Get())
- SystemDiagnostics.WindowsClientVersion = Convert.ToString(managementObj["Caption"]); ;
+ {
+ SystemDiagnostics.WindowsClientVersion = Convert.ToString(managementObj["Caption"]);
+ SystemDiagnostics.IsWindowsVersion = new Dictionary<byte, bool>()
+ {
+ { 11, SystemDiagnostics.WindowsClientVersion.Contains("11") },
+ { 10, SystemDiagnostics.WindowsClientVersion.Contains("10") }
+ };
+ }
});
- if (SystemDiagnostics.WindowsClientVersion.Contains("11") || SystemDiagnostics.WindowsClientVersion.Contains("10")) return;
+ if (SystemDiagnostics.IsWindowsVersion[11] || SystemDiagnostics.IsWindowsVersion[10]) return;
new MessageWindow(true).ShowDialog();
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
index f2d59241..e6f022c2 100644
--- a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
@@ -62,24 +62,24 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{645FF040-5081-101B-9F08-00AA002F954E}", "1");
interfaceV.TglButton15.StateNA =
- SystemDiagnostics.WindowsClientVersion.Contains("11") && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAl", "0");
+ SystemDiagnostics.IsWindowsVersion[11] && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAl", "0");
interfaceV.TglButton16.StateNA =
- SystemDiagnostics.WindowsClientVersion.Contains("11") && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_Layout", "1");
+ SystemDiagnostics.IsWindowsVersion[11] && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_Layout", "1");
interfaceV.TglButton17.StateNA =
- SystemDiagnostics.WindowsClientVersion.Contains("11") && RegistryHelp.KeyExists(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32", false);
+ SystemDiagnostics.IsWindowsVersion[11] && RegistryHelp.KeyExists(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32", false);
interfaceV.TglButton18.StateNA =
- SystemDiagnostics.WindowsClientVersion.Contains("11") &&
+ SystemDiagnostics.IsWindowsVersion[11] &&
(RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement", "ScoobeSystemSettingEnabled", "0"));
interfaceV.TglButton19.StateNA =
- SystemDiagnostics.WindowsClientVersion.Contains("11") && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "UseCompactMode", "1", false);
+ SystemDiagnostics.IsWindowsVersion[11] && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "UseCompactMode", "1", false);
interfaceV.TglButton20.StateNA =
- SystemDiagnostics.WindowsClientVersion.Contains("11") &&
+ SystemDiagnostics.IsWindowsVersion[11] &&
(RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "DefaultBrowserSettingsCampaignEnabled", "0") ||
RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "ComposeInlineEnabled", "0") ||
RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "HubsSidebarEnabled", "0") ||
@@ -89,20 +89,20 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis", "1"));
interfaceV.TglButton21.StateNA =
- SystemDiagnostics.WindowsClientVersion.Contains("11") &&
+ SystemDiagnostics.IsWindowsVersion[11] &&
(RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarMn", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCopilotButton", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableSnapAssistFlyout", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", "0")) ||
- SystemDiagnostics.WindowsClientVersion.Contains("10") &&
+ SystemDiagnostics.IsWindowsVersion[10] &&
(RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCortanaButton", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", "0"));
interfaceV.TglButton22.StateNA =
- SystemDiagnostics.WindowsClientVersion.Contains("11") &&
+ SystemDiagnostics.IsWindowsVersion[11] &&
(RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy", "TailoredExperiencesWithDiagnosticDataEnabled", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSyncProviderNotifications", "0") ||
@@ -114,7 +114,7 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338387Enabled", "0")) ||
- SystemDiagnostics.WindowsClientVersion.Contains("10") &&
+ SystemDiagnostics.IsWindowsVersion[10] &&
(RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SilentInstalledAppsEnabled", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SystemPaneSuggestionsEnabled", "0") ||
@@ -128,12 +128,12 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers", "0", false);
interfaceV.TglButton24.StateNA =
- SystemDiagnostics.WindowsClientVersion.Contains("11") &&
+ SystemDiagnostics.IsWindowsVersion[11] &&
(RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", "0") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338389Enabled", "0")) ||
- SystemDiagnostics.WindowsClientVersion.Contains("10") &&
+ SystemDiagnostics.IsWindowsVersion[10] &&
(RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\\Explorer", "DisableNotificationCenter", "1") ||
RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\\PushNotifications", "ToastEnabled", "0"));
@@ -159,8 +159,8 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer", "DisableSearchBoxSuggestions", "1");
interfaceV.TglButton30.StateNA =
- SystemDiagnostics.WindowsClientVersion.Contains("11") && RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode", "1") ||
- SystemDiagnostics.WindowsClientVersion.Contains("10") && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo", "1");
+ SystemDiagnostics.IsWindowsVersion[11] && RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode", "1") ||
+ SystemDiagnostics.IsWindowsVersion[10] && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo", "1");
}
private static void RestartExplorer(Process launchExplorer)
@@ -317,7 +317,7 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", isChoose ? 0 : 1, RegistryValueKind.DWord);
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", isChoose ? 0 : 1, RegistryValueKind.DWord);
- if (SystemDiagnostics.WindowsClientVersion.Contains("11"))
+ if (SystemDiagnostics.IsWindowsVersion[11])
{
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCopilotButton", isChoose ? 0 : 1, RegistryValueKind.DWord);
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarDa", isChoose ? 0 : 1, RegistryValueKind.DWord);
@@ -325,7 +325,7 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableSnapAssistFlyout", isChoose ? 0 : 1, RegistryValueKind.DWord);
RestartExplorer(new Process());
}
- else if (SystemDiagnostics.WindowsClientVersion.Contains("10"))
+ else if (SystemDiagnostics.IsWindowsVersion[10])
{
if (isChoose)
{
@@ -349,7 +349,7 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", isChoose ? 0 : 1, RegistryValueKind.DWord);
RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", isChoose ? 0 : 1, RegistryValueKind.DWord);
- if (SystemDiagnostics.WindowsClientVersion.Contains("10"))
+ if (SystemDiagnostics.IsWindowsVersion[10])
{
RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SilentInstalledAppsEnabled", isChoose ? 0 : 1, RegistryValueKind.DWord);
RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SystemPaneSuggestionsEnabled", isChoose ? 0 : 1, RegistryValueKind.DWord);
@@ -360,7 +360,7 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338393Enabled", isChoose ? 0 : 1, RegistryValueKind.DWord);
}
- if (SystemDiagnostics.WindowsClientVersion.Contains("11"))
+ if (SystemDiagnostics.IsWindowsVersion[11])
{
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Privacy", "TailoredExperiencesWithDiagnosticDataEnabled", isChoose ? 0 : 1, RegistryValueKind.DWord);
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSyncProviderNotifications", isChoose ? 0 : 1, RegistryValueKind.DWord);
@@ -380,7 +380,7 @@ namespace GTweak.Utilities.Tweaks
case "TglButton24":
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled", isChoose ? 0 : 1, RegistryValueKind.DWord);
- if (SystemDiagnostics.WindowsClientVersion.Contains("10"))
+ if (SystemDiagnostics.IsWindowsVersion[10])
{
if (isChoose)
RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", 1, RegistryValueKind.DWord);
@@ -388,7 +388,7 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter");
}
- if (SystemDiagnostics.WindowsClientVersion.Contains("11"))
+ if (SystemDiagnostics.IsWindowsVersion[11])
{
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", isChoose ? 0 : 1, RegistryValueKind.DWord);
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338389Enabled", isChoose ? 0 : 1, RegistryValueKind.DWord);
@@ -448,16 +448,16 @@ namespace GTweak.Utilities.Tweaks
case "TglButton30":
if (isChoose)
{
- if (SystemDiagnostics.WindowsClientVersion.Contains("11"))
+ if (SystemDiagnostics.IsWindowsVersion[11])
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode", 1, RegistryValueKind.DWord);
- else if (SystemDiagnostics.WindowsClientVersion.Contains("10"))
+ else if (SystemDiagnostics.IsWindowsVersion[10])
RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo", 1, RegistryValueKind.DWord);
}
else
{
- if (SystemDiagnostics.WindowsClientVersion.Contains("11"))
+ if (SystemDiagnostics.IsWindowsVersion[11])
RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode");
- else if (SystemDiagnostics.WindowsClientVersion.Contains("10"))
+ else if (SystemDiagnostics.IsWindowsVersion[10])
RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo");
}
break;
diff --git a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
index 5c1bf86c..ceb7c627 100644
--- a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
+++ b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
@@ -76,7 +76,7 @@ namespace GTweak.Utilities.Tweaks
{
waitingWindow.Show();
- if (SystemDiagnostics.WindowsClientVersion.Contains("10"))
+ if (SystemDiagnostics.IsWindowsVersion[10])
await RunCommand("/c assoc .vbs=VBSFile", 500);
await RunCommand($"/c slmgr.vbs //b /ipk {keyWindow}", 4000);