Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
-simplify license status verification
Greedeks2d67f045fa5a
diff --git a/.Source/GTweak/Core/ViewModel/PagesViewModel.cs b/.Source/GTweak/Core/ViewModel/PagesViewModel.csindex d49b5df9..ef5b7d94 100644--- a/.Source/GTweak/Core/ViewModel/PagesViewModel.cs+++ b/.Source/GTweak/Core/ViewModel/PagesViewModel.cs@@ -14,7 +14,7 @@ namespace GTweak.Core.ViewModelinternal class InterfaceVM : ViewModelBase{public bool IsBlockForWin10 => SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11");- public bool IsBlockWithoutLicense => WindowsLicense.statusLicense == 1;+ public bool IsBlockWithoutLicense => WindowsLicense.IsWindowsActivated;}internal class InformationSystemVM : ViewModelBasediff --git a/.Source/GTweak/Styles/Slider.xaml b/.Source/GTweak/Styles/Slider.xamlindex c4345d68..3c68611e 100644--- a/.Source/GTweak/Styles/Slider.xaml+++ b/.Source/GTweak/Styles/Slider.xaml@@ -78,7 +78,6 @@<Grid.RowDefinitions><RowDefinition Height="Auto" /><RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}" />- <RowDefinition Height="Auto" /></Grid.RowDefinitions><Grid><Grid.ColumnDefinitions>diff --git a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.csindex ee65c5ac..882f325e 100644--- a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs+++ b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs@@ -9,7 +9,7 @@ namespace GTweak.Utilities.Tweaks{internal sealed class WindowsLicense{- internal static uint statusLicense = 0;+ internal static bool IsWindowsActivated = false;private static bool IsVersionWindows(string pattern, byte words) => new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled).Matches(SystemData.СomputerСonfiguration.WindowsClientVersion).Count == words;internal void LicenseStatus()@@ -17,7 +17,7 @@ namespace GTweak.Utilities.TweaksParallel.Invoke(() =>{foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "SELECT LicenseStatus FROM SoftwareLicensingProduct WHERE ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f' and LicenseStatus = 1").Get())- statusLicense = (uint)managementObj["LicenseStatus"];+ IsWindowsActivated = (uint)managementObj["LicenseStatus"] == 1;});}@@ -94,9 +94,9 @@ namespace GTweak.Utilities.TweakswaitingWindow.Close();- if (statusLicense == 1)+ if (IsWindowsActivated)new ViewNotification().Show("restart", (string)Application.Current.Resources["title0_notification"], (string)Application.Current.Resources["successactivate_notification"]);- else if (statusLicense != 1)+ elsenew ViewNotification().Show("", (string)Application.Current.Resources["title0_notification"], (string)Application.Current.Resources["notsuccessactivate_notification"]);}diff --git a/.Source/GTweak/View/InterfaceView.xaml.cs b/.Source/GTweak/View/InterfaceView.xaml.csindex 296dcfab..48cafc6a 100644--- a/.Source/GTweak/View/InterfaceView.xaml.cs+++ b/.Source/GTweak/View/InterfaceView.xaml.cs@@ -19,7 +19,7 @@ namespace GTweak.ViewApp.LanguageChanged += delegate { new TypewriterAnimation((string)FindResource("defaultDescription"), TextDescription, TimeSpan.FromMilliseconds(0)); };- if (WindowsLicense.statusLicense != 1)+ if (!WindowsLicense.IsWindowsActivated)new ViewNotification().Show("", (string)Application.Current.Resources["title1_notification"], (string)Application.Current.Resources["viewlicense_notification"]);}diff --git a/.Source/GTweak/View/MoreView.xaml.cs b/.Source/GTweak/View/MoreView.xaml.csindex c9c8f869..4d725310 100644--- a/.Source/GTweak/View/MoreView.xaml.cs+++ b/.Source/GTweak/View/MoreView.xaml.cs@@ -17,10 +17,9 @@ namespace GTweak.Viewprivate void BtnLicenseWindows_ClickButton(object sender, EventArgs e){- if (WindowsLicense.statusLicense == 1)+ if (WindowsLicense.IsWindowsActivated)new ViewNotification().Show("", (string)FindResource("title1_notification"), (string)FindResource("readyactivate_notification"));-- else if (WindowsLicense.statusLicense != 1)+ else{new ViewNotification().Show("", (string)FindResource("title0_notification"), (string)FindResource("activatewin_notification"));WindowsLicense.StartActivation();