Skip to content

Portable Tool for an Ideal Windows Setup

-changed selecting a version windows

Greedeks2ebb0daa7019
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemData.cs b/.Source/GTweak/Utilities/Tweaks/SystemData.cs
index 30b4ca07..c4b32768 100644
--- a/.Source/GTweak/Utilities/Tweaks/SystemData.cs
+++ b/.Source/GTweak/Utilities/Tweaks/SystemData.cs
@@ -1,4 +1,6 @@
-using System;
+using Microsoft.Win32;
+using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
@@ -6,14 +8,11 @@ using System.Management;
using System.Net;
using System.Net.Http;
using System.Runtime.InteropServices;
-using System.Security.Policy;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
-using Microsoft.Win32;
-using Newtonsoft.Json;
namespace GTweak.Utilities.Tweaks
{
@@ -255,7 +254,7 @@ namespace GTweak.Utilities.Tweaks
internal static void GetUserIP()
{
- Parallel.Invoke(() =>
+ Parallel.Invoke(delegate
{
if (IsCheckInternetConnection())
{
diff --git a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
index 7dd0239f..05b3fee3 100644
--- a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
+++ b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
@@ -1,6 +1,7 @@
using GTweak.Windows;
using System.Diagnostics;
using System.Management;
+using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
@@ -9,6 +10,7 @@ namespace GTweak.Utilities.Tweaks
internal sealed class WindowsLicense
{
internal static uint statusLicense = 0;
+ private static bool IsVersionWindows(string pattern, byte words) => new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled).Matches(SystemData.СomputerСonfiguration.clientWinVersion).Count == words;
internal void LicenseStatus()
{
@@ -24,29 +26,27 @@ namespace GTweak.Utilities.Tweaks
string keyWindow = string.Empty, kmsArguments = @"/c slmgr.vbs //b /skms kms.xspace.in";
- if (SystemData.СomputerСonfiguration.clientWinVersion.Contains("Home") & SystemData.СomputerСonfiguration.clientWinVersion.Contains("Single") &
- SystemData.СomputerСonfiguration.clientWinVersion.Contains("Language"))
+ if (IsVersionWindows("Home|Single|Language", 3))
keyWindow = @"7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH";
- else if (SystemData.СomputerСonfiguration.clientWinVersion.Contains("Home"))
+ else if (IsVersionWindows("Home", 1))
keyWindow = @"TX9XD-98N7V-6WMQ6-BX7FG-H8Q99";
- else if (SystemData.СomputerСonfiguration.clientWinVersion.Contains("Education"))
+ else if (IsVersionWindows("Education", 1))
keyWindow = @"NW6C2-QMPVW-D7KKK-3GKT6-VCFB2";
- else if (SystemData.СomputerСonfiguration.clientWinVersion.Contains("Enterprise") & SystemData.СomputerСonfiguration.clientWinVersion.Contains("LSTB"))
+ else if (IsVersionWindows("Enterprise|LSTB", 2))
keyWindow = @"7YMNV-PG77F-K66KT-KG9VQ-TCQGB";
- else if (SystemData.СomputerСonfiguration.clientWinVersion.Contains("Enterprise") & SystemData.СomputerСonfiguration.clientWinVersion.Contains("N LTSC"))
+ else if (IsVersionWindows("Enterprise|N|LTSC", 3))
keyWindow = @"92NFX-8DJQP-P6BBQ-THF9C-7CG2H";
- else if (SystemData.СomputerСonfiguration.clientWinVersion.Contains("Enterprise") & SystemData.СomputerСonfiguration.clientWinVersion.Contains("N"))
+ else if (IsVersionWindows("Enterprise|N", 2))
keyWindow = @"DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4";
- else if (SystemData.СomputerСonfiguration.clientWinVersion.Contains("Enterprise") & SystemData.СomputerСonfiguration.clientWinVersion.Contains("G"))
+ else if (IsVersionWindows("Enterprise|G", 2))
keyWindow = @"YYVX9-NTFWV-6MDM3-9PT4T-4M68B";
- else if (SystemData.СomputerСonfiguration.clientWinVersion.Contains("Enterprise"))
+ else if (IsVersionWindows("Enterprise", 1))
keyWindow = @"ND4DX-39KJY-FYWQ9-X6XKT-VCFCF";
- else if (SystemData.СomputerСonfiguration.clientWinVersion.Contains("Core") & SystemData.СomputerСonfiguration.clientWinVersion.Contains("Single") &
- SystemData.СomputerСonfiguration.clientWinVersion.Contains("Language"))
+ else if (IsVersionWindows("Core|Single|Language", 3))
keyWindow = @"BT79Q-G7N6G-PGBYW-4YWX6-6F4BT";
- else if (SystemData.СomputerСonfiguration.clientWinVersion.Contains("Core"))
+ else if (IsVersionWindows("Core", 1))
keyWindow = @"KTNPV-KTRK4-3RRR8-39X6W-W44T3";
- else if (SystemData.СomputerСonfiguration.clientWinVersion.Contains("Pro"))
+ else if (IsVersionWindows("Pro", 1))
{
keyWindow = @"W269N-WFGWX-YVC9B-4J6C9-T83GX";
kmsArguments = @"/c slmgr.vbs //b /skms kms.digiboy.ir";
@@ -69,6 +69,7 @@ namespace GTweak.Utilities.Tweaks
{
cmdProcess.StartInfo.Arguments = $"/c assoc .vbs=VBSFile";
cmdProcess.Start();
+ await Task.Delay(200);
}
cmdProcess.StartInfo.Arguments = $"/c slmgr.vbs //b /ipk {keyWindow}";