Skip to content

Portable Tool for an Ideal Windows Setup

-add noty (no found key) & restart exp for packages

Greedeks1e454766b330
diff --git a/.Source/GTweak/Languages/en/Localize.xaml b/.Source/GTweak/Languages/en/Localize.xaml
index e63488e4..1deaa8ed 100644
--- a/.Source/GTweak/Languages/en/Localize.xaml
+++ b/.Source/GTweak/Languages/en/Localize.xaml
@@ -65,6 +65,7 @@
<v:String x:Key="error_defrag_notification">Something went wrong, defragmentation could not be disabled.</v:String>
<v:String x:Key="success_defrag_notification">Defragmentation has been successfully disabled for your drive</v:String>
<v:String x:Key="networklicense_notification">An internet connection is required for activation</v:String>
+ <v:String x:Key="keynotfound_notification">The key for your Windows edition is missing; activation canceled</v:String>
<!--#endregion-->
<!--#region Main Window -->
diff --git a/.Source/GTweak/Languages/ko/Localize.xaml b/.Source/GTweak/Languages/ko/Localize.xaml
index 520987c0..b5021048 100644
--- a/.Source/GTweak/Languages/ko/Localize.xaml
+++ b/.Source/GTweak/Languages/ko/Localize.xaml
@@ -65,6 +65,7 @@
<v:String x:Key="error_defrag_notification">문제가 발생하여 조각 모음을 비활성화할 수 없습니다.</v:String>
<v:String x:Key="success_defrag_notification">드라이브에 대해 조각 모음이 성공적으로 비활성화되었습니다</v:String>
<v:String x:Key="networklicense_notification">An internet connection is required for activation</v:String>
+ <v:String x:Key="keynotfound_notification">The key for your Windows edition is missing; activation canceled</v:String>
<!--#endregion-->
<!--#region Main Window -->
diff --git a/.Source/GTweak/Languages/ru/Localize.xaml b/.Source/GTweak/Languages/ru/Localize.xaml
index f287dd6f..e8aeed39 100644
--- a/.Source/GTweak/Languages/ru/Localize.xaml
+++ b/.Source/GTweak/Languages/ru/Localize.xaml
@@ -65,6 +65,7 @@
<v:String x:Key="error_defrag_notification">Что то-то пошло не так, не удалось отключить дефрагментацию</v:String>
<v:String x:Key="success_defrag_notification">Дефрагментация вашего диска успешно отключена</v:String>
<v:String x:Key="networklicense_notification">Для активации требуется подключение к Интернету</v:String>
+ <v:String x:Key="keynotfound_notification">Отсутствует ключ для вашей редакции Windows, активация отменена</v:String>
<!--#endregion-->
<!--#region Main Window -->
diff --git a/.Source/GTweak/Languages/uk/Localize.xaml b/.Source/GTweak/Languages/uk/Localize.xaml
index 7175a0ee..3ac65dad 100644
--- a/.Source/GTweak/Languages/uk/Localize.xaml
+++ b/.Source/GTweak/Languages/uk/Localize.xaml
@@ -65,6 +65,7 @@
<v:String x:Key="error_defrag_notification">Щось не так, не вдалося вимкнути дефрагментацію</v:String>
<v:String x:Key="success_defrag_notification">Дефрагментацію ваших дисків успішно вимкнено</v:String>
<v:String x:Key="networklicense_notification">Для активації потрібне підключення до Інтернету</v:String>
+ <v:String x:Key="keynotfound_notification">Ключ для вашої редакції Windows відсутній, активація скасована</v:String>
<!--#endregion-->
<!--#region Main Window -->
diff --git a/.Source/GTweak/Utilities/Helpers/ExplorerManager.cs b/.Source/GTweak/Utilities/Helpers/ExplorerManager.cs
index 8c615fae..463bec77 100644
--- a/.Source/GTweak/Utilities/Helpers/ExplorerManager.cs
+++ b/.Source/GTweak/Utilities/Helpers/ExplorerManager.cs
@@ -48,5 +48,11 @@ namespace GTweak.Utilities.Helpers
new { Button = "TglButton30", NeedRestart = true },
new { Button = "TglButton32", NeedRestart = true },
}.ToDictionary(x => x.Button, x => x.NeedRestart);
+
+ internal static readonly Dictionary<string, bool> GetAppsStorage = new[]
+{
+ new { Package = "Widgets", NeedRestart = true },
+ new { Package = "Edge", NeedRestart = true }
+ }.ToDictionary(x => x.Package, x => x.NeedRestart);
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
index 2d31f5b5..cf7bab3d 100644
--- a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
+++ b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
@@ -241,7 +241,8 @@ namespace GTweak.Utilities.Tweaks
DeletingTask(edgeTasks);
TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, @"cmd.exe /с rmdir /s /q %LocalAppData%\Microsoft\Edge");
- TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, $@"cmd.exe /c for /r ""%AppData%\Microsoft\Internet Explorer\Quick Launch"" %f in (*Edge*) do del ""%f""");
+ TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, @"cmd.exe /c for /r ""%AppData%\Microsoft\Internet Explorer\Quick Launch"" %f in (*Edge*) do del ""%f""");
+ TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, @"cmd.exe /c del /q /f ""%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\*Edge*.lnk""");
TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, $@"cmd.exe /c for /r ""{StoragePaths.SystemDisk}ProgramData\Microsoft\Windows\Start Menu\Programs"" %f in (*Edge*) do del ""%f""");
TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, $@"cmd.exe /c for /r ""{StoragePaths.SystemDisk}Users"" %f in (*Edge*) do @if exist ""%f"" del /f /q ""%f""");
TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, $@"cmd.exe /c for /d %d in (""{StoragePaths.SystemDisk}Program Files (x86)\Microsoft\*Edge*"") do rmdir /s /q ""%d""");
diff --git a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
index 6af7a92f..b34ad7d0 100644
--- a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
+++ b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
@@ -32,9 +32,16 @@ namespace GTweak.Utilities.Tweaks
internal static async void StartActivation()
{
- WaitingWindow waitingWindow = new WaitingWindow();
+ string keyWinHWID = keysHWID.FirstOrDefault(k => IsVersionWindows(k.Key.pattern, k.Key.words)).Value ?? string.Empty;
+ string keyWinKMS = keysKMS.FirstOrDefault(k => IsVersionWindows(k.Key.pattern, k.Key.words)).Value ?? string.Empty;
+
+ if (string.IsNullOrEmpty(keyWinHWID) && string.IsNullOrEmpty(keyWinKMS))
+ {
+ new ViewNotification(300).Show("", "warn", "keynotfound_notification");
+ return;
+ }
- string keyWindow = keysHWID.FirstOrDefault(k => IsVersionWindows(k.Key.pattern, k.Key.words)).Value ?? string.Empty;
+ new ViewNotification().Show("", "warn", "activatewin_notification");
Process cmdProcess = new Process()
{
@@ -53,6 +60,8 @@ namespace GTweak.Utilities.Tweaks
await Task.Delay(delay);
}
+ WaitingWindow waitingWindow = new WaitingWindow();
+
using (cmdProcess)
{
waitingWindow.Show();
@@ -60,7 +69,7 @@ namespace GTweak.Utilities.Tweaks
if (SystemDiagnostics.IsWindowsVersion[10])
await RunCommand("/c assoc .vbs=VBSFile", 500);
- await RunCommand($"/c slmgr.vbs //b /ipk {keyWindow}", 4000);
+ await RunCommand($"/c slmgr.vbs //b /ipk {keyWinHWID}", 4000);
CommandExecutor.RunCommand($@"/c del /f /q {StoragePaths.SystemDisk}ProgramData\Microsoft\Windows\ClipSVC\GenuineTicket\*.xml & del /f /q {StoragePaths.SystemDisk}ProgramData\Microsoft\Windows\ClipSVC\Install\Migration\*.xml");
string originalGeo = RegistryHelp.GetValue(@"HKEY_CURRENT_USER\Control Panel\International\Geo", "Name", string.Empty);
@@ -97,11 +106,9 @@ namespace GTweak.Utilities.Tweaks
}
else
{
- keyWindow = keysKMS.FirstOrDefault(k => IsVersionWindows(k.Key.pattern, k.Key.words)).Value ?? string.Empty;
-
using (cmdProcess)
{
- await RunCommand($"/c slmgr.vbs //b /ipk {keyWindow}", 4000);
+ await RunCommand($"/c slmgr.vbs //b /ipk {keysKMS}", 4000);
await RunCommand("/c slmgr.vbs //b /skms kms.digiboy.ir", 7000);
await RunCommand("/c slmgr.vbs //b /ato", 3500);
@@ -111,10 +118,7 @@ namespace GTweak.Utilities.Tweaks
waitingWindow.Close();
- if (IsWindowsActivated)
- new ViewNotification(300).Show("restart", "warn", "successactivate_notification");
- else
- new ViewNotification(300).Show("", "warn", "notsuccessactivate_notification");
+ new ViewNotification(300).Show(IsWindowsActivated ? "restart" : "", "warn", IsWindowsActivated ? "successactivate_notification" : "notsuccessactivate_notification");
}
}
}
diff --git a/.Source/GTweak/View/MoreView.xaml.cs b/.Source/GTweak/View/MoreView.xaml.cs
index 2a325826..4b2c2c3c 100644
--- a/.Source/GTweak/View/MoreView.xaml.cs
+++ b/.Source/GTweak/View/MoreView.xaml.cs
@@ -23,10 +23,7 @@ namespace GTweak.View
else
{
if (SystemDiagnostics.CurrentConnection == SystemDiagnostics.ConnectionStatus.Available || SystemDiagnostics.CurrentConnection == SystemDiagnostics.ConnectionStatus.Block)
- {
- new ViewNotification().Show("", "warn", "activatewin_notification");
WindowsLicense.StartActivation();
- }
else
new ViewNotification().Show("", "warn", "networklicense_notification");
}
diff --git a/.Source/GTweak/View/PakagesView.xaml.cs b/.Source/GTweak/View/PakagesView.xaml.cs
index a2ad3723..0e1b9848 100644
--- a/.Source/GTweak/View/PakagesView.xaml.cs
+++ b/.Source/GTweak/View/PakagesView.xaml.cs
@@ -86,6 +86,9 @@ namespace GTweak.View
{
UninstallingPakages.HandleAvailabilityStatus(packageName, false);
UpdateViewStatePakages();
+
+ if (ExplorerManager.GetAppsStorage.TryGetValue(packageName, out bool needRestart))
+ ExplorerManager.Restart(new Process());
});
}
catch (Exception ex) { Debug.WriteLine(ex.Message); }