Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
-class allocation
Greedeksd4d9f387504b
diff --git a/.Source/GTweak/Core/ViewModel/DataSystemVM.cs b/.Source/GTweak/Core/ViewModel/DataSystemVM.csindex d753448e..f56b72a0 100644--- a/.Source/GTweak/Core/ViewModel/DataSystemVM.cs+++ b/.Source/GTweak/Core/ViewModel/DataSystemVM.cs@@ -5,7 +5,6 @@ using System.Collections.ObjectModel;using System.Linq;using System.Windows;-namespace GTweak.Core.ViewModel{internal class DataSystemVM : ViewModelBase@@ -45,20 +44,20 @@ namespace GTweak.Core.ViewModelDisplayData = new ObservableCollection<DataSystemModel>{- new DataSystemModel { Name = "Windows", Data = SystemData.СomputerСonfiguration.СonfigurationData["Windows"] },- new DataSystemModel { Name = "Processes", Data = new SystemData.MonitoringSystem().GetNumberRunningProcesses },- new DataSystemModel { Name = "Bios", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["BIOS"]) ? SystemData.СomputerСonfiguration.СonfigurationData["BIOS"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },- new DataSystemModel { Name = "Motherboard", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["MotherBr"]) ? SystemData.СomputerСonfiguration.СonfigurationData["MotherBr"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },- new DataSystemModel { Name = "Processor", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["CPU"]) ? SystemData.СomputerСonfiguration.СonfigurationData["CPU"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },- new DataSystemModel { Name = "Graphics", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["GPU"]) ? SystemData.СomputerСonfiguration.СonfigurationData["GPU"] : (string)Application.Current.Resources["driver_not_installed_systemInformatin"] },- new DataSystemModel { Name = "Memory", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["RAM"]) ? SystemData.СomputerСonfiguration.СonfigurationData["RAM"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },- new DataSystemModel { Name = "Storage", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["Storage"]) ? SystemData.СomputerСonfiguration.СonfigurationData["Storage"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },- new DataSystemModel { Name = "Audio", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["Audio"]) ? SystemData.СomputerСonfiguration.СonfigurationData["Audio"] : (string)Application.Current.Resources["driver_not_installed_systemInformatin"] },- new DataSystemModel { Name = "Network", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["NetAdapter"]) ? SystemData.СomputerСonfiguration.СonfigurationData["NetAdapter"] : (string)Application.Current.Resources["driver_not_installed_systemInformatin"] },- new DataSystemModel { Name = "IpAddress", Data = SystemData.СomputerСonfiguration.СonfigurationData["UserIpAddress"] }+ new DataSystemModel { Name = "Windows", Data = SystemСonfiguration.СonfigurationData["Windows"] },+ new DataSystemModel { Name = "Processes", Data = new MonitoringSystem().GetNumberRunningProcesses },+ new DataSystemModel { Name = "Bios", Data = !string.IsNullOrEmpty(SystemСonfiguration.СonfigurationData["BIOS"]) ? SystemСonfiguration.СonfigurationData["BIOS"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },+ new DataSystemModel { Name = "Motherboard", Data = !string.IsNullOrEmpty(SystemСonfiguration.СonfigurationData["MotherBr"]) ? SystemСonfiguration.СonfigurationData["MotherBr"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },+ new DataSystemModel { Name = "Processor", Data = !string.IsNullOrEmpty(SystemСonfiguration.СonfigurationData["CPU"]) ? SystemСonfiguration.СonfigurationData["CPU"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },+ new DataSystemModel { Name = "Graphics", Data = !string.IsNullOrEmpty(SystemСonfiguration.СonfigurationData["GPU"]) ? SystemСonfiguration.СonfigurationData["GPU"] : (string)Application.Current.Resources["driver_not_installed_systemInformatin"] },+ new DataSystemModel { Name = "Memory", Data = !string.IsNullOrEmpty(SystemСonfiguration.СonfigurationData["RAM"]) ? SystemСonfiguration.СonfigurationData["RAM"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },+ new DataSystemModel { Name = "Storage", Data = !string.IsNullOrEmpty(SystemСonfiguration.СonfigurationData["Storage"]) ? SystemСonfiguration.СonfigurationData["Storage"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },+ new DataSystemModel { Name = "Audio", Data = !string.IsNullOrEmpty(SystemСonfiguration.СonfigurationData["Audio"]) ? SystemСonfiguration.СonfigurationData["Audio"] : (string)Application.Current.Resources["driver_not_installed_systemInformatin"] },+ new DataSystemModel { Name = "Network", Data = !string.IsNullOrEmpty(SystemСonfiguration.СonfigurationData["NetAdapter"]) ? SystemСonfiguration.СonfigurationData["NetAdapter"] : (string)Application.Current.Resources["driver_not_installed_systemInformatin"] },+ new DataSystemModel { Name = "IpAddress", Data = SystemСonfiguration.СonfigurationData["UserIpAddress"] }};- if (Settings.IsHiddenIpAddress & SystemData.СomputerСonfiguration.CurrentConnection == SystemData.СomputerСonfiguration.ConnectionStatus.Available)+ if (Settings.IsHiddenIpAddress & SystemСonfiguration.CurrentConnection == SystemСonfiguration.ConnectionStatus.Available){SetBlurValue = 20;SetVisibility = Visibility.Visible;@@ -66,7 +65,7 @@ namespace GTweak.Core.ViewModelelse{SetBlurValue = 0;- SetVisibility = SystemData.СomputerСonfiguration.CurrentConnection == SystemData.СomputerСonfiguration.ConnectionStatus.Available ? Visibility.Visible : Visibility.Hidden;+ SetVisibility = SystemСonfiguration.CurrentConnection == SystemСonfiguration.ConnectionStatus.Available ? Visibility.Visible : Visibility.Hidden;}}}diff --git a/.Source/GTweak/Core/ViewModel/InterfaceVM.cs b/.Source/GTweak/Core/ViewModel/InterfaceVM.csindex 2e072fec..9ddf94c6 100644--- a/.Source/GTweak/Core/ViewModel/InterfaceVM.cs+++ b/.Source/GTweak/Core/ViewModel/InterfaceVM.cs@@ -4,7 +4,7 @@ namespace GTweak.Core.ViewModel{internal class InterfaceVM : ViewModelBase{- public bool IsBlockForWin10 => SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11");+ public bool IsBlockForWin10 => SystemСonfiguration.WindowsClientVersion.Contains("11");public bool IsBlockWithoutLicense => WindowsLicense.IsWindowsActivated;}}diff --git a/.Source/GTweak/Core/ViewModel/MainViewModel.cs b/.Source/GTweak/Core/ViewModel/MainViewModel.csindex a768e72c..45293b9b 100644--- a/.Source/GTweak/Core/ViewModel/MainViewModel.cs+++ b/.Source/GTweak/Core/ViewModel/MainViewModel.cs@@ -17,9 +17,9 @@ namespace GTweak.Core.ViewModelset { _currentView = value; OnPropertyChanged(); }}- public ImageSource DisplayProfileAvatar => SystemData.ProfileData.GetProfileImage() ?? Application.Current.Resources["DI_AvatarProfile"] as DrawingImage;+ public ImageSource DisplayProfileAvatar => SystemСonfiguration.GetProfileImage() ?? Application.Current.Resources["DI_AvatarProfile"] as DrawingImage;- public string DisplayProfileName => SystemData.ProfileData.GetProfileName();+ public string DisplayProfileName => SystemСonfiguration.GetProfileName();public string DisplayTweakVersion => (Assembly.GetEntryAssembly() ?? throw new InvalidOperationException()).GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csprojindex 76646d2d..aed80311 100644--- a/.Source/GTweak/GTweak.csproj+++ b/.Source/GTweak/GTweak.csproj@@ -272,6 +272,8 @@<Compile Include="Utilities\Tweaks\ClearingMemory.cs" /><Compile Include="Utilities\Helpers\INIManager.cs" /><Compile Include="Utilities\SearchUpdates.cs" />+ <Compile Include="Utilities\Tweaks\MonitoringSystem.cs" />+ <Compile Include="Utilities\Tweaks\SystemСonfiguration.cs" /><Compile Include="Utilities\ViewNotification.cs" /><Compile Include="Utilities\Helpers\TrustedInstaller.cs" /><Compile Include="Utilities\Tweaks\ConfidentialityTweaks.cs" />@@ -448,7 +450,6 @@<Compile Include="Utilities\Helpers\BrushAnimation.cs" /><Compile Include="Utilities\Helpers\ButtonNavigation.cs" /><Compile Include="Core\RelayCommand.cs" />- <Compile Include="Utilities\Tweaks\SystemData.cs" /><Compile Include="Core\ViewModelBase.cs" /><Compile Include="Core\ViewModel\MainViewModel.cs" /><Compile Include="View\PakagesView.xaml.cs">diff --git a/.Source/GTweak/Utilities/BlockRunTweaker.cs b/.Source/GTweak/Utilities/BlockRunTweaker.csindex cf37543a..9ebcd801 100644--- a/.Source/GTweak/Utilities/BlockRunTweaker.cs+++ b/.Source/GTweak/Utilities/BlockRunTweaker.cs@@ -54,10 +54,10 @@ namespace GTweak.UtilitiesParallel.Invoke(() =>{foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Caption from Win32_OperatingSystem", new EnumerationOptions { ReturnImmediately = true }).Get())- SystemData.СomputerСonfiguration.WindowsClientVersion = Convert.ToString(managementObj["Caption"]); ;+ SystemСonfiguration.WindowsClientVersion = Convert.ToString(managementObj["Caption"]); ;});- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11") || SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10")) return;+ if (SystemСonfiguration.WindowsClientVersion.Contains("11") || SystemСonfiguration.WindowsClientVersion.Contains("10")) return;new MessageWindow(true).ShowDialog();}}diff --git a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.csindex bc567fda..995eadee 100644--- a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs+++ b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs@@ -187,7 +187,7 @@ namespace GTweak.Utilities.TweaksconfidentialityV.TglButton16.StateNA = false;- if (SystemData.СomputerСonfiguration.СonfigurationData["GPU"].ToLower().Contains("nvidia"))+ if (SystemСonfiguration.СonfigurationData["GPU"].ToLower().Contains("nvidia")){if (Registry.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NvTelemetryContainer", "Start", null) == null ||Registry.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NvTelemetryContainer", "Start", string.Empty).ToString() != "4" ||diff --git a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.csindex 0805f7ea..7672fc7c 100644--- a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs+++ b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs@@ -121,7 +121,7 @@ namespace GTweak.Utilities.TweaksinterfaceV.TglButton14.StateNA = false;- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){if (Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAl", null) == null ||Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAl", string.Empty).ToString() != "0")@@ -131,7 +131,7 @@ namespace GTweak.Utilities.Tweaks}- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){if (Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_Layout", null) == null ||Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_Layout", string.Empty).ToString() != "1")@@ -141,7 +141,7 @@ namespace GTweak.Utilities.Tweaks}- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){if (Registry.CurrentUser.OpenSubKey(@"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32") == null)interfaceV.TglButton17.StateNA = true;@@ -150,7 +150,7 @@ namespace GTweak.Utilities.Tweaks}- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){if (Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", null) == null ||Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", string.Empty).ToString() != "0" ||@@ -162,7 +162,7 @@ namespace GTweak.Utilities.Tweaks}- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){if (Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "UseCompactMode", null) == null ||Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "UseCompactMode", string.Empty).ToString() != "1")@@ -172,7 +172,7 @@ namespace GTweak.Utilities.Tweaks}- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){if (Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "DefaultBrowserSettingsCampaignEnabled", null) == null ||Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "DefaultBrowserSettingsCampaignEnabled", string.Empty).ToString() != "0" ||@@ -194,7 +194,7 @@ namespace GTweak.Utilities.Tweaks}- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){if (Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", null) == null ||Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", string.Empty).ToString() != "0" ||@@ -210,7 +210,7 @@ namespace GTweak.Utilities.TweakselseinterfaceV.TglButton21.StateNA = false;}- else if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10"))+ else if (SystemСonfiguration.WindowsClientVersion.Contains("10")){if (Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCortanaButton", null) == null ||Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCortanaButton", string.Empty).ToString() != "0" ||@@ -224,7 +224,7 @@ namespace GTweak.Utilities.Tweaks}- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){if (Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", null) == null ||Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", string.Empty).ToString() != "0" ||@@ -250,7 +250,7 @@ namespace GTweak.Utilities.TweakselseinterfaceV.TglButton22.StateNA = false;}- else if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10"))+ else if (SystemСonfiguration.WindowsClientVersion.Contains("10")){if (Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", null) == null ||Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", string.Empty).ToString() != "0" ||@@ -281,7 +281,7 @@ namespace GTweak.Utilities.TweaksinterfaceV.TglButton23.StateNA = false;- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){if (Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled", null) == null ||Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled", string.Empty).ToString() != "0" ||@@ -293,7 +293,7 @@ namespace GTweak.Utilities.TweakselseinterfaceV.TglButton24.StateNA = false;}- else if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10"))+ else if (SystemСonfiguration.WindowsClientVersion.Contains("10")){if (Registry.GetValue(@"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\\Explorer", "DisableNotificationCenter", null) == null ||Registry.GetValue(@"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\\Explorer", "DisableNotificationCenter", string.Empty).ToString() != "1" ||@@ -344,7 +344,7 @@ namespace GTweak.Utilities.TweaksinterfaceV.TglButton29.StateNA = false;- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){if (Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode", null) == null ||Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode", string.Empty).ToString() != "1")@@ -352,7 +352,7 @@ namespace GTweak.Utilities.TweakselseinterfaceV.TglButton30.StateNA = false;}- else if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10"))+ else if (SystemСonfiguration.WindowsClientVersion.Contains("10")){if (Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo", null) == null ||Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo", string.Empty).ToString() != "1")@@ -591,7 +591,7 @@ namespace GTweak.Utilities.TweaksRegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", 0, RegistryValueKind.DWord);RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", 0, RegistryValueKind.DWord);- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCopilotButton", 0, RegistryValueKind.DWord);RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarDa", 0, RegistryValueKind.DWord);@@ -599,7 +599,7 @@ namespace GTweak.Utilities.TweaksRegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableSnapAssistFlyout", 0, RegistryValueKind.DWord);RestartExplorer(new Process());}- else if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10"))+ else if (SystemСonfiguration.WindowsClientVersion.Contains("10")){RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Dsh", "AllowNewsAndInterests", "0", RegistryValueKind.DWord);RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Feeds", "EnableFeeds", "0", RegistryValueKind.DWord);@@ -614,7 +614,7 @@ namespace GTweak.Utilities.TweaksRegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", 1, RegistryValueKind.DWord);RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", 1, RegistryValueKind.DWord);- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCopilotButton", 1, RegistryValueKind.DWord);RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarDa", 1, RegistryValueKind.DWord);@@ -622,7 +622,7 @@ namespace GTweak.Utilities.TweaksRegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableSnapAssistFlyout", 1, RegistryValueKind.DWord);RestartExplorer(new Process());}- else if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10"))+ else if (SystemСonfiguration.WindowsClientVersion.Contains("10")){RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Dsh");RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Feeds");@@ -640,7 +640,7 @@ namespace GTweak.Utilities.TweaksRegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", 0, RegistryValueKind.DWord);RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", 0, RegistryValueKind.DWord);- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("10")){RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SilentInstalledAppsEnabled", 0, RegistryValueKind.DWord);RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SystemPaneSuggestionsEnabled", 0, RegistryValueKind.DWord);@@ -651,7 +651,7 @@ namespace GTweak.Utilities.TweaksRegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338393Enabled", 0, RegistryValueKind.DWord);}- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Privacy", "TailoredExperiencesWithDiagnosticDataEnabled", 0, RegistryValueKind.DWord);RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSyncProviderNotifications", 0, RegistryValueKind.DWord);@@ -669,7 +669,7 @@ namespace GTweak.Utilities.TweaksRegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", 1, RegistryValueKind.DWord);RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", 1, RegistryValueKind.DWord);- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("10")){RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SilentInstalledAppsEnabled", 1, RegistryValueKind.DWord);RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SystemPaneSuggestionsEnabled", 1, RegistryValueKind.DWord);@@ -679,7 +679,7 @@ namespace GTweak.Utilities.TweaksRegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338393Enabled", 1, RegistryValueKind.DWord);}- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Privacy", "TailoredExperiencesWithDiagnosticDataEnabled", 1, RegistryValueKind.DWord);RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSyncProviderNotifications");@@ -700,9 +700,9 @@ namespace GTweak.Utilities.Tweakscase "TglButton24":if (isChoose){- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("10"))RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", 1, RegistryValueKind.DWord);- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", 0, RegistryValueKind.DWord);RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338389Enabled", 0, RegistryValueKind.DWord);@@ -711,9 +711,9 @@ namespace GTweak.Utilities.Tweaks}else{- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("10"))RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter");- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11")){RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", 1, RegistryValueKind.DWord);RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338389Enabled", 1, RegistryValueKind.DWord);@@ -782,16 +782,16 @@ namespace GTweak.Utilities.Tweakscase "TglButton30":if (isChoose){- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11"))RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode", 1, RegistryValueKind.DWord);- else if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10"))+ else if (SystemСonfiguration.WindowsClientVersion.Contains("10"))RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo", 1, RegistryValueKind.DWord);}else{- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("11"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("11"))RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode");- else if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10"))+ else if (SystemСonfiguration.WindowsClientVersion.Contains("10"))RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo");}break;diff --git a/.Source/GTweak/Utilities/Tweaks/MonitoringSystem.cs b/.Source/GTweak/Utilities/Tweaks/MonitoringSystem.csnew file mode 100644index 00000000..55f8e4bd--- /dev/null+++ b/.Source/GTweak/Utilities/Tweaks/MonitoringSystem.cs@@ -0,0 +1,66 @@+using System;+using System.Diagnostics;+using System.Runtime.InteropServices;+using System.Threading.Tasks;++namespace GTweak.Utilities.Tweaks+{+ internal sealed class MonitoringSystem+ {+ internal static int PercentageProcessorUsage = 1;++ [StructLayout(LayoutKind.Sequential)]+ private struct PerformanceInformation+ {+ internal int Size;+ internal IntPtr CommitTotal;+ internal IntPtr CommitLimit;+ internal IntPtr CommitPeak;+ internal IntPtr PhysicalTotal;+ internal IntPtr PhysicalAvailable;+ internal IntPtr SystemCache;+ internal IntPtr KernelTotal;+ internal IntPtr KernelPaged;+ internal IntPtr KernelNonPaged;+ internal IntPtr PageSize;+ internal int HandlesCount;+ internal int ProcessCount;+ internal int ThreadCount;+ }++ [DllImport("psapi.dll", SetLastError = true)]+ [return: MarshalAs(UnmanagedType.Bool)]+ private static extern bool GetPerformanceInfo([Out] out PerformanceInformation PerformanceInformation, [In] int Size);++ private static long GetPhysicalAvailableMemory()+ {+ if (GetPerformanceInfo(out PerformanceInformation _performanceInformation, Marshal.SizeOf(new PerformanceInformation())))+ return Convert.ToInt64((_performanceInformation.PhysicalAvailable.ToInt64() * _performanceInformation.PageSize.ToInt64() / 1048576));+ else+ return -1;+ }++ private static long GetTotalMemory()+ {+ if (GetPerformanceInfo(out PerformanceInformation _performanceInformation, Marshal.SizeOf(new PerformanceInformation())))+ return Convert.ToInt64((_performanceInformation.PhysicalTotal.ToInt64() * _performanceInformation.PageSize.ToInt64() / 1048576));+ else+ return -1;+ }++ internal int GetMemoryUsage() => (int)Math.Truncate(100 - ((decimal)GetPhysicalAvailableMemory() / GetTotalMemory() * 100) + (decimal)0.5);++ internal string GetNumberRunningProcesses => Process.GetProcesses().Length.ToString();++ internal static async Task GetProcessorUsage()+ {+ await Task.Run(async () =>+ {+ using PerformanceCounter cpuCounter = new PerformanceCounter("Processor Information", "% Processor Utility", "_Total", true);+ cpuCounter.NextValue();+ await Task.Delay(1000);+ PercentageProcessorUsage = (int)cpuCounter.NextValue();+ });+ }+ }+}diff --git a/.Source/GTweak/Utilities/Tweaks/SystemData.cs b/.Source/GTweak/Utilities/Tweaks/SystemData.csdeleted file mode 100644index f1afe366..00000000--- a/.Source/GTweak/Utilities/Tweaks/SystemData.cs+++ /dev/null@@ -1,299 +0,0 @@-using Microsoft.Win32;-using Newtonsoft.Json;-using System;-using System.Collections.Generic;-using System.Diagnostics;-using System.Globalization;-using System.Management;-using System.Net;-using System.Net.Http;-using System.Runtime.InteropServices;-using System.Text.RegularExpressions;-using System.Threading.Tasks;-using System.Windows;-using System.Windows.Media;-using System.Windows.Media.Imaging;--namespace GTweak.Utilities.Tweaks-{- internal sealed class SystemData- {- internal sealed class ProfileData- {- internal static ImageSource GetProfileImage()- {- try- {- RegistryKey regKey = default, ourKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users", true);-- foreach (string keyname in ourKey!.GetSubKeyNames())- regKey = ourKey!.OpenSubKey(keyname);-- return new BitmapImage(new Uri(regKey?.GetValue("Image1080").ToString() ?? string.Empty));- }- catch { return null; }- }-- internal static string GetProfileName()- {- string nameProfile = string.Empty;- foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", $"select FullName from Win32_UserAccount where domain='{Environment.UserDomainName}' and name='{Environment.UserName.ToLower()}'").Get())- nameProfile = (string)managementObj["FullName"];-- return nameProfile != string.Empty ? nameProfile : Environment.UserName.ToLower();- }- }-- internal class MonitoringSystem- {- internal static int PercentageProcessorUsage = 1;-- [StructLayout(LayoutKind.Sequential)]- private struct PerformanceInformation- {- internal int Size;- internal IntPtr CommitTotal;- internal IntPtr CommitLimit;- internal IntPtr CommitPeak;- internal IntPtr PhysicalTotal;- internal IntPtr PhysicalAvailable;- internal IntPtr SystemCache;- internal IntPtr KernelTotal;- internal IntPtr KernelPaged;- internal IntPtr KernelNonPaged;- internal IntPtr PageSize;- internal int HandlesCount;- internal int ProcessCount;- internal int ThreadCount;- }-- [DllImport("psapi.dll", SetLastError = true)]- [return: MarshalAs(UnmanagedType.Bool)]- private static extern bool GetPerformanceInfo([Out] out PerformanceInformation PerformanceInformation, [In] int Size);-- private static long GetPhysicalAvailableMemory()- {- if (GetPerformanceInfo(out PerformanceInformation _performanceInformation, Marshal.SizeOf(new PerformanceInformation())))- return Convert.ToInt64((_performanceInformation.PhysicalAvailable.ToInt64() * _performanceInformation.PageSize.ToInt64() / 1048576));- else- return -1;- }-- private static long GetTotalMemory()- {- if (GetPerformanceInfo(out PerformanceInformation _performanceInformation, Marshal.SizeOf(new PerformanceInformation())))- return Convert.ToInt64((_performanceInformation.PhysicalTotal.ToInt64() * _performanceInformation.PageSize.ToInt64() / 1048576));- else- return -1;- }-- internal int GetMemoryUsage() => (int)Math.Truncate(100 - ((decimal)GetPhysicalAvailableMemory() / GetTotalMemory() * 100) + (decimal)0.5);-- internal string GetNumberRunningProcesses => Process.GetProcesses().Length.ToString();-- internal static async Task GetProcessorUsage()- {- await Task.Run(async () =>- {- using PerformanceCounter cpuCounter = new PerformanceCounter("Processor Information", "% Processor Utility", "_Total", true);- cpuCounter.NextValue();- await Task.Delay(1000);- PercentageProcessorUsage = (int)cpuCounter.NextValue();- });- }- }-- internal class СomputerСonfiguration- {- internal sealed class ClientInternetProtocol- {- [JsonProperty("query")]- internal string Ip { get; set; }-- [JsonProperty("countryCode")]- internal string Country { get; set; }- }- internal enum ConnectionStatus- {- Available,- Lose,- Block,- Limited,- }-- internal static ConnectionStatus CurrentConnection = ConnectionStatus.Lose;-- internal static string WindowsClientVersion { get; set; } = string.Empty;-- internal static readonly Dictionary<string, string> СonfigurationData = new Dictionary<string, string>()- {- {"Windows", Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", string.Empty).ToString() },- {"BIOS", string.Empty },- {"MotherBr", string.Empty },- {"CPU", string.Empty },- {"GPU", string.Empty },- {"RAM", string.Empty },- {"Storage", string.Empty },- {"Audio", string.Empty },- {"NetAdapter", string.Empty },- {"UserIpAddress", (string)Application.Current.Resources["connection_lose_systemInformation"] }- };-- internal void GetConfiguration()- {- Parallel.Invoke(delegate- {- foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Caption, OSArchitecture, Version from Win32_OperatingSystem", new EnumerationOptions { ReturnImmediately = true }).Get())- СonfigurationData["Windows"] = $"{Convert.ToString(managementObj["Caption"]).Substring(Convert.ToString(managementObj["Caption"]).IndexOf('W'))}, {Regex.Replace((string)managementObj["OSArchitecture"], @"\-.+", "-bit")}, V{(string)managementObj["Version"]}\n";- СonfigurationData["Windows"] = $"\n{СonfigurationData["Windows"].TrimEnd('\n')}";- },- delegate- {- foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Name, Caption, Description, SerialNumber from Win32_BIOS", new EnumerationOptions { ReturnImmediately = true }).Get())- {- if (!string.IsNullOrEmpty((string)managementObj["Name"]))- СonfigurationData["BIOS"] += !string.IsNullOrEmpty((string)managementObj["SerialNumber"]) ? (string)managementObj["Name"] + ", S/N-" + (string)managementObj["SerialNumber"] + "\n" : (string)managementObj["Name"] + "\n";- else if (!string.IsNullOrEmpty((string)managementObj["Caption"]))- СonfigurationData["BIOS"] += !string.IsNullOrEmpty((string)managementObj["SerialNumber"]) ? (string)managementObj["Caption"] + ", S/N-" + (string)managementObj["SerialNumber"] + "\n" : (string)managementObj["Caption"] + "\n";- else if (!string.IsNullOrEmpty((string)managementObj["Description"]))- СonfigurationData["BIOS"] += !string.IsNullOrEmpty((string)managementObj["SerialNumber"]) ? (string)managementObj["Description"] + ", S/N-" + (string)managementObj["SerialNumber"] + "\n" : (string)managementObj["Description"] + "\n";- }- СonfigurationData["BIOS"] = СonfigurationData["BIOS"].TrimEnd('\n');- },- delegate- {- foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Manufacturer, Product, Version from Win32_BaseBoard", new EnumerationOptions { ReturnImmediately = true }).Get())- СonfigurationData["MotherBr"] = (string)managementObj["Manufacturer"] + (string)managementObj["Product"] + ", V" + (string)managementObj["Version"] + "\n";- СonfigurationData["MotherBr"] = СonfigurationData["MotherBr"].TrimEnd('\n');- },- delegate- {- foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Name from Win32_Processor", new EnumerationOptions { ReturnImmediately = true }).Get())- СonfigurationData["CPU"] = (string)managementObj["Name"] + "\n";- СonfigurationData["CPU"] = СonfigurationData["CPU"].TrimEnd('\n');- },- delegate- {- foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Name, AdapterRAM from Win32_VideoController", new EnumerationOptions { ReturnImmediately = true }).Get())- СonfigurationData["GPU"] += ((string)managementObj["Name"] + ", " + Convert.ToString(((uint)managementObj["AdapterRAM"] / 1024000000)) + " GB\n");- СonfigurationData["GPU"] = СonfigurationData["GPU"].TrimEnd('\n');- },- delegate- {- foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Manufacturer, Capacity, ConfiguredClockSpeed from Win32_PhysicalMemory", new EnumerationOptions { ReturnImmediately = true }).Get())- СonfigurationData["RAM"] += (string)managementObj["Manufacturer"] + ", " + Convert.ToString((ulong)managementObj["Capacity"] / 1024000000) + " GB, " + Convert.ToString((uint)managementObj["ConfiguredClockSpeed"]) + "MHz\n";- СonfigurationData["RAM"] = СonfigurationData["RAM"].TrimEnd('\n');- },- UpdatingDeviceData,- GettingUserIP);- }-- internal static void UpdatingDeviceData()- {- Parallel.Invoke(delegate- {- string storageType = СonfigurationData["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())- {- storageType = (ushort)(managementObj["MediaType"]) switch- {- 3 => "(HDD)",- 4 => "(SSD)",- 5 => "(SCM)",- _ => "(Unspecified)",- };- if (storageType == "(Unspecified)" && ((ushort)(managementObj["BusType"])) == 7) storageType = "(Media-Type)";- СonfigurationData["Storage"] += Convert.ToString((ulong)managementObj["Size"] / 1024000000) + " GB " + "[" + (string)managementObj["FriendlyName"] + "] " + storageType + "\n";- }- СonfigurationData["Storage"] = СonfigurationData["Storage"].TrimEnd('\n');- },- delegate- {- СonfigurationData["Audio"] = string.Empty;- foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Name,Caption,Description from Win32_SoundDevice", new EnumerationOptions { ReturnImmediately = true }).Get())- {- if (!string.IsNullOrEmpty((string)managementObj["Name"]))- СonfigurationData["Audio"] += (string)managementObj["Name"] + "\n";- else if (!string.IsNullOrEmpty((string)managementObj["Caption"]))- СonfigurationData["Audio"] += (string)managementObj["Caption"] + "\n";- else if (!string.IsNullOrEmpty((string)managementObj["Description"]))- СonfigurationData["Audio"] += (string)managementObj["Description"] + "\n";- }- СonfigurationData["Audio"] = СonfigurationData["Audio"].TrimEnd('\n');- },- delegate- {- СonfigurationData["NetAdapter"] = string.Empty;- foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Name from Win32_NetworkAdapter where NetConnectionStatus=2 or NetConnectionStatus=7", new EnumerationOptions { ReturnImmediately = true }).Get())- СonfigurationData["NetAdapter"] += (string)managementObj["Name"] + "\n";- СonfigurationData["NetAdapter"] = СonfigurationData["NetAdapter"].TrimEnd('\n');- });- }-- internal static bool IsNetworkAvailable()- {- try- {- string dns = CultureInfo.InstalledUICulture switch- {- { Name: string name } when name.StartsWith("fa") => "aparat.com",- { Name: string name } when name.StartsWith("zh") => "baidu.com",- { Name: string name } when name.StartsWith("ru") => "yandex.ru",- _ => "google.com",- };-- TimeSpan timeout = TimeSpan.FromSeconds(5.0);- using Task<IPAddress> task = Task.Run(() =>- {- return Dns.GetHostEntry(dns).AddressList[0];- });- if (!task.Wait(timeout))- return false;-- return true;- }- catch { return false; }- }-- internal static void GettingUserIP()- {- Parallel.Invoke(delegate- {- if (IsNetworkAvailable())- {- ClientInternetProtocol clientInternetProtocol = new ClientInternetProtocol();-- try- {- HttpClient client = new HttpClient { Timeout = TimeSpan.FromSeconds(5.0) };- clientInternetProtocol = JsonConvert.DeserializeObject<ClientInternetProtocol>(client.GetStringAsync("http://ip-api.com/json/?fields=61439").Result);- }- catch- {- СonfigurationData["UserIpAddress"] = (string)Application.Current.Resources["limited_systemInformation"];- CurrentConnection = ConnectionStatus.Limited;- }- finally- {- if (IPAddress.TryParse(clientInternetProtocol.Ip, out _) && !string.IsNullOrEmpty(clientInternetProtocol.Ip) && !string.IsNullOrEmpty(clientInternetProtocol.Country))- {- CurrentConnection = ConnectionStatus.Available;- СonfigurationData["UserIpAddress"] = clientInternetProtocol.Ip + " (" + clientInternetProtocol.Country + ")";- }- else- {- CurrentConnection = ConnectionStatus.Block;- СonfigurationData["UserIpAddress"] = (string)Application.Current.Resources["connection_block_systemInformation"];- }- }- }- else- {- CurrentConnection = ConnectionStatus.Lose;- СonfigurationData["UserIpAddress"] = (string)Application.Current.Resources["connection_lose_systemInformation"];- }- });- }- }- }-}diff --git "a/.Source/GTweak/Utilities/Tweaks/System\320\241onfiguration.cs" "b/.Source/GTweak/Utilities/Tweaks/System\320\241onfiguration.cs"new file mode 100644index 00000000..ad4fc928--- /dev/null+++ "b/.Source/GTweak/Utilities/Tweaks/System\320\241onfiguration.cs"@@ -0,0 +1,235 @@+using Microsoft.Win32;+using Newtonsoft.Json;+using System;+using System.Collections.Generic;+using System.Globalization;+using System.Management;+using System.Net;+using System.Net.Http;+using System.Text.RegularExpressions;+using System.Threading.Tasks;+using System.Windows;+using System.Windows.Media;+using System.Windows.Media.Imaging;++namespace GTweak.Utilities.Tweaks+{+ internal sealed class SystemСonfiguration+ {+ internal static ImageSource GetProfileImage()+ {+ try+ {+ RegistryKey regKey = default, ourKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users", true);++ foreach (string keyname in ourKey!.GetSubKeyNames())+ regKey = ourKey!.OpenSubKey(keyname);++ return new BitmapImage(new Uri(regKey?.GetValue("Image1080").ToString() ?? string.Empty));+ }+ catch { return null; }+ }++ internal static string GetProfileName()+ {+ string nameProfile = string.Empty;+ foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", $"select FullName from Win32_UserAccount where domain='{Environment.UserDomainName}' and name='{Environment.UserName.ToLower()}'").Get())+ nameProfile = (string)managementObj["FullName"];++ return nameProfile != string.Empty ? nameProfile : Environment.UserName.ToLower();+ }++ internal sealed class ClientInternetProtocol+ {+ [JsonProperty("query")]+ internal string Ip { get; set; }++ [JsonProperty("countryCode")]+ internal string Country { get; set; }+ }++ internal enum ConnectionStatus+ {+ Available,+ Lose,+ Block,+ Limited,+ }++ internal static ConnectionStatus CurrentConnection = ConnectionStatus.Lose;++ internal static string WindowsClientVersion { get; set; } = string.Empty;++ internal static readonly Dictionary<string, string> СonfigurationData = new Dictionary<string, string>()+ {+ { "Windows", Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", string.Empty)?.ToString() ?? string.Empty },++ { "BIOS", string.Empty },+ { "MotherBr", string.Empty },+ { "CPU", string.Empty },+ { "GPU", string.Empty },+ { "RAM", string.Empty },+ { "Storage", string.Empty },+ { "Audio", string.Empty },+ { "NetAdapter", string.Empty },++ { "UserIpAddress", Application.Current.Resources["connection_lose_systemInformation"].ToString() }+ };++ internal void GetConfiguration()+ {+ Parallel.Invoke(delegate+ {+ foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Caption, OSArchitecture, Version from Win32_OperatingSystem", new EnumerationOptions { ReturnImmediately = true }).Get())+ СonfigurationData["Windows"] = $"{Convert.ToString(managementObj["Caption"]).Substring(Convert.ToString(managementObj["Caption"]).IndexOf('W'))}, {Regex.Replace((string)managementObj["OSArchitecture"], @"\-.+", "-bit")}, V{(string)managementObj["Version"]}\n";+ СonfigurationData["Windows"] = $"\n{СonfigurationData["Windows"].TrimEnd('\n')}";+ },+ delegate+ {+ foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Name, Caption, Description, SerialNumber from Win32_BIOS", new EnumerationOptions { ReturnImmediately = true }).Get())+ {+ if (!string.IsNullOrEmpty((string)managementObj["Name"]))+ СonfigurationData["BIOS"] += !string.IsNullOrEmpty((string)managementObj["SerialNumber"]) ? (string)managementObj["Name"] + ", S/N-" + (string)managementObj["SerialNumber"] + "\n" : (string)managementObj["Name"] + "\n";+ else if (!string.IsNullOrEmpty((string)managementObj["Caption"]))+ СonfigurationData["BIOS"] += !string.IsNullOrEmpty((string)managementObj["SerialNumber"]) ? (string)managementObj["Caption"] + ", S/N-" + (string)managementObj["SerialNumber"] + "\n" : (string)managementObj["Caption"] + "\n";+ else if (!string.IsNullOrEmpty((string)managementObj["Description"]))+ СonfigurationData["BIOS"] += !string.IsNullOrEmpty((string)managementObj["SerialNumber"]) ? (string)managementObj["Description"] + ", S/N-" + (string)managementObj["SerialNumber"] + "\n" : (string)managementObj["Description"] + "\n";+ }+ СonfigurationData["BIOS"] = СonfigurationData["BIOS"].TrimEnd('\n');+ },+ delegate+ {+ foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Manufacturer, Product, Version from Win32_BaseBoard", new EnumerationOptions { ReturnImmediately = true }).Get())+ СonfigurationData["MotherBr"] = (string)managementObj["Manufacturer"] + (string)managementObj["Product"] + ", V" + (string)managementObj["Version"] + "\n";+ СonfigurationData["MotherBr"] = СonfigurationData["MotherBr"].TrimEnd('\n');+ },+ delegate+ {+ foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Name from Win32_Processor", new EnumerationOptions { ReturnImmediately = true }).Get())+ СonfigurationData["CPU"] = (string)managementObj["Name"] + "\n";+ СonfigurationData["CPU"] = СonfigurationData["CPU"].TrimEnd('\n');+ },+ delegate+ {+ foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Name, AdapterRAM from Win32_VideoController", new EnumerationOptions { ReturnImmediately = true }).Get())+ СonfigurationData["GPU"] += ((string)managementObj["Name"] + ", " + Convert.ToString(((uint)managementObj["AdapterRAM"] / 1024000000)) + " GB\n");+ СonfigurationData["GPU"] = СonfigurationData["GPU"].TrimEnd('\n');+ },+ delegate+ {+ foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Manufacturer, Capacity, ConfiguredClockSpeed from Win32_PhysicalMemory", new EnumerationOptions { ReturnImmediately = true }).Get())+ СonfigurationData["RAM"] += (string)managementObj["Manufacturer"] + ", " + Convert.ToString((ulong)managementObj["Capacity"] / 1024000000) + " GB, " + Convert.ToString((uint)managementObj["ConfiguredClockSpeed"]) + "MHz\n";+ СonfigurationData["RAM"] = СonfigurationData["RAM"].TrimEnd('\n');+ },+ GetUpdatingDevices,+ GetUserIpAddress);+ }++ internal static void GetUpdatingDevices()+ {+ Parallel.Invoke(delegate+ {+ string storageType = СonfigurationData["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())+ {+ storageType = (ushort)(managementObj["MediaType"]) switch+ {+ 3 => "(HDD)",+ 4 => "(SSD)",+ 5 => "(SCM)",+ _ => "(Unspecified)",+ };+ if (storageType == "(Unspecified)" && ((ushort)(managementObj["BusType"])) == 7) storageType = "(Media-Type)";+ СonfigurationData["Storage"] += Convert.ToString((ulong)managementObj["Size"] / 1024000000) + " GB " + "[" + (string)managementObj["FriendlyName"] + "] " + storageType + "\n";+ }+ СonfigurationData["Storage"] = СonfigurationData["Storage"].TrimEnd('\n');+ },+ delegate+ {+ СonfigurationData["Audio"] = string.Empty;+ foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Name,Caption,Description from Win32_SoundDevice", new EnumerationOptions { ReturnImmediately = true }).Get())+ {+ if (!string.IsNullOrEmpty((string)managementObj["Name"]))+ СonfigurationData["Audio"] += (string)managementObj["Name"] + "\n";+ else if (!string.IsNullOrEmpty((string)managementObj["Caption"]))+ СonfigurationData["Audio"] += (string)managementObj["Caption"] + "\n";+ else if (!string.IsNullOrEmpty((string)managementObj["Description"]))+ СonfigurationData["Audio"] += (string)managementObj["Description"] + "\n";+ }+ СonfigurationData["Audio"] = СonfigurationData["Audio"].TrimEnd('\n');+ },+ delegate+ {+ СonfigurationData["NetAdapter"] = string.Empty;+ foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Name from Win32_NetworkAdapter where NetConnectionStatus=2 or NetConnectionStatus=7", new EnumerationOptions { ReturnImmediately = true }).Get())+ СonfigurationData["NetAdapter"] += (string)managementObj["Name"] + "\n";+ СonfigurationData["NetAdapter"] = СonfigurationData["NetAdapter"].TrimEnd('\n');+ });+ }++ internal static bool IsNetworkAvailable()+ {+ try+ {+ string dns = CultureInfo.InstalledUICulture switch+ {+ { Name: string name } when name.StartsWith("fa") => "aparat.com",+ { Name: string name } when name.StartsWith("zh") => "baidu.com",+ { Name: string name } when name.StartsWith("ru") => "yandex.ru",+ _ => "google.com",+ };++ TimeSpan timeout = TimeSpan.FromSeconds(5.0);+ using Task<IPAddress> task = Task.Run(() =>+ {+ return Dns.GetHostEntry(dns).AddressList[0];+ });+ if (!task.Wait(timeout))+ return false;++ return true;+ }+ catch { return false; }+ }++ internal static void GetUserIpAddress()+ {+ Parallel.Invoke(delegate+ {+ if (IsNetworkAvailable())+ {+ ClientInternetProtocol clientInternetProtocol = new ClientInternetProtocol();++ try+ {+ HttpClient client = new HttpClient { Timeout = TimeSpan.FromSeconds(5.0) };+ clientInternetProtocol = JsonConvert.DeserializeObject<ClientInternetProtocol>(client.GetStringAsync("http://ip-api.com/json/?fields=61439").Result);+ }+ catch+ {+ СonfigurationData["UserIpAddress"] = (string)Application.Current.Resources["limited_systemInformation"];+ CurrentConnection = ConnectionStatus.Limited;+ }+ finally+ {+ if (IPAddress.TryParse(clientInternetProtocol.Ip, out _) && !string.IsNullOrEmpty(clientInternetProtocol.Ip) && !string.IsNullOrEmpty(clientInternetProtocol.Country))+ {+ CurrentConnection = ConnectionStatus.Available;+ СonfigurationData["UserIpAddress"] = $"{clientInternetProtocol.Ip} ({clientInternetProtocol.Country})";+ }+ else+ {+ CurrentConnection = ConnectionStatus.Block;+ СonfigurationData["UserIpAddress"] = (string)Application.Current.Resources["connection_block_systemInformation"];+ }+ }+ }+ else+ {+ CurrentConnection = ConnectionStatus.Lose;+ СonfigurationData["UserIpAddress"] = (string)Application.Current.Resources["connection_lose_systemInformation"];+ }+ });+ }+ }+}diff --git a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.csindex 7ee9adf6..9459c9df 100644--- a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs+++ b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs@@ -10,7 +10,7 @@ namespace GTweak.Utilities.Tweaksinternal sealed class WindowsLicense{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;+ private static bool IsVersionWindows(string pattern, byte words) => new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled).Matches(SystemСonfiguration.WindowsClientVersion).Count == words;internal void LicenseStatus(){@@ -66,7 +66,7 @@ namespace GTweak.Utilities.Tweaks{waitingWindow.Show();- if (SystemData.СomputerСonfiguration.WindowsClientVersion.Contains("10"))+ if (SystemСonfiguration.WindowsClientVersion.Contains("10")){cmdProcess.StartInfo.Arguments = $"/c assoc .vbs=VBSFile";cmdProcess.Start();diff --git a/.Source/GTweak/View/DataSystemView.xaml.cs b/.Source/GTweak/View/DataSystemView.xaml.csindex 586ed3c6..819b989a 100644--- a/.Source/GTweak/View/DataSystemView.xaml.cs+++ b/.Source/GTweak/View/DataSystemView.xaml.cs@@ -26,16 +26,16 @@ namespace GTweak.ViewApp.LanguageChanged += delegate{- switch (SystemData.СomputerСonfiguration.CurrentConnection)+ switch (SystemСonfiguration.CurrentConnection){- case SystemData.СomputerСonfiguration.ConnectionStatus.Lose:- SystemData.СomputerСonfiguration.СonfigurationData["UserIpAddress"] = (string)FindResource("connection_lose_systemInformation");+ case SystemСonfiguration.ConnectionStatus.Lose:+ SystemСonfiguration.СonfigurationData["UserIpAddress"] = (string)FindResource("connection_lose_systemInformation");break;- case SystemData.СomputerСonfiguration.ConnectionStatus.Block:- SystemData.СomputerСonfiguration.СonfigurationData["UserIpAddress"] = (string)FindResource("connection_block_systemInformation");+ case SystemСonfiguration.ConnectionStatus.Block:+ SystemСonfiguration.СonfigurationData["UserIpAddress"] = (string)FindResource("connection_block_systemInformation");break;- case SystemData.СomputerСonfiguration.ConnectionStatus.Limited:- SystemData.СomputerСonfiguration.СonfigurationData["UserIpAddress"] = (string)FindResource("limited_systemInformation");+ case SystemСonfiguration.ConnectionStatus.Limited:+ SystemСonfiguration.СonfigurationData["UserIpAddress"] = (string)FindResource("limited_systemInformation");break;}DataContext = new DataSystemVM();@@ -48,8 +48,8 @@ namespace GTweak.ViewBackgroundQueue backgroundQueue = new BackgroundQueue();await backgroundQueue.QueueTask(async delegate{- Parallel.Invoke(SystemData.СomputerСonfiguration.UpdatingDeviceData);- await SystemData.MonitoringSystem.GetProcessorUsage();+ Parallel.Invoke(SystemСonfiguration.GetUpdatingDevices);+ await MonitoringSystem.GetProcessorUsage();});Application.Current.Dispatcher.Invoke(AnimationProgressBars);if (BtnHiddenIP.IsChecked.Value & BtnHiddenIP.Visibility == Visibility.Hidden)@@ -63,7 +63,7 @@ namespace GTweak.Viewelse if (time.TotalSeconds % 5 == 0){BackgroundQueue backgroundQueue = new BackgroundQueue();- await backgroundQueue.QueueTask(delegate { SystemData.СomputerСonfiguration.GettingUserIP(); });+ await backgroundQueue.QueueTask(delegate { SystemСonfiguration.GetUserIpAddress(); });DataContext = new DataSystemVM();}@@ -80,7 +80,7 @@ namespace GTweak.ViewDoubleAnimation doubleAnim = new DoubleAnimation(){From = CPULoad.Value,- To = SystemData.MonitoringSystem.PercentageProcessorUsage,+ To = MonitoringSystem.PercentageProcessorUsage,EasingFunction = new PowerEase(),Duration = TimeSpan.FromSeconds(0.2)};@@ -91,7 +91,7 @@ namespace GTweak.ViewdoubleAnim = new DoubleAnimation(){From = RAMLoad.Value,- To = new SystemData.MonitoringSystem().GetMemoryUsage(),+ To = new MonitoringSystem().GetMemoryUsage(),EasingFunction = new PowerEase(),Duration = TimeSpan.FromSeconds(0.2)};@@ -173,8 +173,8 @@ namespace GTweak.Viewprivate void Page_Loaded(object sender, RoutedEventArgs e){- CPULoad.Value = SystemData.MonitoringSystem.PercentageProcessorUsage;- RAMLoad.Value = new SystemData.MonitoringSystem().GetMemoryUsage();+ CPULoad.Value = MonitoringSystem.PercentageProcessorUsage;+ RAMLoad.Value = new MonitoringSystem().GetMemoryUsage();}}}diff --git a/.Source/GTweak/Windows/LoadingWindow.xaml.cs b/.Source/GTweak/Windows/LoadingWindow.xaml.csindex efd91403..5cb4e8b4 100644--- a/.Source/GTweak/Windows/LoadingWindow.xaml.cs+++ b/.Source/GTweak/Windows/LoadingWindow.xaml.cs@@ -50,7 +50,7 @@ namespace GTweak.Windowsdelegate { Settings.PID = TrustedInstaller.StartTrustedInstallerService(); },new Settings().СheckingParameters,new WindowsLicense().LicenseStatus,- new SystemData.СomputerСonfiguration().GetConfiguration,+ new SystemСonfiguration().GetConfiguration,new SearchUpdates().StartСhecking,new UninstallingPakages().ViewInstalledPackages,new UninstallingPakages().CheckingForLocalAccount,