Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
freeing an unnecessary class
Greedeks1ef55f484f6d
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csprojindex 0698d4a8..b1da9033 100644--- a/.Source/GTweak/GTweak.csproj+++ b/.Source/GTweak/GTweak.csproj@@ -279,7 +279,6 @@<Compile Include="Utilities\Helpers\Storage\NotifActionsStorage.cs" /><Compile Include="Utilities\Tweaks\ClearingMemory.cs" /><Compile Include="Utilities\Helpers\INIManager.cs" />- <Compile Include="Utilities\Configuration\QueryUpdates.cs" /><Compile Include="Utilities\Configuration\MonitoringSystem.cs" /><Compile Include="Utilities\Configuration\SystemDiagnostics.cs" /><Compile Include="Utilities\Control\ViewNotification.cs" />diff --git a/.Source/GTweak/Utilities/Configuration/QueryUpdates.cs b/.Source/GTweak/Utilities/Configuration/QueryUpdates.csdeleted file mode 100644index 317eab78..00000000--- a/.Source/GTweak/Utilities/Configuration/QueryUpdates.cs+++ /dev/null@@ -1,49 +0,0 @@-using GTweak.Utilities.Control;-using Newtonsoft.Json;-using System.IO;-using System.Net;--namespace GTweak.Utilities.Configuration-{- internal sealed class QueryUpdates- {- private sealed class GitMetadata- {- [JsonProperty("tag_name")]- internal string СurrentVersion { get; set; }- }-- internal static bool IsNeedUpdate { get; private set; } = false;- internal static string DownloadVersion { get; private set; } = string.Empty;-- internal void RunSearch()- {- if (!SettingsRepository.IsСheckingUpdate)- return;-- try- {- HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("https://api.github.com/repos/greedeks/gtweak/releases/latest");-- webRequest.ContentType = "application/json";- webRequest.UserAgent = "Nothing";- webRequest.Timeout = 5000;-- using HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();- using StreamReader sreader = new StreamReader(response.GetResponseStream());- string DataAsJson = sreader.ReadToEnd();- GitMetadata gitVersionUtility = JsonConvert.DeserializeObject<GitMetadata>(DataAsJson);-- if (!string.IsNullOrEmpty(gitVersionUtility.СurrentVersion) && gitVersionUtility.СurrentVersion.CompareTo(SettingsRepository.currentRelease) > 0)- {- IsNeedUpdate = true;- DownloadVersion = gitVersionUtility.СurrentVersion;- }- }- catch- {- IsNeedUpdate = false;- }- }- }-}diff --git a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.csindex 0e677331..944be007 100644--- a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs+++ b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs@@ -1,9 +1,11 @@-using GTweak.Utilities.Helpers;+using GTweak.Utilities.Control;+using GTweak.Utilities.Helpers;using Microsoft.Win32;using Newtonsoft.Json;using System;using System.Collections.Generic;using System.Globalization;+using System.IO;using System.Linq;using System.Management;using System.Net;@@ -20,6 +22,12 @@ namespace GTweak.Utilities.Configuration{internal sealed class SystemDiagnostics{+ private sealed class GitMetadata+ {+ [JsonProperty("tag_name")]+ internal string СurrentVersion { get; set; }+ }+private sealed class IPMetadata{[JsonProperty("query")]@@ -39,6 +47,8 @@ namespace GTweak.Utilities.Configurationinternal static ConnectionStatus CurrentConnection = ConnectionStatus.Lose;+ internal static bool IsNeedUpdate { get; private set; } = false;+ internal static string DownloadVersion { get; private set; } = string.Empty;internal static string WindowsClientVersion { get; set; } = string.Empty;internal static string WindowsBuildVersion { get; set; } = string.Empty;@@ -456,5 +466,32 @@ namespace GTweak.Utilities.Configuration}.TryGetValue(CurrentConnection, out string resourceKey)) { HardwareData["UserIpAddress"] = (string)Application.Current.Resources[resourceKey]; }});}++ internal void ValidateVersionUpdates()+ {+ if (!SettingsRepository.IsUpdateCheckRequired || !IsNetworkAvailable())+ return;++ try+ {+ HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("https://api.github.com/repos/greedeks/gtweak/releases/latest");++ webRequest.ContentType = "application/json";+ webRequest.UserAgent = "Nothing";+ webRequest.Timeout = 5000;++ using HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();+ using StreamReader sreader = new StreamReader(response.GetResponseStream());+ string DataAsJson = sreader.ReadToEnd();+ GitMetadata gitVersionUtility = JsonConvert.DeserializeObject<GitMetadata>(DataAsJson);++ if (!string.IsNullOrEmpty(gitVersionUtility.СurrentVersion) && gitVersionUtility.СurrentVersion.CompareTo(SettingsRepository.currentRelease) > 0)+ {+ IsNeedUpdate = true;+ DownloadVersion = gitVersionUtility.СurrentVersion;+ }+ }+ catch { IsNeedUpdate = false; }+ }}}diff --git a/.Source/GTweak/Utilities/Control/SettingsRepository.cs b/.Source/GTweak/Utilities/Control/SettingsRepository.csindex c6c856b6..81396b43 100644--- a/.Source/GTweak/Utilities/Control/SettingsRepository.cs+++ b/.Source/GTweak/Utilities/Control/SettingsRepository.cs@@ -36,7 +36,7 @@ namespace GTweak.Utilities.Controlprivate static readonly Dictionary<string, Action> parameterUpdates = new Dictionary<string, Action>{{ "Notification", () => IsViewNotification = RegistryHelp.GetValue(StoragePaths.RegistryLocation, "Notification", IsViewNotification) },- { "Update", () => IsСheckingUpdate = RegistryHelp.GetValue(StoragePaths.RegistryLocation, "Update", IsСheckingUpdate) },+ { "Update", () => IsUpdateCheckRequired = RegistryHelp.GetValue(StoragePaths.RegistryLocation, "Update", IsUpdateCheckRequired) },{ "TopMost", () => IsTopMost = RegistryHelp.GetValue(StoragePaths.RegistryLocation, "TopMost", IsTopMost) },{ "Sound", () => IsPlayingSound = RegistryHelp.GetValue(StoragePaths.RegistryLocation, "Sound", IsPlayingSound) },{ "Volume", () => Volume = RegistryHelp.GetValue(StoragePaths.RegistryLocation, "Volume", Volume) },@@ -58,7 +58,7 @@ namespace GTweak.Utilities.Control};internal static bool IsViewNotification { get => (bool)defaultRegValues["Notification"]; set => defaultRegValues["Notification"] = value; }- internal static bool IsСheckingUpdate { get => (bool)defaultRegValues["Update"]; set => defaultRegValues["Update"] = value; }+ internal static bool IsUpdateCheckRequired { get => (bool)defaultRegValues["Update"]; set => defaultRegValues["Update"] = value; }internal static bool IsTopMost { get => (bool)defaultRegValues["TopMost"]; set => defaultRegValues["TopMost"] = value; }internal static bool IsPlayingSound { get => (bool)defaultRegValues["Sound"]; set => defaultRegValues["Sound"] = value; }internal static int Volume { get => (int)defaultRegValues["Volume"]; set => defaultRegValues["Volume"] = value; }diff --git a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs b/.Source/GTweak/Utilities/Helpers/RegistryHelp.csindex 2b1ff3ee..ef71bdf3 100644--- a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs+++ b/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs@@ -145,10 +145,7 @@ namespace GTweak.Utilities.Helpersresult.Add(name);return result;}- catch- {- return new T();- }+ catch { return new T(); }}}}diff --git a/.Source/GTweak/Windows/LoadingWindow.xaml.cs b/.Source/GTweak/Windows/LoadingWindow.xaml.csindex 63787860..a48bb937 100644--- a/.Source/GTweak/Windows/LoadingWindow.xaml.cs+++ b/.Source/GTweak/Windows/LoadingWindow.xaml.cs@@ -53,7 +53,7 @@ namespace GTweak.Windowsnew SettingsRepository().СheckingParameters,new WindowsLicense().LicenseStatus,new SystemDiagnostics().GetHardwareData,- new QueryUpdates().RunSearch,+ new SystemDiagnostics().ValidateVersionUpdates,new UninstallingPakages().LoadInstalledPackages,new UninstallingPakages().CheckingForLocalAccount,new SystemTweaks().ViewNetshState,diff --git a/.Source/GTweak/Windows/MainWindow.xaml.cs b/.Source/GTweak/Windows/MainWindow.xaml.csindex d624c006..2320a2ed 100644--- a/.Source/GTweak/Windows/MainWindow.xaml.cs+++ b/.Source/GTweak/Windows/MainWindow.xaml.cs@@ -22,7 +22,7 @@ namespace GTweakInitializeComponent();BtnNotification.StateNA = SettingsRepository.IsViewNotification;- BtnUpdate.StateNA = SettingsRepository.IsСheckingUpdate;+ BtnUpdate.StateNA = SettingsRepository.IsUpdateCheckRequired;BtnTopMost.StateNA = Topmost = SettingsRepository.IsTopMost;BtnSoundNtn.IsChecked = SettingsRepository.IsPlayingSound;SliderVolume.Value = SettingsRepository.Volume;@@ -132,7 +132,7 @@ namespace GTweak};doubleAnim.Completed += async delegate{- if (QueryUpdates.IsNeedUpdate && SettingsRepository.IsСheckingUpdate)+ if (SystemDiagnostics.IsNeedUpdate && SettingsRepository.IsUpdateCheckRequired){await Task.Delay(500);new UpdateWindow().ShowDialog();diff --git a/.Source/GTweak/Windows/UpdateWindow.xaml.cs b/.Source/GTweak/Windows/UpdateWindow.xaml.csindex 4f571566..4a3bd8d9 100644--- a/.Source/GTweak/Windows/UpdateWindow.xaml.cs+++ b/.Source/GTweak/Windows/UpdateWindow.xaml.cs@@ -17,7 +17,7 @@ namespace GTweak.Windows{InitializeComponent();CurrentVerison.Text = SettingsRepository.currentRelease;- DownloadVersion.Text = NewVerison.Text = QueryUpdates.DownloadVersion;+ DownloadVersion.Text = NewVerison.Text = SystemDiagnostics.DownloadVersion;}private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e)