Skip to content

Portable Tool for an Ideal Windows Setup

v5.0.2 -update files path & re

Greedeks81c1ffc8c2c6
diff --git a/.Source/GTweak/Properties/AssemblyInfo.cs b/.Source/GTweak/Properties/AssemblyInfo.cs
index b4ee81de..9fdce43e 100644
--- a/.Source/GTweak/Properties/AssemblyInfo.cs
+++ b/.Source/GTweak/Properties/AssemblyInfo.cs
@@ -7,9 +7,9 @@ using System.Windows;
[assembly: AssemblyProduct("GTweak")]
[assembly: AssemblyCopyright("Copyright � Greedeks 2024")]
[assembly: AssemblyTrademark("Greedeks")]
-[assembly: AssemblyInformationalVersion("Build: 5.0.1")]
-[assembly: AssemblyVersion("5.0.28.636")]
-[assembly: AssemblyFileVersion("5.0.28.636")]
+[assembly: AssemblyInformationalVersion("Build: 5.0.2")]
+[assembly: AssemblyVersion("5.0.43.976")]
+[assembly: AssemblyFileVersion("5.0.43.976")]
[assembly: ComVisible(false)]
diff --git a/.Source/GTweak/Properties/AssemblyInfo.tt b/.Source/GTweak/Properties/AssemblyInfo.tt
index 1e12f243..a9a54e43 100644
--- a/.Source/GTweak/Properties/AssemblyInfo.tt
+++ b/.Source/GTweak/Properties/AssemblyInfo.tt
@@ -9,7 +9,7 @@ using System.Windows;
[assembly: AssemblyProduct("GTweak")]
[assembly: AssemblyCopyright("Copyright � Greedeks 2024")]
[assembly: AssemblyTrademark("Greedeks")]
-[assembly: AssemblyInformationalVersion("Build: 5.0.1")]
+[assembly: AssemblyInformationalVersion("Build: 5.0.2")]
[assembly: AssemblyVersion("5.<#= GenerateVersion() #>")]
[assembly: AssemblyFileVersion("5.<#= GenerateVersion() #>")]
diff --git a/.Source/GTweak/Utilities/BlockRunTweaker.cs b/.Source/GTweak/Utilities/BlockRunTweaker.cs
index 391bb9a2..37aeea8a 100644
--- a/.Source/GTweak/Utilities/BlockRunTweaker.cs
+++ b/.Source/GTweak/Utilities/BlockRunTweaker.cs
@@ -22,7 +22,7 @@ namespace GTweak.Utilities
{
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\*{Settings.currentName}*",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "cmd.exe"
diff --git a/.Source/GTweak/Utilities/Settings.cs b/.Source/GTweak/Utilities/Settings.cs
index 77ff7b14..396601d8 100644
--- a/.Source/GTweak/Utilities/Settings.cs
+++ b/.Source/GTweak/Utilities/Settings.cs
@@ -6,21 +6,27 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
+using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows;
namespace GTweak.Utilities
{
- internal sealed class Settings
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct UsePath
{
- internal static string PathConfig = string.Empty;
- internal static string PathSound => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)) + @"\GTweak\Sound.mp3";
- internal static string PathIcon => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)) + @"\GTweak\GTweak.ico";
- internal static string PathTempFiles => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)) + @"\GTweak";
- internal static string PathSystemDisk => Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System));
+ internal static string Config = string.Empty;
+ internal static string FileLocation => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"GTweak");
+ internal static string Sound => Path.Combine(FileLocation + @"\resource\notify.mp3");
+ internal static string Icon => Path.Combine(FileLocation + @"\resource\GTweak.ico");
+ internal static string SystemDisk => Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System));
+ internal static string Hosts => Path.Combine(Environment.SystemDirectory, @"drivers\etc\hosts");
+ }
+ internal sealed class Settings
+ {
private static bool _isViewNotification = true;
- private static bool _isSoundNotification = true;
+ private static bool _isPlayingSound = true;
private static byte _volumeNotification = 50;
private static bool _isTopMost = false;
private static bool _isСheckingUpdate = true;
@@ -34,7 +40,7 @@ namespace GTweak.Utilities
internal static readonly string currentLocation = Assembly.GetExecutingAssembly().Location;
internal static bool IsViewNotification { get => _isViewNotification; set => _isViewNotification = value; }
- internal static bool IsSoundNotification { get => _isSoundNotification; set => _isSoundNotification = value; }
+ internal static bool IsPlayingSound { get => _isPlayingSound; set => _isPlayingSound = value; }
internal static byte VolumeNotification { get => _volumeNotification; set => _volumeNotification = value; }
internal static bool IsTopMost { get => _isTopMost; set => _isTopMost = value; }
internal static bool IsСheckingUpdate { get => _isСheckingUpdate; set => _isСheckingUpdate = value; }
@@ -44,11 +50,11 @@ namespace GTweak.Utilities
internal void CheckingTempFiles()
{
- if (!File.Exists(PathIcon))
- new UnarchiveManager(PathIcon, Properties.Resources.GTweak);
+ if (!File.Exists(UsePath.Icon))
+ new UnarchiveManager(UsePath.Icon, Properties.Resources.GTweak);
- if (!File.Exists(PathSound))
- new UnarchiveManager(PathSound, Properties.Resources.Sound);
+ if (!File.Exists(UsePath.Sound))
+ new UnarchiveManager(UsePath.Sound, Properties.Resources.Sound);
}
internal void СheckingParameters()
@@ -58,7 +64,7 @@ namespace GTweak.Utilities
registryKey.GetValue("Update", null) == null || registryKey.GetValue("Language", null) == null || registryKey.GetValue("HiddenIP", null) == null || registryKey.GetValue("Theme", null) == null)
{
registryKey?.SetValue("Notification", IsViewNotification, RegistryValueKind.String);
- registryKey?.SetValue("Sound", IsSoundNotification, RegistryValueKind.String);
+ registryKey?.SetValue("Sound", IsPlayingSound, RegistryValueKind.String);
registryKey?.SetValue("Volume", VolumeNotification, RegistryValueKind.String);
registryKey?.SetValue("TopMost", IsTopMost, RegistryValueKind.String);
registryKey?.SetValue("Update", IsСheckingUpdate, RegistryValueKind.String);
@@ -69,7 +75,7 @@ namespace GTweak.Utilities
else
{
IsViewNotification = bool.Parse(registryKey?.GetValue("Notification").ToString() ?? "True");
- IsSoundNotification = bool.Parse(registryKey?.GetValue("Sound").ToString() ?? "True");
+ IsPlayingSound = bool.Parse(registryKey?.GetValue("Sound").ToString() ?? "True");
VolumeNotification = byte.Parse(registryKey?.GetValue("Volume").ToString() ?? "50");
IsTopMost = bool.Parse(registryKey?.GetValue("TopMost").ToString() ?? "False");
IsСheckingUpdate = bool.Parse(registryKey?.GetValue("Update").ToString() ?? "True");
@@ -91,7 +97,7 @@ namespace GTweak.Utilities
IsViewNotification = bool.Parse(registryKey?.GetValue("Notification").ToString() ?? "True");
break;
case "Sound":
- IsSoundNotification = bool.Parse(registryKey?.GetValue("Sound").ToString() ?? "True");
+ IsPlayingSound = bool.Parse(registryKey?.GetValue("Sound").ToString() ?? "True");
break;
case "Volume":
VolumeNotification = byte.Parse(registryKey?.GetValue("Volume").ToString() ?? "50");
@@ -116,7 +122,6 @@ namespace GTweak.Utilities
registryKey?.Close();
});
-
internal static void SaveFileConfig()
{
if (INIManager.UserTweaksConfidentiality.Count == 0 && INIManager.UserTweaksInterface.Count == 0 && INIManager.UserTweaksServices.Count == 0 && INIManager.UserTweaksSystem.Count == 0)
@@ -136,12 +141,12 @@ namespace GTweak.Utilities
try
{
- PathConfig = Path.GetDirectoryName(saveFileDialog.FileName) + @"\" + Path.GetFileNameWithoutExtension(saveFileDialog.FileName) + ".ini";
+ UsePath.Config = Path.GetDirectoryName(saveFileDialog.FileName) + @"\" + Path.GetFileNameWithoutExtension(saveFileDialog.FileName) + ".ini";
- if (File.Exists(PathConfig))
- File.Delete(PathConfig);
+ if (File.Exists(UsePath.Config))
+ File.Delete(UsePath.Config);
- INIManager iniManager = new INIManager(PathConfig);
+ INIManager iniManager = new INIManager(UsePath.Config);
iniManager.Write("GTweak", "Author", "Greedeks");
iniManager.Write("GTweak", "Release", currentRelease);
iniManager.WriteAll("Confidentiality Tweaks", INIManager.UserTweaksConfidentiality);
@@ -164,12 +169,12 @@ namespace GTweak.Utilities
if (isResultNormal != true) return;
- PathConfig = openFileDialog.FileName;
- INIManager iniManager = new INIManager(PathConfig);
+ UsePath.Config = openFileDialog.FileName;
+ INIManager iniManager = new INIManager(UsePath.Config);
if (iniManager.GetKeysOrValue("GTweak", false).Contains("Greedeks") && iniManager.GetKeysOrValue("GTweak").Contains("Release"))
{
- if (File.ReadLines(PathConfig).Any(line => line.Contains("TglButton")) || File.ReadLines(PathConfig).Any(line => line.Contains("Slider")))
+ if (File.ReadLines(UsePath.Config).Any(line => line.Contains("TglButton")) || File.ReadLines(UsePath.Config).Any(line => line.Contains("Slider")))
new ImportWindow(openFileDialog.SafeFileName).ShowDialog();
else
new ViewNotification().Show("", (string)Application.Current.Resources["title1_notification"], (string)Application.Current.Resources["import_empty_notification"]);
@@ -188,8 +193,8 @@ namespace GTweak.Utilities
Process.Start(new ProcessStartInfo()
{
- Arguments = $"/c taskkill /f /im \"{currentName}\" & choice /c y /n /d y /t 3 & del \"" + new FileInfo(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath).Name + "\" & " +
- "rd /s /q " + PathTempFiles + " & rd /s /q " + Environment.SystemDirectory + @"\config\systemprofile\AppData\Local\GTweak",
+ Arguments = $"/c taskkill /f /im {currentName} & choice /c y /n /d y /t 3 & del {new FileInfo(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath).Name } & " +
+ @$"rd /s /q {UsePath.FileLocation} & rd /s /q {Environment.SystemDirectory}\config\systemprofile\AppData\Local\GTweak",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "cmd.exe"
@@ -202,7 +207,7 @@ namespace GTweak.Utilities
{
Process.Start(new ProcessStartInfo()
{
- Arguments = $"/c taskkill /f /im \"{currentName}\" & choice /c y /n /d y /t 1 & start \"\" \"" + currentLocation + "\"",
+ Arguments = $"/c taskkill /f /im \"{currentName}\" & choice /c y /n /d y /t 1 & start \"\" \"{currentLocation}\"",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "cmd.exe"
diff --git a/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs b/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs
index 993db88f..472a1c4b 100644
--- a/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs
@@ -178,7 +178,7 @@ namespace GTweak.Utilities.Tweaks
{
Process.Start(new ProcessStartInfo()
{
- Arguments = @"/c rd /s /q " + Settings.PathSystemDisk + @"Windows\Temp & rd /s /q %localappdata%\Temp",
+ Arguments = @$"/c rd /s /q {UsePath.SystemDisk}Windows\Temp & rd /s /q %localappdata%\Temp",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "cmd.exe"
diff --git a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
index 4ce424b6..f6327bfb 100644
--- a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
@@ -238,7 +238,7 @@ namespace GTweak.Utilities.Tweaks
try
{
byte count = 0;
- StreamReader streamReader = new StreamReader(Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts");
+ StreamReader streamReader = new StreamReader(UsePath.Hosts);
string hosts = streamReader.ReadToEnd();
foreach (string hostsrules in hostslist)
@@ -370,18 +370,18 @@ namespace GTweak.Utilities.Tweaks
{
BlockSpyDomain(true);
- try { File.Delete(Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts (Default GTweak)"); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
+ try { File.Delete(UsePath.Hosts + @" (Default GTweak)"); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
- File.Move(Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts", Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts (Default GTweak)");
- new UnarchiveManager(Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts", Resources.hosts);
+ File.Move(UsePath.Hosts, UsePath.Hosts + " (Default GTweak)");
+ new UnarchiveManager(UsePath.Hosts, Resources.hosts);
}
else
{
try
{
BlockSpyDomain(false);
- File.Copy(Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts (Default GTweak)", Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts", true);
- File.Delete(Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts (Default GTweak)");
+ File.Copy(UsePath.Hosts + @" (Default GTweak)", UsePath.Hosts, true);
+ File.Delete(UsePath.Hosts + @" (Default GTweak)");
}
catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
}
diff --git a/.Source/GTweak/Utilities/Tweaks/Firewall.cs b/.Source/GTweak/Utilities/Tweaks/Firewall.cs
index b52e8b45..c2162c97 100644
--- a/.Source/GTweak/Utilities/Tweaks/Firewall.cs
+++ b/.Source/GTweak/Utilities/Tweaks/Firewall.cs
@@ -18,10 +18,10 @@ namespace GTweak.Utilities.Tweaks
private static readonly SortedList<string, string> PathsForPrograms = new SortedList<string, string>
{
- ["MoUso_New"] = string.Concat(Settings.PathSystemDisk, @"Windows\UUS\amd64\MoUsoCoreWorker.exe"),
- ["MoUso_Old"] = string.Concat(Settings.PathSystemDisk, @"Windows\System32\MoUsoCoreWorker.exe"),
- ["Uso"] = string.Concat(Settings.PathSystemDisk, @"Windows\System32\usoclient.exe"),
- ["WD"] = string.Concat(Settings.PathSystemDisk, @"Program Files\Windows Defender\MpCmdRun.exe"),
+ ["MoUso_New"] = string.Concat(UsePath.SystemDisk, @"Windows\UUS\amd64\MoUsoCoreWorker.exe"),
+ ["MoUso_Old"] = string.Concat(UsePath.SystemDisk, @"Windows\System32\MoUsoCoreWorker.exe"),
+ ["Uso"] = string.Concat(UsePath.SystemDisk, @"Windows\System32\usoclient.exe"),
+ ["WD"] = string.Concat(UsePath.SystemDisk, @"Program Files\Windows Defender\MpCmdRun.exe"),
};
private static bool CheckRulesWindows(string nameRule)
diff --git a/.Source/GTweak/Utilities/Tweaks/RecoveryPoint.cs b/.Source/GTweak/Utilities/Tweaks/RecoveryPoint.cs
index 55ba71ae..3b2c97d3 100644
--- a/.Source/GTweak/Utilities/Tweaks/RecoveryPoint.cs
+++ b/.Source/GTweak/Utilities/Tweaks/RecoveryPoint.cs
@@ -137,7 +137,7 @@ namespace GTweak.Utilities.Tweaks
foreach (var managementObj in new ManagementObjectSearcher(@"\\localhost\root\default", "SELECT SequenceNumber FROM SystemRestore", optionsObj).Get())
SRRemoveRestorePoint(Convert.ToInt32(managementObj["SequenceNumber"].ToString()));
- DisableSR(Settings.PathSystemDisk + @"\\");
+ DisableSR(UsePath.SystemDisk + @"\\");
}
private static string StartPowerShell(string arguments)
diff --git a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
index 3b7e44f6..d6852270 100644
--- a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
@@ -28,10 +28,10 @@ namespace GTweak.Utilities.Tweaks
private static string PathsWinUUP(string program, bool isOldWay = false)
{
- string path = isOldWay ? string.Concat(Settings.PathSystemDisk, @"Windows\System32\") : string.Concat(Settings.PathSystemDisk, @"Windows\UUS\amd64\");
+ string path = isOldWay ? string.Concat(UsePath.SystemDisk, @"Windows\System32\") : string.Concat(UsePath.SystemDisk, @"Windows\UUS\amd64\");
if (program == "Uso" || program == "Re_Uso")
- return string.Concat(string.Concat(Settings.PathSystemDisk, @"Windows\System32\"), ProgramsUUP[program]);
+ return string.Concat(string.Concat(UsePath.SystemDisk, @"Windows\System32\"), ProgramsUUP[program]);
else
return string.Concat(path, ProgramsUUP[program]);
}
@@ -903,13 +903,13 @@ namespace GTweak.Utilities.Tweaks
ChangeStateTask("/enable");
else
{
- SetFullAccess(Settings.PathSystemDisk + @"Windows\SoftwareDistribution\Download");
- SetFullAccess(Settings.PathSystemDisk + @"Windows\System32\catroot2");
+ SetFullAccess(UsePath.SystemDisk + @"Windows\SoftwareDistribution\Download");
+ SetFullAccess(UsePath.SystemDisk + @"Windows\System32\catroot2");
Process.Start(new ProcessStartInfo()
{
- Arguments = @" /c rd /s /q " + Settings.PathSystemDisk + @"Windows\SoftwareDistribution\Download &
- rd /s /q " + Settings.PathSystemDisk + @"Windows\System32\catroot2",
+ Arguments = @" /c rd /s /q " + UsePath.SystemDisk + @"Windows\SoftwareDistribution\Download &
+ rd /s /q " + UsePath.SystemDisk + @"Windows\System32\catroot2",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "cmd.exe"
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
index 470bf289..2c026fb1 100644
--- a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
@@ -716,9 +716,9 @@ namespace GTweak.Utilities.Tweaks
},
};
- string _serchScheme = default,
+ string serchScheme = default,
unlockFrequency = @"-attributes SUB_PROCESSOR 75b0ae3f-bce0-45a7-8c89-c9611c25e100 -ATTRIB_HIDE",
- inputPath = Settings.PathTempFiles + @"\UltimatePerformance.pow";
+ pathTempFile = UsePath.FileLocation + @"\UltimatePerformance.pow";
try
{
@@ -728,14 +728,14 @@ namespace GTweak.Utilities.Tweaks
{
foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2\power", "SELECT InstanceID FROM Win32_PowerPlan WHERE IsActive=false").Get())
{
- _serchScheme = Convert.ToString(managementObj["InstanceID"]);
- _serchScheme = Regex.Match(_serchScheme, @"\{([^)]*)\}").Groups[1].Value;
- if (Registry.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\" + _serchScheme + "", "Description", string.Empty).ToString().Contains("-18") &&
- Registry.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\" + _serchScheme + "", "FriendlyName", string.Empty).ToString().Contains("-19"))
+ serchScheme = Convert.ToString(managementObj["InstanceID"]);
+ serchScheme = Regex.Match(serchScheme, @"\{([^)]*)\}").Groups[1].Value;
+ if (Registry.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\" + serchScheme + "", "Description", string.Empty).ToString().Contains("-18") &&
+ Registry.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\" + serchScheme + "", "FriendlyName", string.Empty).ToString().Contains("-19"))
{
using (_powercfg)
{
- _powercfg.StartInfo.Arguments = $"/setactive {_serchScheme}";
+ _powercfg.StartInfo.Arguments = $"/setactive {serchScheme}";
_powercfg.Start();
_powercfg.StartInfo.Arguments = unlockFrequency;
@@ -746,15 +746,15 @@ namespace GTweak.Utilities.Tweaks
});
- if (string.IsNullOrEmpty(_serchScheme))
+ if (string.IsNullOrEmpty(serchScheme))
{
- new UnarchiveManager(Settings.PathTempFiles + @"\UltimatePerformance.pow", Properties.Resources.Ultimate_Performance_pow);
+ new UnarchiveManager(pathTempFile, Properties.Resources.Ultimate_Performance_pow);
string _guid = Guid.NewGuid().ToString("D");
using (_powercfg)
{
- _powercfg.StartInfo.Arguments = $"-import \"{inputPath}\" {_guid}";
+ _powercfg.StartInfo.Arguments = $@"-import ""{pathTempFile}"" {_guid}";
_powercfg.Start();
await Task.Delay(5);
@@ -765,6 +765,14 @@ namespace GTweak.Utilities.Tweaks
_powercfg.StartInfo.Arguments = unlockFrequency;
_powercfg.Start();
}
+
+ Process.Start(new ProcessStartInfo()
+ {
+ Arguments = $"/c timeout /t 10 && del {pathTempFile}",
+ WindowStyle = ProcessWindowStyle.Hidden,
+ CreateNoWindow = true,
+ FileName = "cmd.exe"
+ });
}
}
else
@@ -774,14 +782,14 @@ namespace GTweak.Utilities.Tweaks
Parallel.Invoke(() =>
{
foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2\power", "SELECT InstanceID FROM Win32_PowerPlan WHERE InstanceID !='" + _activePowerScheme + "'").Get())
- _serchScheme = Convert.ToString(managementObj["InstanceID"]);
+ serchScheme = Convert.ToString(managementObj["InstanceID"]);
});
- _serchScheme = Regex.Match(_serchScheme, @"\{([^)]*)\}").Groups[1].Value;
+ serchScheme = Regex.Match(serchScheme, @"\{([^)]*)\}").Groups[1].Value;
using (_powercfg)
{
- _powercfg.StartInfo.Arguments = $"/setactive {_serchScheme}";
+ _powercfg.StartInfo.Arguments = $"/setactive {serchScheme}";
_powercfg.Start();
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/UninstallingApps.cs b/.Source/GTweak/Utilities/Tweaks/UninstallingApps.cs
index 0e13a67b..ec0bee4e 100644
--- a/.Source/GTweak/Utilities/Tweaks/UninstallingApps.cs
+++ b/.Source/GTweak/Utilities/Tweaks/UninstallingApps.cs
@@ -227,7 +227,7 @@ namespace GTweak.Utilities.Tweaks
}
string argumentsFolders = @"/c rd /s /q %userprofile%\AppData\Local\Microsoft\OneDrive & rd /s /q %userprofile%\AppData\Local\OneDrive
- & rd /s /q ""%allusersprofile%\Microsoft OneDrive"" & rd /s /q " + Settings.PathSystemDisk + @"\OneDriveTemp";
+ & rd /s /q ""%allusersprofile%\Microsoft OneDrive"" & rd /s /q " + UsePath.SystemDisk + @"\OneDriveTemp";
if (isLocalAccount)
argumentsFolders += @" & rd /s /q %userprofile%\OneDrive";
diff --git a/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs b/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs
index b4fe82a9..252fafc5 100644
--- a/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs
+++ b/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs
@@ -140,7 +140,7 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.Write(Registry.ClassesRoot, @"*\shellex\ContextMenuHandlers\EPP", "", "{09A47860-11B0-4DA5-AFA5-26D86198A780}", RegistryValueKind.String);
RegistryHelp.Write(Registry.ClassesRoot, @"Directory\shellex\ContextMenuHandlers\EPP", "", "{09A47860-11B0-4DA5-AFA5-26D86198A780}", RegistryValueKind.String);
RegistryHelp.Write(Registry.ClassesRoot, @"Drive\shellex\ContextMenuHandlers\EPP", "", "{09A47860-11B0-4DA5-AFA5-26D86198A780}", RegistryValueKind.String);
- RegistryHelp.Write(Registry.ClassesRoot, @"CLSID\{09A47860-11B0-4DA5-AFA5-26D86198A780}\InprocServer32", "", Settings.PathSystemDisk + @"Program Files\Windows Defender\shellext.dll", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.ClassesRoot, @"CLSID\{09A47860-11B0-4DA5-AFA5-26D86198A780}\InprocServer32", "", UsePath.SystemDisk + @"Program Files\Windows Defender\shellext.dll", RegistryValueKind.String);
RegistryHelp.Write(Registry.ClassesRoot, @"CLSID\{09A47860-11B0-4DA5-AFA5-26D86198A780}\InprocServer32", "ThreadingModel", "Apartment", RegistryValueKind.String);
}
diff --git a/.Source/GTweak/Windows/ImportWindow.xaml b/.Source/GTweak/Windows/ImportWindow.xaml
index 34b9fff1..56d083ad 100644
--- a/.Source/GTweak/Windows/ImportWindow.xaml
+++ b/.Source/GTweak/Windows/ImportWindow.xaml
@@ -7,7 +7,7 @@
xmlns:local="clr-namespace:GTweak.Windows"
mc:Ignorable="d"
Title="GTweak" WindowStyle="None"
- Height="160" Width="390" MinHeight="160" MinWidth="390" MaxHeight="160" MaxWidth="390"
+ Height="160" Width="390" MinHeight="160" MinWidth="390" MaxHeight="160" MaxWidth="390" SnapsToDevicePixels="True" UseLayoutRounding="True"
Background="Transparent" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Topmost="True" ResizeMode="CanMinimize"
ShowInTaskbar="False" IsTabStop="False" Loaded="Window_Loaded">
diff --git a/.Source/GTweak/Windows/ImportWindow.xaml.cs b/.Source/GTweak/Windows/ImportWindow.xaml.cs
index dd443bff..884391cf 100644
--- a/.Source/GTweak/Windows/ImportWindow.xaml.cs
+++ b/.Source/GTweak/Windows/ImportWindow.xaml.cs
@@ -60,7 +60,7 @@ namespace GTweak.Windows
{
List<string> tempKeys = new List<string>(), tempValues = new List<string>();
- INIManager iniManager = new INIManager(Settings.PathConfig);
+ INIManager iniManager = new INIManager(UsePath.Config);
for (byte i = 1; i <= 100; i++)
{
diff --git a/.Source/GTweak/Windows/MainWindow.xaml.cs b/.Source/GTweak/Windows/MainWindow.xaml.cs
index c13b56bd..f3871bf9 100644
--- a/.Source/GTweak/Windows/MainWindow.xaml.cs
+++ b/.Source/GTweak/Windows/MainWindow.xaml.cs
@@ -22,7 +22,7 @@ namespace GTweak
BtnNotification.StateNA = Settings.IsViewNotification;
BtnUpdate.StateNA = Settings.IsСheckingUpdate;
BtnTopMost.StateNA = Topmost = Settings.IsTopMost;
- BtnSoundNtn.IsChecked = Settings.IsSoundNotification;
+ BtnSoundNtn.IsChecked = Settings.IsPlayingSound;
SliderVolume.Value = Settings.VolumeNotification;
LanguageSelectionMenu.SelectedIndex = Settings.Language == "en" ? 0 : 1;
ThemeSelectionMenu.SelectedIndex = Settings.Theme switch
diff --git a/.Source/GTweak/Windows/MessageWindow.xaml b/.Source/GTweak/Windows/MessageWindow.xaml
index e8742927..56fc7d0d 100644
--- a/.Source/GTweak/Windows/MessageWindow.xaml
+++ b/.Source/GTweak/Windows/MessageWindow.xaml
@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:GTweak.Windows"
mc:Ignorable="d"
Title="GTweak" WindowStyle="None"
- Height="170" Width="370" MinHeight="170" MinWidth="370" MaxHeight="170" MaxWidth="370"
+ Height="170" Width="370" MinHeight="170" MinWidth="370" MaxHeight="170" MaxWidth="370" SnapsToDevicePixels="True" UseLayoutRounding="True"
Background="Transparent" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Topmost="True" ResizeMode="CanMinimize"
ShowInTaskbar="False" IsTabStop="False">
<Grid MouseDown="TitleBar_MouseDown">
diff --git a/.Source/GTweak/Windows/NotificationWindow.xaml.cs b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
index 238973bc..964ed271 100644
--- a/.Source/GTweak/Windows/NotificationWindow.xaml.cs
+++ b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
@@ -26,7 +26,7 @@ namespace GTweak.Windows
{
InitializeComponent();
- ImageBody.Source ??= (ImageSource)new ImageSourceConverter().ConvertFromString(Settings.PathIcon);
+ ImageBody.Source ??= (ImageSource)new ImageSourceConverter().ConvertFromString(UsePath.Icon);
timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, delegate
{
@@ -61,9 +61,9 @@ namespace GTweak.Windows
private void Window_Loaded(object sender, RoutedEventArgs e)
{
- if (Settings.IsSoundNotification)
+ if (Settings.IsPlayingSound)
{
- _mediaPlayer.Open(new Uri(Settings.PathSound));
+ _mediaPlayer.Open(new Uri(UsePath.Sound));
_mediaPlayer.Volume = Settings.VolumeNotification / 100.0f;
_mediaPlayer.Play();
}
diff --git a/.Source/GTweak/Windows/UpdateWindow.xaml b/.Source/GTweak/Windows/UpdateWindow.xaml
index 65223849..12ce6eeb 100644
--- a/.Source/GTweak/Windows/UpdateWindow.xaml
+++ b/.Source/GTweak/Windows/UpdateWindow.xaml
@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:GTweak.Windows"
mc:Ignorable="d"
Title="{DynamicResource title_win_update}" WindowStyle="None"
- Height="180" Width="400" MinHeight="180" MinWidth="400" MaxHeight="180" MaxWidth="350"
+ Height="180" Width="400" MinHeight="180" MinWidth="400" MaxHeight="180" MaxWidth="350" SnapsToDevicePixels="True" UseLayoutRounding="True"
Background="Transparent" AllowsTransparency="True" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize"
IsTabStop="False" Topmost="True" ShowInTaskbar="True" Loaded="Window_Loaded" Closing="Window_Closing">
<Grid MouseDown="TitleBar_MouseDown">
diff --git a/.Source/GTweak/Windows/UpdateWindow.xaml.cs b/.Source/GTweak/Windows/UpdateWindow.xaml.cs
index f091b65e..3bf046eb 100644
--- a/.Source/GTweak/Windows/UpdateWindow.xaml.cs
+++ b/.Source/GTweak/Windows/UpdateWindow.xaml.cs
@@ -3,7 +3,6 @@ using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Net;
-using System.Reflection;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media.Animation;
@@ -12,8 +11,6 @@ namespace GTweak.Windows
{
public partial class UpdateWindow : Window
{
- private static readonly string nameOfUser = AppDomain.CurrentDomain.FriendlyName;
- private static readonly string pathOfUser = Assembly.GetExecutingAssembly().Location;
public UpdateWindow()
{
InitializeComponent();
@@ -80,13 +77,13 @@ namespace GTweak.Windows
{
Process.Start(new ProcessStartInfo()
{
- Arguments = $"/c taskkill /f /im \"{nameOfUser}\" && timeout /t 1 && del \"{pathOfUser}\" && ren nGTweak.exe \"{nameOfUser}\" && \"{pathOfUser}\"",
+ Arguments = $"/c taskkill /f /im \"{Settings.currentName}\" && timeout /t 1 && del \"{Settings.currentLocation}\" && ren Git-GTweak.exe \"{Settings.currentName}\" && \"{Settings.currentLocation}\"",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "cmd.exe"
});
};
- webClient.DownloadFileAsync(new Uri("https://github.com/Greedeks/GTweak/releases/latest/download/GTweak.exe"), "nGTweak.exe");
+ webClient.DownloadFileAsync(new Uri("https://github.com/Greedeks/GTweak/releases/latest/download/GTweak.exe"), "Git-GTweak.exe");
}
catch
{