Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
improvement of the output network status
Greedeks65457ae9da34
diff --git a/.Source/GTweak/Core/ViewModel/DataSystemVM.cs b/.Source/GTweak/Core/ViewModel/DataSystemVM.csindex ab3dffd0..7045d0b2 100644--- a/.Source/GTweak/Core/ViewModel/DataSystemVM.cs+++ b/.Source/GTweak/Core/ViewModel/DataSystemVM.cs@@ -23,19 +23,40 @@ namespace GTweak.Core.ViewModelpublic int SetBlurValue{get => _model.BlurValue;- set { _model.BlurValue = value; OnPropertyChanged(); }+ set+ {+ if (_model.BlurValue != value)+ {+ _model.BlurValue = value;+ OnPropertyChanged();+ }+ }}public Visibility SetVisibility{get => _model.IpVisibility;- set { _model.IpVisibility = value; OnPropertyChanged(); }+ set+ {+ if (_model.IpVisibility != value)+ {+ _model.IpVisibility = value;+ OnPropertyChanged();+ }+ }}public bool StateButton{get => SettingsRepository.IsHiddenIpAddress;- set { SettingsRepository.IsHiddenIpAddress = value; OnPropertyChanged(); }+ set+ {+ if (SettingsRepository.IsHiddenIpAddress != value)+ {+ SettingsRepository.IsHiddenIpAddress = value;+ OnPropertyChanged();+ }+ }}public DataSystemVM()@@ -58,16 +79,8 @@ namespace GTweak.Core.ViewModelnew DataSystemModel { Name = "IpAddress", Data = SystemDiagnostics.HardwareData["UserIpAddress"] }};- if (SystemDiagnostics.CurrentConnection == SystemDiagnostics.ConnectionStatus.Available)- {- SetBlurValue = SettingsRepository.IsHiddenIpAddress ? 20 : 0;- SetVisibility = Visibility.Visible;- }- else- {- SetBlurValue = 0;- SetVisibility = Visibility.Hidden;- }+ SetBlurValue = (SystemDiagnostics.isIPAddressFormatValid && SettingsRepository.IsHiddenIpAddress) ? 20 : 0;+ SetVisibility = SystemDiagnostics.isIPAddressFormatValid ? Visibility.Visible : Visibility.Hidden;}}}diff --git a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.csindex 157a0c66..51d7b106 100644--- a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs+++ b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs@@ -73,6 +73,9 @@ namespace GTweak.Utilities.Configuration{ "UserIpAddress", Application.Current.Resources["connection_lose_systemInformation"].ToString() }};+ internal static bool isIPAddressFormatValid = false;++internal ImageSource GetProfileImage(){try@@ -441,9 +444,9 @@ namespace GTweak.Utilities.Configurationcatch { return false; }}- internal async void GetUserIpAddress()+ internal void GetUserIpAddress(){- await Task.Run(async () =>+ Task.Run(async () =>{if (IsNetworkAvailable()){@@ -453,11 +456,10 @@ namespace GTweak.Utilities.Configurationstring response = await client.GetStringAsync("http://ip-api.com/json/?fields=61439");IPMetadata ipMetadata = JsonConvert.DeserializeObject<IPMetadata>(response);- if (IPAddress.TryParse(ipMetadata.Ip, out _) && !string.IsNullOrEmpty(ipMetadata.Ip) && !string.IsNullOrEmpty(ipMetadata.Country))+ if (IPAddress.TryParse(ipMetadata.Ip, out _) && !string.IsNullOrEmpty(ipMetadata?.Ip) && !string.IsNullOrEmpty(ipMetadata?.Country)){CurrentConnection = ConnectionStatus.Available;HardwareData["UserIpAddress"] = $"{ipMetadata.Ip} ({ipMetadata.Country})";- return;}elseCurrentConnection = ConnectionStatus.Block;@@ -473,6 +475,8 @@ namespace GTweak.Utilities.Configuration{ ConnectionStatus.Block, "connection_block_systemInformation" },{ ConnectionStatus.Limited, "limited_systemInformation" }}.TryGetValue(CurrentConnection, out string resourceKey)) { HardwareData["UserIpAddress"] = (string)Application.Current.Resources[resourceKey]; }++ isIPAddressFormatValid = HardwareData["UserIpAddress"].Any(char.IsDigit);});}diff --git a/.Source/GTweak/Utilities/Helpers/Managers/TaskSchedulerManager.cs b/.Source/GTweak/Utilities/Helpers/Managers/TaskSchedulerManager.csindex 85038ede..861f4bae 100644--- a/.Source/GTweak/Utilities/Helpers/Managers/TaskSchedulerManager.cs+++ b/.Source/GTweak/Utilities/Helpers/Managers/TaskSchedulerManager.cs@@ -38,7 +38,7 @@ namespace GTweak.Utilities.Helpers.Managers}}}- }).Wait();+ });}internal static void SetTaskStateOwner(bool state, params string[] tasklist)@@ -51,7 +51,7 @@ namespace GTweak.Utilities.Helpers.Managerscommand = command.TrimEnd(' ', '&');TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, command);- }).Wait();+ });}@@ -66,7 +66,7 @@ namespace GTweak.Utilities.Helpers.Managersif (task != null)taskService.RootFolder.DeleteTask(taskname);}- }).Wait();+ });}}}diff --git a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs b/.Source/GTweak/Utilities/Helpers/RegistryHelp.csindex 9499770d..b759467c 100644--- a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs+++ b/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs@@ -36,7 +36,7 @@ namespace GTweak.Utilities.Helpersregistrykey.OpenSubKey(subkey, true)?.DeleteValue(value);}catch (Exception ex) { ErrorLogging.LogDebug(ex); }- }).Wait();+ });}internal static void Write<T>(RegistryKey registrykey, string subkey, string name, T data, RegistryValueKind kind, bool isTakingOwner = false)@@ -57,7 +57,7 @@ namespace GTweak.Utilities.Helpers{ErrorLogging.LogDebug(ex);}- }).Wait();+ });}internal static void CreateFolder(RegistryKey registrykey, string subkey)@@ -66,7 +66,7 @@ namespace GTweak.Utilities.Helpers{try { registrykey.CreateSubKey(subkey); }catch (Exception ex) { ErrorLogging.LogDebug(ex); }- }).Wait();+ });}internal static void DeleteFolderTree(RegistryKey registrykey, string subkey, bool isTakingOwner = false)@@ -94,7 +94,7 @@ namespace GTweak.Utilities.Helpersregistrykey.DeleteSubKeyTree(subkey, false);}catch (Exception ex) { ErrorLogging.LogDebug(ex); }- }).Wait();+ });}internal static bool KeyExists(in RegistryKey registrykey, in string subkey, in bool isNegation = true)diff --git a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.csindex e47cf337..5fc76af6 100644--- a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs+++ b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs@@ -206,7 +206,7 @@ namespace GTweak.Utilities.Tweaks}}catch (Exception ex) { ErrorLogging.LogDebug(ex); }- }).Wait();+ });break;case "TglButton10":if (isChoose)diff --git a/.Source/GTweak/View/DataSystemView.xaml.cs b/.Source/GTweak/View/DataSystemView.xaml.csindex b420db1a..f295ef94 100644--- a/.Source/GTweak/View/DataSystemView.xaml.cs+++ b/.Source/GTweak/View/DataSystemView.xaml.cs@@ -47,13 +47,6 @@ namespace GTweak.Viewawait new MonitoringSystem().GetTotalProcessorUsage();});Application.Current.Dispatcher.Invoke(AnimationProgressBars);- if (BtnHiddenIP.IsChecked.Value & BtnHiddenIP.Visibility == Visibility.Hidden)- {- DoubleAnimation doubleAnim = new DoubleAnimation(0, (Duration)TimeSpan.FromSeconds(0.18));- doubleAnim.Completed += delegate { SettingsRepository.ChangingParameters(false, "HiddenIP"); };- Timeline.SetDesiredFrameRate(doubleAnim, 400);- IpAddress.Effect.BeginAnimation(BlurEffect.RadiusProperty, doubleAnim);- }}else if (_time.TotalSeconds % 5 == 0){@@ -62,6 +55,14 @@ namespace GTweak.ViewDataContext = new DataSystemVM();}+ if (BtnHiddenIP.IsChecked.Value & BtnHiddenIP.Visibility == Visibility.Hidden & !SystemDiagnostics.isIPAddressFormatValid)+ {+ DoubleAnimation doubleAnim = new DoubleAnimation(0, (Duration)TimeSpan.FromSeconds(0.18));+ doubleAnim.Completed += delegate { SettingsRepository.ChangingParameters(false, "HiddenIP"); };+ Timeline.SetDesiredFrameRate(doubleAnim, 400);+ IpAddress.Effect.BeginAnimation(BlurEffect.RadiusProperty, doubleAnim);+ }+_time = _time.Add(TimeSpan.FromSeconds(+1));}, Application.Current.Dispatcher);_timer.Start();