Skip to content

Portable Tool for an Ideal Windows Setup

-fixing a name conflict & re

Greedeksa25b0578a23a
diff --git a/.Source/GTweak/Core/ViewModel/DataSystemVM.cs b/.Source/GTweak/Core/ViewModel/DataSystemVM.cs
index 9ca5a8a1..a560f309 100644
--- a/.Source/GTweak/Core/ViewModel/DataSystemVM.cs
+++ b/.Source/GTweak/Core/ViewModel/DataSystemVM.cs
@@ -34,8 +34,8 @@ namespace GTweak.Core.ViewModel
public bool StateButton
{
- get => Settings.IsHiddenIpAddress;
- set { Settings.IsHiddenIpAddress = value; OnPropertyChanged(); }
+ get => SettingsRepository.IsHiddenIpAddress;
+ set { SettingsRepository.IsHiddenIpAddress = value; OnPropertyChanged(); }
}
public DataSystemVM()
@@ -57,15 +57,15 @@ namespace GTweak.Core.ViewModel
new DataSystemModel { Name = "IpAddress", Data = SystemDiagnostics.СonfigurationData["UserIpAddress"] }
};
- if (Settings.IsHiddenIpAddress & SystemDiagnostics.CurrentConnection == SystemDiagnostics.ConnectionStatus.Available)
+ if (SystemDiagnostics.CurrentConnection == SystemDiagnostics.ConnectionStatus.Available)
{
- SetBlurValue = 20;
+ SetBlurValue = SettingsRepository.IsHiddenIpAddress ? 20 : 0;
SetVisibility = Visibility.Visible;
}
else
{
SetBlurValue = 0;
- SetVisibility = SystemDiagnostics.CurrentConnection == SystemDiagnostics.ConnectionStatus.Available ? Visibility.Visible : Visibility.Hidden;
+ SetVisibility = Visibility.Hidden;
}
}
}
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csproj
index 60f935fa..e7e320a2 100644
--- a/.Source/GTweak/GTweak.csproj
+++ b/.Source/GTweak/GTweak.csproj
@@ -267,11 +267,11 @@
<Compile Include="Utilities\Helpers\UnarchiveManager.cs" />
<Compile Include="Utilities\Helpers\BackgroundQueue.cs" />
<Compile Include="Utilities\Helpers\RegistryHelp.cs" />
- <Compile Include="Utilities\Control\Settings.cs" />
+ <Compile Include="Utilities\Control\SettingsRepository.cs" />
<Compile Include="Utilities\Helpers\TakingOwnership.cs" />
<Compile Include="Utilities\Tweaks\ClearingMemory.cs" />
<Compile Include="Utilities\Helpers\INIManager.cs" />
- <Compile Include="Utilities\Control\SearchUpdates.cs" />
+ <Compile Include="Utilities\Control\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/SystemDiagnostics.cs b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
index bd83e5b4..7ca9e4ec 100644
--- a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
+++ b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
@@ -39,7 +39,7 @@ namespace GTweak.Utilities.Configuration
return nameProfile != string.Empty ? nameProfile : Environment.UserName.ToLower();
}
- internal sealed class ClientInternetProtocol
+ internal sealed class IPMetadata
{
[JsonProperty("query")]
internal string Ip { get; set; }
@@ -194,16 +194,16 @@ namespace GTweak.Utilities.Configuration
internal static void GetUserIpAddress()
{
- Parallel.Invoke(delegate
+ Task.Run(delegate
{
if (IsNetworkAvailable())
{
- ClientInternetProtocol clientInternetProtocol = new ClientInternetProtocol();
+ IPMetadata ipMetadata = new IPMetadata();
try
{
HttpClient client = new HttpClient { Timeout = TimeSpan.FromSeconds(5.0) };
- clientInternetProtocol = JsonConvert.DeserializeObject<ClientInternetProtocol>(client.GetStringAsync("http://ip-api.com/json/?fields=61439").Result);
+ ipMetadata = JsonConvert.DeserializeObject<IPMetadata>(client.GetStringAsync("http://ip-api.com/json/?fields=61439").Result);
}
catch
{
@@ -212,10 +212,10 @@ namespace GTweak.Utilities.Configuration
}
finally
{
- if (IPAddress.TryParse(clientInternetProtocol.Ip, out _) && !string.IsNullOrEmpty(clientInternetProtocol.Ip) && !string.IsNullOrEmpty(clientInternetProtocol.Country))
+ if (IPAddress.TryParse(ipMetadata.Ip, out _) && !string.IsNullOrEmpty(ipMetadata.Ip) && !string.IsNullOrEmpty(ipMetadata.Country))
{
CurrentConnection = ConnectionStatus.Available;
- СonfigurationData["UserIpAddress"] = $"{clientInternetProtocol.Ip} ({clientInternetProtocol.Country})";
+ СonfigurationData["UserIpAddress"] = $"{ipMetadata.Ip} ({ipMetadata.Country})";
}
else
{
diff --git a/.Source/GTweak/Utilities/Control/BlockRunTweaker.cs b/.Source/GTweak/Utilities/Control/BlockRunTweaker.cs
index db30a9ea..bedf07a0 100644
--- a/.Source/GTweak/Utilities/Control/BlockRunTweaker.cs
+++ b/.Source/GTweak/Utilities/Control/BlockRunTweaker.cs
@@ -22,7 +22,7 @@ namespace GTweak.Utilities.Control
{
Process.Start(new ProcessStartInfo()
{
- Arguments = @$"/c timeout /t 10 && del %userprofile%\AppData\Local\CrashDumps\*{Settings.currentName}*",
+ Arguments = @$"/c timeout /t 10 && del %userprofile%\AppData\Local\CrashDumps\*{SettingsRepository.currentName}*",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "cmd.exe"
diff --git a/.Source/GTweak/Utilities/Control/SearchUpdates.cs b/.Source/GTweak/Utilities/Control/QueryUpdates.cs
similarity index 80%
rename from .Source/GTweak/Utilities/Control/SearchUpdates.cs
rename to .Source/GTweak/Utilities/Control/QueryUpdates.cs
index 7d951e98..d7e123ea 100644
--- a/.Source/GTweak/Utilities/Control/SearchUpdates.cs
+++ b/.Source/GTweak/Utilities/Control/QueryUpdates.cs
@@ -1,13 +1,12 @@
using Newtonsoft.Json;
-using System;
using System.IO;
using System.Net;
namespace GTweak.Utilities.Control
{
- internal sealed class SearchUpdates
+ internal sealed class QueryUpdates
{
- internal class GitVersionUtility
+ internal class GitMetadata
{
[JsonProperty("tag_name")]
internal string СurrentVersion { get; set; }
@@ -16,9 +15,9 @@ namespace GTweak.Utilities.Control
internal static bool IsNeedUpdate { get; private set; } = false;
internal static string DownloadVersion { get; private set; } = string.Empty;
- internal void StartСhecking()
+ internal void RunSearch()
{
- if (!Settings.IsСheckingUpdate)
+ if (!SettingsRepository.IsСheckingUpdate)
return;
try
@@ -32,9 +31,9 @@ namespace GTweak.Utilities.Control
using (StreamReader sreader = new StreamReader(response.GetResponseStream()))
{
string DataAsJson = sreader.ReadToEnd();
- GitVersionUtility gitVersionUtility = JsonConvert.DeserializeObject<GitVersionUtility>(DataAsJson);
+ GitMetadata gitVersionUtility = JsonConvert.DeserializeObject<GitMetadata>(DataAsJson);
- if (!string.IsNullOrEmpty(gitVersionUtility.СurrentVersion) && gitVersionUtility.СurrentVersion.CompareTo(Settings.currentRelease) > 0)
+ if (!string.IsNullOrEmpty(gitVersionUtility.СurrentVersion) && gitVersionUtility.СurrentVersion.CompareTo(SettingsRepository.currentRelease) > 0)
{
IsNeedUpdate = true;
DownloadVersion = gitVersionUtility.СurrentVersion;
diff --git a/.Source/GTweak/Utilities/Control/Settings.cs b/.Source/GTweak/Utilities/Control/SettingsRepository.cs
similarity index 98%
rename from .Source/GTweak/Utilities/Control/Settings.cs
rename to .Source/GTweak/Utilities/Control/SettingsRepository.cs
index d40d9028..116f0f62 100644
--- a/.Source/GTweak/Utilities/Control/Settings.cs
+++ b/.Source/GTweak/Utilities/Control/SettingsRepository.cs
@@ -21,7 +21,7 @@ namespace GTweak.Utilities.Control
internal static string Hosts => Path.Combine(Environment.SystemDirectory, @"drivers\etc\hosts");
}
- internal sealed class Settings
+ internal sealed class SettingsRepository
{
internal sealed class WinmmMethods
{
@@ -68,7 +68,7 @@ namespace GTweak.Utilities.Control
registryKey?.SetValue("HiddenIP", IsHiddenIpAddress, RegistryValueKind.String);
registryKey?.SetValue("Theme", Theme, RegistryValueKind.String);
registryKey?.SetValue("Language", App.GettingSystemLanguage, RegistryValueKind.String);
- WinmmMethods.waveOutSetVolume(IntPtr.Zero, ((uint)(double)((ushort.MaxValue / 100) * defaultVolume) & 0x0000ffff) | ((uint)(double)((ushort.MaxValue / 100) * defaultVolume) << 16));
+ WinmmMethods.waveOutSetVolume(IntPtr.Zero, ((uint)(double)(ushort.MaxValue / 100 * defaultVolume) & 0x0000ffff) | ((uint)(double)((ushort.MaxValue / 100) * defaultVolume) << 16));
}
else
{
@@ -80,7 +80,6 @@ namespace GTweak.Utilities.Control
Language = registryKey?.GetValue("Language").ToString() ?? App.GettingSystemLanguage;
Theme = registryKey?.GetValue("Theme").ToString() ?? "Dark";
WinmmMethods.waveOutGetVolume(IntPtr.Zero, out currentVolume);
-
}
registryKey?.Close();
}
diff --git a/.Source/GTweak/Utilities/Control/ViewNotification.cs b/.Source/GTweak/Utilities/Control/ViewNotification.cs
index 30e05c96..5cac1eac 100644
--- a/.Source/GTweak/Utilities/Control/ViewNotification.cs
+++ b/.Source/GTweak/Utilities/Control/ViewNotification.cs
@@ -13,7 +13,7 @@ namespace GTweak.Utilities.Control
internal void Show(string action, string tittle = "", string content = "")
{
- if (Settings.IsViewNotification)
+ if (SettingsRepository.IsViewNotification)
{
Application.Current.Dispatcher.Invoke(delegate
{
diff --git a/.Source/GTweak/Utilities/Helpers/TaskSchedulerManager.cs b/.Source/GTweak/Utilities/Helpers/TaskSchedulerManager.cs
index c740c48f..c64e755b 100644
--- a/.Source/GTweak/Utilities/Helpers/TaskSchedulerManager.cs
+++ b/.Source/GTweak/Utilities/Helpers/TaskSchedulerManager.cs
@@ -50,7 +50,7 @@ namespace GTweak.Utilities.Helpers
command = command.TrimEnd(' ', '&');
- TrustedInstaller.CreateProcessAsTrustedInstaller(Settings.PID, command);
+ TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, command);
});
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
index b3d4de8b..232ef553 100644
--- a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
@@ -309,7 +309,7 @@ namespace GTweak.Utilities.Tweaks
}
break;
case "TglButton16":
- TrustedInstaller.CreateProcessAsTrustedInstaller(Control.Settings.PID, $@"cmd.exe /c reg add HKLM\SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service /t REG_DWORD /v Start /d {(isChoose ? "4" : "3")} /f");
+ TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, $@"cmd.exe /c reg add HKLM\SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service /t REG_DWORD /v Start /d {(isChoose ? "4" : "3")} /f");
RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service", "Start", isChoose ? 4 : 3, RegistryValueKind.DWord, true);
break;
case "TglButton17":
diff --git a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
index 847c1a54..a94bfdd0 100644
--- a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
@@ -227,7 +227,7 @@ namespace GTweak.Utilities.Tweaks
Task.Run(delegate
{
string value = isChoose ? "4" : "3";
- TrustedInstaller.CreateProcessAsTrustedInstaller(Settings.PID, $"cmd.exe /c reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\WalletService /t REG_DWORD /v Start /d {value} /f & " +
+ TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, $"cmd.exe /c reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\WalletService /t REG_DWORD /v Start /d {value} /f & " +
$"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\VacSvc /t REG_DWORD /v Start /d {value} /f & " +
$"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\spectrum /t REG_DWORD /v Start /d {value} /f & " +
$"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\SharedRealitySvc /t REG_DWORD /v Start /d {value} /f & " +
@@ -308,7 +308,7 @@ namespace GTweak.Utilities.Tweaks
{
backgroundWorker.DoWork += delegate
{
- TrustedInstaller.CreateProcessAsTrustedInstaller(Settings.PID, $"cmd.exe /c {(isChoose ? "rename " + PathsWinUUP("Worker") + " " + ProgramsUUP["Re_Worker"] : "rename " + PathsWinUUP("Re_Worker") + " " + ProgramsUUP["Worker"])} & " +
+ TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, $"cmd.exe /c {(isChoose ? "rename " + PathsWinUUP("Worker") + " " + ProgramsUUP["Re_Worker"] : "rename " + PathsWinUUP("Re_Worker") + " " + ProgramsUUP["Worker"])} & " +
$"{(isChoose ? "rename " + PathsWinUUP("Core") + " " + ProgramsUUP["Re_Core"] : "rename " + PathsWinUUP("Re_Core") + " " + ProgramsUUP["Core"])} & " +
$"{(isChoose ? "rename " + PathsWinUUP("Agent") + " " + ProgramsUUP["Re_Agent"] : "rename " + PathsWinUUP("Re_Agent") + " " + ProgramsUUP["Agent"])} & " +
$"{(isChoose ? "rename " + PathsWinUUP("Uso") + " " + ProgramsUUP["Re_Uso"] : "rename " + PathsWinUUP("Re_Uso") + " " + ProgramsUUP["Uso"])} & " +
diff --git a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
index 82a20649..32175f65 100644
--- a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
+++ b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
@@ -15,6 +15,7 @@ namespace GTweak.Utilities.Tweaks
internal static bool IsOneDriveInstalled => File.Exists(Environment.ExpandEnvironmentVariables(@"%userprofile%\AppData\Local\Microsoft\OneDrive\OneDrive.exe"));
private static bool isLocalAccount = false;
+ #region Lists packages
internal static Dictionary<string, bool> IsAppUnavailable = new Dictionary<string, bool>
{
["MicrosoftStore"] = false,
@@ -114,6 +115,7 @@ namespace GTweak.Utilities.Tweaks
["Video"] = "zunevideo",
["Widgets"] = "Windows.Client.WebExperience"
};
+ #endregion
internal void ViewInstalledPackages()
{
@@ -197,8 +199,6 @@ namespace GTweak.Utilities.Tweaks
internal static void DeletedOneDrive()
{
-
-
using (Process process = new Process())
{
process.StartInfo.UseShellExecute = false;
diff --git a/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs b/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs
index 3f453a9c..5477e197 100644
--- a/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs
+++ b/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs
@@ -13,7 +13,7 @@ namespace GTweak.Utilities.Tweaks
{
internal void Enable()
{
- TrustedInstaller.CreateProcessAsTrustedInstaller(Settings.PID, "cmd.exe /c reg delete HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\AppHost /v EnableWebContentEvaluation /f & " +
+ TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, "cmd.exe /c reg delete HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\AppHost /v EnableWebContentEvaluation /f & " +
"reg delete HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer /v SmartScreenEnabled /f & " +
"reg delete HKLM\\SOFTWARE\\Policies\\Microsoft\\MicrosoftEdge\\PhishingFilter /v EnabledV9 /f & " +
"reg delete HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System /v EnableSmartScreen /f & " +
@@ -267,7 +267,7 @@ namespace GTweak.Utilities.Tweaks
await Task.Delay(1000);
- TrustedInstaller.CreateProcessAsTrustedInstaller(Settings.PID, "cmd.exe /c taskkill /f /im MsMpEng.exe & reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\AppHost /t REG_DWORD /v EnableWebContentEvaluation /d 0 /f & " +
+ TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, "cmd.exe /c taskkill /f /im MsMpEng.exe & reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\AppHost /t REG_DWORD /v EnableWebContentEvaluation /d 0 /f & " +
"reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer /t REG_SZ /v SmartScreenEnabled /d \"off\" /f & " +
"reg add HKLM\\SOFTWARE\\Policies\\Microsoft\\MicrosoftEdge\\PhishingFilter /t REG_DWORD /v EnabledV9 /d 0 /f & " +
"reg add HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System /t REG_DWORD /v EnableSmartScreen /d 0 /f & " +
diff --git a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
index 7c42275a..695aa074 100644
--- a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
+++ b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
@@ -1,6 +1,7 @@
using GTweak.Utilities.Configuration;
using GTweak.Utilities.Control;
using GTweak.Windows;
+using System.Collections.Generic;
using System.Diagnostics;
using System.Management;
using System.Text.RegularExpressions;
@@ -12,6 +13,22 @@ namespace GTweak.Utilities.Tweaks
internal sealed class WindowsLicense
{
internal static bool IsWindowsActivated = false;
+
+ private static readonly Dictionary<(string pattern, byte words), string> windowsKeys = new Dictionary<(string pattern, byte words), string>
+ {
+ { ("Home|Single|Language", 3), @"7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH" },
+ { ("Home", 1), @"TX9XD-98N7V-6WMQ6-BX7FG-H8Q99" },
+ { ("Education", 1), @"NW6C2-QMPVW-D7KKK-3GKT6-VCFB2" },
+ { ("Enterprise|LSTB", 2), @"7YMNV-PG77F-K66KT-KG9VQ-TCQGB" },
+ { ("Enterprise|N|LTSC", 3), @"92NFX-8DJQP-P6BBQ-THF9C-7CG2H" },
+ { ("Enterprise|N", 2), @"DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4" },
+ { ("Enterprise|G", 2), @"YYVX9-NTFWV-6MDM3-9PT4T-4M68B" },
+ { ("Enterprise", 1), @"ND4DX-39KJY-FYWQ9-X6XKT-VCFCF" },
+ { ("Core|Single|Language", 3), @"BT79Q-G7N6G-PGBYW-4YWX6-6F4BT" },
+ { ("Core", 1), @"KTNPV-KTRK4-3RRR8-39X6W-W44T3" },
+ { ("Pro", 1), @"W269N-WFGWX-YVC9B-4J6C9-T83GX" }
+ };
+
private static bool IsVersionWindows(string pattern, byte words) => new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled).Matches(SystemDiagnostics.WindowsClientVersion).Count == words;
internal void LicenseStatus()
@@ -27,72 +44,49 @@ namespace GTweak.Utilities.Tweaks
{
WaitingWindow waitingWindow = new WaitingWindow();
- string keyWindow = string.Empty, kmsArguments = @"/c slmgr.vbs //b /skms kms.xspace.in";
-
- if (IsVersionWindows("Home|Single|Language", 3))
- keyWindow = @"7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH";
- else if (IsVersionWindows("Home", 1))
- keyWindow = @"TX9XD-98N7V-6WMQ6-BX7FG-H8Q99";
- else if (IsVersionWindows("Education", 1))
- keyWindow = @"NW6C2-QMPVW-D7KKK-3GKT6-VCFB2";
- else if (IsVersionWindows("Enterprise|LSTB", 2))
- keyWindow = @"7YMNV-PG77F-K66KT-KG9VQ-TCQGB";
- else if (IsVersionWindows("Enterprise|N|LTSC", 3))
- keyWindow = @"92NFX-8DJQP-P6BBQ-THF9C-7CG2H";
- else if (IsVersionWindows("Enterprise|N", 2))
- keyWindow = @"DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4";
- else if (IsVersionWindows("Enterprise|G", 2))
- keyWindow = @"YYVX9-NTFWV-6MDM3-9PT4T-4M68B";
- else if (IsVersionWindows("Enterprise", 1))
- keyWindow = @"ND4DX-39KJY-FYWQ9-X6XKT-VCFCF";
- else if (IsVersionWindows("Core|Single|Language", 3))
- keyWindow = @"BT79Q-G7N6G-PGBYW-4YWX6-6F4BT";
- else if (IsVersionWindows("Core", 1))
- keyWindow = @"KTNPV-KTRK4-3RRR8-39X6W-W44T3";
- else if (IsVersionWindows("Pro", 1))
+ string keyWindow = string.Empty, kmsArguments = string.Empty;
+
+ foreach (var key in windowsKeys)
{
- keyWindow = @"W269N-WFGWX-YVC9B-4J6C9-T83GX";
- kmsArguments = @"/c slmgr.vbs //b /skms kms.digiboy.ir";
+ if (IsVersionWindows(key.Key.pattern, key.Key.words))
+ {
+ keyWindow = key.Value;
+ kmsArguments = key.Key.pattern == "Pro" ? @"/c slmgr.vbs //b /skms kms.digiboy.ir" : @"/c slmgr.vbs //b /skms kms.xspace.in";
+ break;
+ }
}
Process cmdProcess = new Process()
{
- StartInfo = {
- FileName = "cmd.exe",
- CreateNoWindow = true,
- WindowStyle = ProcessWindowStyle.Hidden
- },
+ StartInfo = new ProcessStartInfo
+ {
+ FileName = "cmd.exe",
+ CreateNoWindow = true,
+ WindowStyle = ProcessWindowStyle.Hidden
+ }
};
+ async Task RunCommand(string arguments, int delay)
+ {
+ cmdProcess.StartInfo.Arguments = arguments;
+ cmdProcess.Start();
+ await Task.Delay(delay);
+ }
+
using (cmdProcess)
{
waitingWindow.Show();
if (SystemDiagnostics.WindowsClientVersion.Contains("10"))
- {
- cmdProcess.StartInfo.Arguments = $"/c assoc .vbs=VBSFile";
- cmdProcess.Start();
- await Task.Delay(200);
- }
-
- cmdProcess.StartInfo.Arguments = $"/c slmgr.vbs //b /ipk {keyWindow}";
- cmdProcess.Start();
-
- await Task.Delay(4000);
-
- cmdProcess.StartInfo.Arguments = kmsArguments;
- cmdProcess.Start();
-
- await Task.Delay(7000);
-
- cmdProcess.StartInfo.Arguments = "/c slmgr.vbs //b /ato";
- cmdProcess.Start();
+ await RunCommand("/c assoc .vbs=VBSFile", 500);
- await Task.Delay(3500);
+ await RunCommand($"/c slmgr.vbs //b /ipk {keyWindow}", 4000);
+ await RunCommand(kmsArguments, 7000);
+ await RunCommand("/c slmgr.vbs //b /ato", 3500);
new WindowsLicense().LicenseStatus();
- await Task.Delay(1500);
+ await Task.Delay(2000);
waitingWindow.Close();
diff --git a/.Source/GTweak/View/DataSystemView.xaml.cs b/.Source/GTweak/View/DataSystemView.xaml.cs
index 3ce36804..879d4955 100644
--- a/.Source/GTweak/View/DataSystemView.xaml.cs
+++ b/.Source/GTweak/View/DataSystemView.xaml.cs
@@ -3,6 +3,7 @@ using GTweak.Utilities.Configuration;
using GTweak.Utilities.Control;
using GTweak.Utilities.Helpers;
using System;
+using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@@ -26,19 +27,16 @@ namespace GTweak.View
App.LanguageChanged += delegate
{
- switch (SystemDiagnostics.CurrentConnection)
+ if (new Dictionary<SystemDiagnostics.ConnectionStatus, string>
{
- case SystemDiagnostics.ConnectionStatus.Lose:
- SystemDiagnostics.СonfigurationData["UserIpAddress"] = (string)FindResource("connection_lose_systemInformation");
- break;
- case SystemDiagnostics.ConnectionStatus.Block:
- SystemDiagnostics.СonfigurationData["UserIpAddress"] = (string)FindResource("connection_block_systemInformation");
- break;
- case SystemDiagnostics.ConnectionStatus.Limited:
- SystemDiagnostics.СonfigurationData["UserIpAddress"] = (string)FindResource("limited_systemInformation");
- break;
+ { SystemDiagnostics.ConnectionStatus.Lose, "connection_lose_systemInformation" },
+ { SystemDiagnostics.ConnectionStatus.Block, "connection_block_systemInformation" },
+ { SystemDiagnostics.ConnectionStatus.Limited, "limited_systemInformation" }
+ }.TryGetValue(SystemDiagnostics.CurrentConnection, out string resourceKey))
+ {
+ SystemDiagnostics.СonfigurationData["UserIpAddress"] = (string)FindResource(resourceKey);
+ DataContext = new DataSystemVM();
}
- DataContext = new DataSystemVM();
};
timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, async delegate
@@ -55,7 +53,7 @@ namespace GTweak.View
if (BtnHiddenIP.IsChecked.Value & BtnHiddenIP.Visibility == Visibility.Hidden)
{
DoubleAnimation doubleAnim = new DoubleAnimation(0, (Duration)TimeSpan.FromSeconds(0.18));
- doubleAnim.Completed += delegate { Parallel.Invoke(() => { Settings.ChangingParameters(false, "HiddenIP"); }); };
+ doubleAnim.Completed += delegate { SettingsRepository.ChangingParameters(false, "HiddenIP"); };
Timeline.SetDesiredFrameRate(doubleAnim, 400);
IpAddress.Effect.BeginAnimation(BlurEffect.RadiusProperty, doubleAnim);
}
@@ -138,7 +136,7 @@ namespace GTweak.View
private void BtnHiddenIP_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
- Settings.ChangingParameters(!BtnHiddenIP.IsChecked.Value, "HiddenIP");
+ SettingsRepository.ChangingParameters(!BtnHiddenIP.IsChecked.Value, "HiddenIP");
DoubleAnimation doubleAnim = new DoubleAnimation()
{
diff --git a/.Source/GTweak/View/PakagesView.xaml.cs b/.Source/GTweak/View/PakagesView.xaml.cs
index 32f093d9..c70aefae 100644
--- a/.Source/GTweak/View/PakagesView.xaml.cs
+++ b/.Source/GTweak/View/PakagesView.xaml.cs
@@ -96,7 +96,7 @@ namespace GTweak.View
private void Page_Loaded(object sender, RoutedEventArgs e)
{
- Parallel.Invoke(UpdateViewStatePakages);
+ UpdateViewStatePakages();
new TypewriterAnimation((string)FindResource("defaultDescriptionApp"), TextDescription, TimeSpan.FromMilliseconds(300));
}
diff --git a/.Source/GTweak/Windows/LoadingWindow.xaml.cs b/.Source/GTweak/Windows/LoadingWindow.xaml.cs
index ae74ac1d..b2e8752f 100644
--- a/.Source/GTweak/Windows/LoadingWindow.xaml.cs
+++ b/.Source/GTweak/Windows/LoadingWindow.xaml.cs
@@ -48,11 +48,11 @@ namespace GTweak.Windows
}
Parallel.Invoke(
- delegate { Settings.PID = TrustedInstaller.StartTrustedInstallerService(); },
- new Settings().СheckingParameters,
+ delegate { SettingsRepository.PID = TrustedInstaller.StartTrustedInstallerService(); },
+ new SettingsRepository().СheckingParameters,
new WindowsLicense().LicenseStatus,
new SystemDiagnostics().GetHardwareData,
- new SearchUpdates().StartСhecking,
+ new QueryUpdates().RunSearch,
new UninstallingPakages().ViewInstalledPackages,
new UninstallingPakages().CheckingForLocalAccount,
new SystemTweaks().ViewNetshState,
diff --git a/.Source/GTweak/Windows/MainWindow.xaml.cs b/.Source/GTweak/Windows/MainWindow.xaml.cs
index c21a8f1b..33488820 100644
--- a/.Source/GTweak/Windows/MainWindow.xaml.cs
+++ b/.Source/GTweak/Windows/MainWindow.xaml.cs
@@ -19,13 +19,13 @@ namespace GTweak
{
InitializeComponent();
- BtnNotification.StateNA = Settings.IsViewNotification;
- BtnUpdate.StateNA = Settings.IsСheckingUpdate;
- BtnTopMost.StateNA = Topmost = Settings.IsTopMost;
- BtnSoundNtn.IsChecked = Settings.IsPlayingSound;
- SliderVolume.Value = (ushort)(Settings.currentVolume & 0x0000ffff) / (ushort.MaxValue / 100);
- LanguageSelectionMenu.SelectedIndex = Settings.Language == "en" ? 0 : 1;
- ThemeSelectionMenu.SelectedIndex = Settings.Theme switch
+ BtnNotification.StateNA = SettingsRepository.IsViewNotification;
+ BtnUpdate.StateNA = SettingsRepository.IsСheckingUpdate;
+ BtnTopMost.StateNA = Topmost = SettingsRepository.IsTopMost;
+ BtnSoundNtn.IsChecked = SettingsRepository.IsPlayingSound;
+ SliderVolume.Value = (ushort)(SettingsRepository.currentVolume & 0x0000ffff) / (ushort.MaxValue / 100);
+ LanguageSelectionMenu.SelectedIndex = SettingsRepository.Language == "en" ? 0 : 1;
+ ThemeSelectionMenu.SelectedIndex = SettingsRepository.Theme switch
{
"Dark" => 0,
"Light" => 1,
@@ -127,7 +127,7 @@ namespace GTweak
};
doubleAnim.Completed += async delegate
{
- if (SearchUpdates.IsNeedUpdate && Settings.IsСheckingUpdate)
+ if (QueryUpdates.IsNeedUpdate && SettingsRepository.IsСheckingUpdate)
{
await Task.Delay(500);
new UpdateWindow().ShowDialog();
@@ -140,25 +140,25 @@ namespace GTweak
#endregion
#region Settings Menu
- private void BtnNotification_ChangedState(object sender, EventArgs e) => Settings.ChangingParameters(!BtnNotification.State, "Notification");
+ private void BtnNotification_ChangedState(object sender, EventArgs e) => SettingsRepository.ChangingParameters(!BtnNotification.State, "Notification");
- private void BtnUpdate_ChangedState(object sender, EventArgs e) => Settings.ChangingParameters(!BtnUpdate.State, "Update");
+ private void BtnUpdate_ChangedState(object sender, EventArgs e) => SettingsRepository.ChangingParameters(!BtnUpdate.State, "Update");
private void BtnTopMost_ChangedState(object sender, EventArgs e)
{
- Settings.ChangingParameters(!BtnTopMost.State, "TopMost");
+ SettingsRepository.ChangingParameters(!BtnTopMost.State, "TopMost");
Topmost = !BtnTopMost.State;
}
private void SliderVolume_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
SliderVolume.Value = SliderVolume.Value == 0 ? 1 : SliderVolume.Value;
- Settings.WinmmMethods.waveOutSetVolume(IntPtr.Zero, ((uint)(double)((ushort.MaxValue / 100) * SliderVolume.Value) & 0x0000ffff) | ((uint)(double)((ushort.MaxValue / 100) * SliderVolume.Value) << 16));
+ SettingsRepository.WinmmMethods.waveOutSetVolume(IntPtr.Zero, ((uint)(double)((ushort.MaxValue / 100) * SliderVolume.Value) & 0x0000ffff) | ((uint)(double)((ushort.MaxValue / 100) * SliderVolume.Value) << 16));
}
private void BtnSoundNtn_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
- Settings.ChangingParameters(!BtnSoundNtn.IsChecked, "Sound");
+ SettingsRepository.ChangingParameters(!BtnSoundNtn.IsChecked, "Sound");
}
private void LanguageSelectionMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -166,11 +166,11 @@ namespace GTweak
switch (LanguageSelectionMenu.SelectedIndex)
{
case 0:
- Settings.ChangingParameters("en", "Language");
+ SettingsRepository.ChangingParameters("en", "Language");
App.Language = "en";
break;
default:
- Settings.ChangingParameters("ru", "Language");
+ SettingsRepository.ChangingParameters("ru", "Language");
App.Language = "ru";
break;
}
@@ -181,25 +181,25 @@ namespace GTweak
switch (ThemeSelectionMenu.SelectedIndex)
{
case 0:
- Settings.ChangingParameters("Dark", "Theme");
+ SettingsRepository.ChangingParameters("Dark", "Theme");
App.Theme = "Dark";
break;
case 1:
- Settings.ChangingParameters("Light", "Theme");
+ SettingsRepository.ChangingParameters("Light", "Theme");
App.Theme = "Light";
break;
default:
- Settings.ChangingParameters("System", "Theme");
+ SettingsRepository.ChangingParameters("System", "Theme");
App.Theme = "System";
break;
}
}
- private void BtnExport_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => Parallel.Invoke(Settings.SaveFileConfig);
+ private void BtnExport_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => Parallel.Invoke(SettingsRepository.SaveFileConfig);
- private void BtnImport_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => Parallel.Invoke(Settings.OpenFileConfig);
+ private void BtnImport_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => Parallel.Invoke(SettingsRepository.OpenFileConfig);
- private void BtnDelete_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => Settings.SelfRemoval();
+ private void BtnDelete_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => SettingsRepository.SelfRemoval();
private void BtnContats_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
diff --git a/.Source/GTweak/Windows/NotificationWindow.xaml.cs b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
index cbac5d45..b958f2ec 100644
--- a/.Source/GTweak/Windows/NotificationWindow.xaml.cs
+++ b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
@@ -62,7 +62,7 @@ namespace GTweak.Windows
private void Window_Loaded(object sender, RoutedEventArgs e)
{
- if (Settings.IsPlayingSound)
+ if (SettingsRepository.IsPlayingSound)
{
using SoundPlayer notificationSound = new SoundPlayer(Properties.Resources.Sound);
notificationSound.Play();
diff --git a/.Source/GTweak/Windows/RebootWindow.xaml.cs b/.Source/GTweak/Windows/RebootWindow.xaml.cs
index 156af7e8..f72da319 100644
--- a/.Source/GTweak/Windows/RebootWindow.xaml.cs
+++ b/.Source/GTweak/Windows/RebootWindow.xaml.cs
@@ -23,7 +23,7 @@ namespace GTweak.Windows
Duration = TimeSpan.FromSeconds(1.5)
};
Timeline.SetDesiredFrameRate(doubleAnim, 400);
- doubleAnim.Completed += delegate { Settings.SelfReboot(); };
+ doubleAnim.Completed += delegate { SettingsRepository.SelfReboot(); };
RestartProgress.BeginAnimation(ProgressBar.ValueProperty, doubleAnim);
}
}
diff --git a/.Source/GTweak/Windows/UpdateWindow.xaml.cs b/.Source/GTweak/Windows/UpdateWindow.xaml.cs
index f83bafa2..7bd48548 100644
--- a/.Source/GTweak/Windows/UpdateWindow.xaml.cs
+++ b/.Source/GTweak/Windows/UpdateWindow.xaml.cs
@@ -14,8 +14,8 @@ namespace GTweak.Windows
public UpdateWindow()
{
InitializeComponent();
- CurrentVerison.Text = Settings.currentRelease;
- DownloadVersion.Text = NewVerison.Text = SearchUpdates.DownloadVersion;
+ CurrentVerison.Text = SettingsRepository.currentRelease;
+ DownloadVersion.Text = NewVerison.Text = QueryUpdates.DownloadVersion;
}
private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e)
@@ -77,7 +77,7 @@ namespace GTweak.Windows
{
Process.Start(new ProcessStartInfo()
{
- Arguments = $"/c taskkill /f /im \"{Settings.currentName}\" && timeout /t 1 && del \"{Settings.currentLocation}\" && ren Git-GTweak.exe \"{Settings.currentName}\" && \"{Settings.currentLocation}\"",
+ Arguments = $"/c taskkill /f /im \"{SettingsRepository.currentName}\" && timeout /t 1 && del \"{SettingsRepository.currentLocation}\" && ren Git-GTweak.exe \"{SettingsRepository.currentName}\" && \"{SettingsRepository.currentLocation}\"",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "cmd.exe"