Skip to content

Portable Tool for an Ideal Windows Setup

-refactoring

Greedeks60f601b06fc2
diff --git a/.Source/GTweak/App.xaml.cs b/.Source/GTweak/App.xaml.cs
index eda1e31f..77722c3c 100644
--- a/.Source/GTweak/App.xaml.cs
+++ b/.Source/GTweak/App.xaml.cs
@@ -20,7 +20,7 @@ namespace GTweak
{
set
{
- value ??= Regex.Replace(CultureInfo.CurrentCulture.ToString(), @"-.+$", "", RegexOptions.Multiline).ToString();
+ value ??= Regex.Replace(CultureInfo.CurrentCulture.ToString(), @"-.+$", "", RegexOptions.Multiline);
ResourceDictionary dictionary = new ResourceDictionary
{
@@ -47,7 +47,7 @@ namespace GTweak
internal static void UpdateImport()=> ImportTweaksUpdate?.Invoke(null, EventArgs.Empty);
- internal static void ViewLang() => Language = Registry.CurrentUser.OpenSubKey(@"Software\GTweak")?.GetValue("Language")?.ToString() ?? Regex.Replace(CultureInfo.CurrentCulture.ToString(), @"-.+$", "", RegexOptions.Multiline).ToString();
+ internal static void ViewLang() => Language = Registry.CurrentUser.OpenSubKey(@"Software\GTweak")?.GetValue("Language")?.ToString() ?? Regex.Replace(CultureInfo.CurrentCulture.ToString(), @"-.+$", "", RegexOptions.Multiline);
diff --git a/.Source/GTweak/Core/ViewModel/MainViewModel.cs b/.Source/GTweak/Core/ViewModel/MainViewModel.cs
index 1bd439c7..2c33acca 100644
--- a/.Source/GTweak/Core/ViewModel/MainViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/MainViewModel.cs
@@ -1,5 +1,5 @@
using GTweak.Core.Model;
-using GTweak.Utilities;
+using GTweak.Utilities.Tweaks;
using System;
using System.Reflection;
using System.Windows;
@@ -46,13 +46,13 @@ namespace GTweak.Core.ViewModel
public ICommand MoreCommand { get; set; }
- private void Confidentiality(object _obj) => CurrentView = new ConfidentialityVM();
- private void Interface(object _obj) => CurrentView = new InterfaceVM();
- private void Apps(object _obj) => CurrentView = new ApplicationsVM();
- private void Services(object _obj) => CurrentView = new ServicesVM();
- private void System(object _obj) => CurrentView = new SystemVM();
- private void InformationSystem(object _obj) => CurrentView = new InformationSystemVM();
- private void More(object _obj) => CurrentView = new MoreVM();
+ private void Confidentiality(object obj) => CurrentView = new ConfidentialityVM();
+ private void Interface(object obj) => CurrentView = new InterfaceVM();
+ private void Apps(object obj) => CurrentView = new ApplicationsVM();
+ private void Services(object obj) => CurrentView = new ServicesVM();
+ private void System(object obj) => CurrentView = new SystemVM();
+ private void InformationSystem(object obj) => CurrentView = new InformationSystemVM();
+ private void More(object obj) => CurrentView = new MoreVM();
public MainViewModel()
{
diff --git a/.Source/GTweak/Utilities/BlockRunTweaker.cs b/.Source/GTweak/Utilities/BlockRunTweaker.cs
index 86168082..2e3cdcdb 100644
--- a/.Source/GTweak/Utilities/BlockRunTweaker.cs
+++ b/.Source/GTweak/Utilities/BlockRunTweaker.cs
@@ -6,6 +6,7 @@ using System.Management;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
+using GTweak.Utilities.Tweaks;
namespace GTweak.Utilities
{
@@ -26,8 +27,8 @@ namespace GTweak.Utilities
if (mutex.WaitOne(0, false))
new MessageWindow().ShowDialog();
}
- string _processName = Process.GetCurrentProcess().ProcessName;
- Process process = Process.GetProcesses().FirstOrDefault(p => p.ProcessName == _processName);
+ string processName = Process.GetCurrentProcess().ProcessName;
+ Process process = Process.GetProcesses().FirstOrDefault(p => p.ProcessName == processName);
if (process != null)
{
IntPtr handle = process.MainWindowHandle;
@@ -49,11 +50,9 @@ namespace GTweak.Utilities
SystemData.СomputerСonfiguration.clientWinVersion = Convert.ToString(managementObj["Caption"]);;
});
- if (!SystemData.СomputerСonfiguration.clientWinVersion.Contains("11") && !SystemData.СomputerСonfiguration.clientWinVersion.Contains("10"))
- {
- MessageWindow messageWindow = new MessageWindow(true);
- messageWindow.ShowDialog();
- }
+ if (SystemData.СomputerСonfiguration.clientWinVersion.Contains("11") || SystemData.СomputerСonfiguration.clientWinVersion.Contains("10")) return;
+ MessageWindow messageWindow = new MessageWindow(true);
+ messageWindow.ShowDialog();
}
}
}
diff --git a/.Source/GTweak/Utilities/Helpers/BrushAnimation.cs b/.Source/GTweak/Utilities/Helpers/BrushAnimation.cs
index 6c984433..739c27ba 100644
--- a/.Source/GTweak/Utilities/Helpers/BrushAnimation.cs
+++ b/.Source/GTweak/Utilities/Helpers/BrushAnimation.cs
@@ -41,18 +41,18 @@ namespace GTweak.Utilities.Helpers
public override object GetCurrentValue(object defaultOriginValue,
object defaultDestinationValue, AnimationClock animationClock)
{
- Brush _fromVal = ((Brush)GetValue(FromProperty)).CloneCurrentValue();
- Brush _toVal = ((Brush)GetValue(ToProperty)).CloneCurrentValue();
+ Brush fromVal = ((Brush)GetValue(FromProperty)).CloneCurrentValue();
+ Brush toVal = ((Brush)GetValue(ToProperty)).CloneCurrentValue();
switch (animationClock.CurrentProgress)
{
case 0.0:
- return _fromVal;
+ return fromVal;
case 1.0:
- return _toVal;
+ return toVal;
}
- _toVal.Opacity = Convert.ToDouble(animationClock.CurrentProgress);
+ toVal.Opacity = Convert.ToDouble(animationClock.CurrentProgress);
Border border0 = new Border();
@@ -61,15 +61,15 @@ namespace GTweak.Utilities.Helpers
border0.Width = 1.0;
border0.Height = 1.0;
- border0.Background = _fromVal;
- border1.Background = _toVal;
+ border0.Background = fromVal;
+ border1.Background = toVal;
border0.Visibility = Visibility.Visible;
border1.Visibility = Visibility.Visible;
border0.Child = border1;
- Brush VB = new VisualBrush(border0);
- return VB;
+ Brush vb = new VisualBrush(border0);
+ return vb;
}
}
diff --git a/.Source/GTweak/Utilities/Helpers/INIManager.cs b/.Source/GTweak/Utilities/Helpers/INIManager.cs
index 0e88d65a..27a6e17e 100644
--- a/.Source/GTweak/Utilities/Helpers/INIManager.cs
+++ b/.Source/GTweak/Utilities/Helpers/INIManager.cs
@@ -17,10 +17,10 @@ namespace GTweak.Utilities.Helpers
private readonly string pathToConfig;
internal static Dictionary<string, string>
- userTweaksConfidentiality = new Dictionary<string, string>(),
- userTweaksInterface = new Dictionary<string, string>(),
- userTweaksServices = new Dictionary<string, string>(),
- userTweaksSystem = new Dictionary<string, string>();
+ UserTweaksConfidentiality = new Dictionary<string, string>(),
+ UserTweaksInterface = new Dictionary<string, string>(),
+ UserTweaksServices = new Dictionary<string, string>(),
+ UserTweaksSystem = new Dictionary<string, string>();
internal INIManager(string iniPath) => pathToConfig = new FileInfo(iniPath).FullName.ToString();
@@ -61,7 +61,7 @@ namespace GTweak.Utilities.Helpers
switch (isGetKey)
{
case true:
- result.Add(data.Substring(0, data.IndexOf("=")));
+ result.Add(data.Substring(0, data.IndexOf("=", StringComparison.InvariantCulture)));
break;
case false:
result.Add(data.Remove(0, data.IndexOf("=", StringComparison.InvariantCulture)).Substring(1));
diff --git a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs b/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs
index 16065ab0..5f26d498 100644
--- a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs
+++ b/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs
@@ -6,48 +6,48 @@ namespace GTweak.Utilities.Helpers
{
internal readonly struct RegistryHelp
{
- internal static void DeleteFolderTree(in RegistryKey _registrykey, in string _subkey)
+ internal static void DeleteFolderTree(in RegistryKey registrykey, in string subkey)
{
- if (_registrykey.OpenSubKey(_subkey) != null)
- try { _registrykey.DeleteSubKeyTree(_subkey); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
+ if (registrykey.OpenSubKey(subkey) == null) return;
+ try { registrykey.DeleteSubKeyTree(subkey); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
}
- internal static void DeleteValue(in RegistryKey _registrykey, in string _subkey, in string _value)
+ internal static void DeleteValue(in RegistryKey registrykey, in string subkey, in string value)
{
- if (_registrykey.OpenSubKey(_subkey) != null && _registrykey.OpenSubKey(_subkey)?.GetValue(_value, null) != null)
- try { _registrykey.OpenSubKey(_subkey, true)?.DeleteValue(_value); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
+ if (registrykey.OpenSubKey(subkey) == null || registrykey.OpenSubKey(subkey)?.GetValue(value, null) == null) return;
+ try { registrykey.OpenSubKey(subkey, true)?.DeleteValue(value); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
}
- internal static void Write<T>(in RegistryKey _registrykey, in string _key, in string _name, in T _data, in RegistryValueKind _kind)
+ internal static void Write<T>(in RegistryKey registrykey, in string key, in string name, in T data, in RegistryValueKind kind)
{
- try { _registrykey.CreateSubKey(_key, true)?.SetValue(_name, _data, _kind); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
+ try { registrykey.CreateSubKey(key, true)?.SetValue(name, data, kind); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
}
- internal static void CreateFolder(in RegistryKey _registrykey, in string _subkey)
+ internal static void CreateFolder(in RegistryKey registrykey, in string subkey)
{
- try { _registrykey.CreateSubKey(_subkey); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
+ try { registrykey.CreateSubKey(subkey); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
}
- internal static void DeleteRegristyTree(in RegistryKey _registrykey, in string _key)
+ internal static void DeleteRegristyTree(in RegistryKey registrykey, in string key)
{
try
{
- RegistryKey _registryFolder = _registrykey.OpenSubKey(_key, true);
+ RegistryKey registryFolder = registrykey.OpenSubKey(key, true);
- if (_registryFolder != null)
+ if (registryFolder != null)
{
- foreach (string value in _registryFolder.GetValueNames())
+ foreach (string value in registryFolder.GetValueNames())
{
try
{
- _registryFolder.DeleteValue(value);
+ registryFolder.DeleteValue(value);
}
catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
}
}
- Registry.LocalMachine.DeleteSubKeyTree(_key, false);
+ Registry.LocalMachine.DeleteSubKeyTree(key, false);
}
catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
}
diff --git a/.Source/GTweak/Utilities/Helpers/WorkWithText.cs b/.Source/GTweak/Utilities/Helpers/WorkWithText.cs
index 66ac99ef..3892f92d 100644
--- a/.Source/GTweak/Utilities/Helpers/WorkWithText.cs
+++ b/.Source/GTweak/Utilities/Helpers/WorkWithText.cs
@@ -7,38 +7,36 @@ namespace GTweak.Utilities.Helpers
{
internal readonly struct WorkWithText
{
- internal static void TypeWriteAnimation(string textToAnimate, TextBlock _textBlock, TimeSpan _timeSpan)
+ internal static void TypeWriteAnimation(string textToAnimate, TextBlock textBlock, TimeSpan timeSpan)
{
- if (_textBlock.FindName(_textBlock.Name) is TextBlock)
+ if (!(textBlock.FindName(textBlock.Name) is TextBlock)) return;
+ Storyboard storyBoard = new Storyboard()
{
- Storyboard storyBoard = new Storyboard()
- {
- FillBehavior = FillBehavior.HoldEnd
- };
+ FillBehavior = FillBehavior.HoldEnd
+ };
- StringAnimationUsingKeyFrames stringAnimationUsingKeyFrames = new StringAnimationUsingKeyFrames()
- {
- Duration = new Duration(_timeSpan)
- };
+ StringAnimationUsingKeyFrames stringAnimationUsingKeyFrames = new StringAnimationUsingKeyFrames()
+ {
+ Duration = new Duration(timeSpan)
+ };
- string _temp = string.Empty;
- foreach (char _char in textToAnimate)
+ string temp = string.Empty;
+ foreach (char data in textToAnimate)
+ {
+ DiscreteStringKeyFrame discreteStringKeyFrame = new DiscreteStringKeyFrame
{
- DiscreteStringKeyFrame discreteStringKeyFrame = new DiscreteStringKeyFrame
- {
- KeyTime = KeyTime.Paced
- };
- _temp += _char;
- discreteStringKeyFrame.Value = _temp;
- stringAnimationUsingKeyFrames.KeyFrames.Add(discreteStringKeyFrame);
- }
-
- Storyboard.SetTargetName(stringAnimationUsingKeyFrames, _textBlock.Name);
- Storyboard.SetTargetProperty(stringAnimationUsingKeyFrames, new PropertyPath(TextBlock.TextProperty));
- storyBoard.Children.Add(stringAnimationUsingKeyFrames);
- _textBlock.BeginStoryboard(storyBoard);
- storyBoard.Remove(_textBlock);
+ KeyTime = KeyTime.Paced
+ };
+ temp += data;
+ discreteStringKeyFrame.Value = temp;
+ stringAnimationUsingKeyFrames.KeyFrames.Add(discreteStringKeyFrame);
}
+
+ Storyboard.SetTargetName(stringAnimationUsingKeyFrames, textBlock.Name);
+ Storyboard.SetTargetProperty(stringAnimationUsingKeyFrames, new PropertyPath(TextBlock.TextProperty));
+ storyBoard.Children.Add(stringAnimationUsingKeyFrames);
+ textBlock.BeginStoryboard(storyBoard);
+ storyBoard.Remove(textBlock);
}
}
}
diff --git a/.Source/GTweak/Utilities/Settings.cs b/.Source/GTweak/Utilities/Settings.cs
index 27cf9c91..71f1db7f 100644
--- a/.Source/GTweak/Utilities/Settings.cs
+++ b/.Source/GTweak/Utilities/Settings.cs
@@ -55,10 +55,10 @@ namespace GTweak.Utilities
registryKey?.SetValue("HiddenIP", IsHiddenIpAddress, RegistryValueKind.String);
if (string.IsNullOrEmpty(Language))
{
- if (System.Text.RegularExpressions.Regex.Replace(CultureInfo.CurrentCulture.ToString(), @"-.+$", "", System.Text.RegularExpressions.RegexOptions.Multiline).ToString().Contains("ru"))
- registryKey?.SetValue("Language", "ru", RegistryValueKind.String);
- else
- registryKey?.SetValue("Language", "en", RegistryValueKind.String);
+ registryKey?.SetValue("Language", System.Text.RegularExpressions.Regex.Replace(CultureInfo.CurrentCulture.ToString(), @"-.+$", "",
+ System.Text.RegularExpressions.RegexOptions.Multiline).Contains("ru")
+ ? "ru"
+ : "en", RegistryValueKind.String);
}
else
registryKey?.SetValue("Language", Language, RegistryValueKind.String);
@@ -73,7 +73,7 @@ namespace GTweak.Utilities
IsHiddenIpAddress = bool.Parse(registryKey?.GetValue("HiddenIP").ToString() ?? "False");
Language = registryKey?.GetValue("Language").ToString();
}
- registryKey.Close();
+ registryKey?.Close();
}
internal static void ChangingParameters<T>(T value, string selection)
@@ -100,17 +100,17 @@ namespace GTweak.Utilities
Language = registryKey?.GetValue("Language").ToString();
break;
case "HiddenIP":
- IsHiddenIpAddress = bool.Parse(registryKey?.GetValue("HiddenIP").ToString() ?? "False");
- break;
+ IsHiddenIpAddress = bool.Parse(registryKey?.GetValue("HiddenIP").ToString() ?? "False");
+ break;
}
- registryKey.Close();
+ registryKey?.Close();
});
}
internal static void SaveFileConfig()
{
- if (INIManager.userTweaksConfidentiality.Count == 0 && INIManager.userTweaksInterface.Count == 0
- && INIManager.userTweaksServices.Count == 0 && INIManager.userTweaksSystem.Count == 0)
+ if (INIManager.UserTweaksConfidentiality.Count == 0 && INIManager.UserTweaksInterface.Count == 0
+ && INIManager.UserTweaksServices.Count == 0 && INIManager.UserTweaksSystem.Count == 0)
new ViewNotification().Show("", (string)Application.Current.Resources["title1_notification"], (string)Application.Current.Resources["export_warning_notification"]);
else
@@ -122,30 +122,25 @@ namespace GTweak.Utilities
RestoreDirectory = true
};
- Nullable<bool> isResult = saveFileDialog.ShowDialog();
+ bool? isResult = saveFileDialog.ShowDialog();
- if (isResult == true)
+ if (isResult != true) return;
+ try
{
- string path = Path.GetDirectoryName(saveFileDialog.FileName);
- string filename = Path.GetFileNameWithoutExtension(saveFileDialog.FileName);
-
- try
- {
- PathConfig = path + @"\" + filename + ".ini";
-
- if (File.Exists(PathConfig))
- File.Delete(PathConfig);
-
- INIManager settingsFileINI = new INIManager(PathConfig);
- settingsFileINI.Write("GTweak", "Author", "Greedeks");
- settingsFileINI.Write("GTweak", "Release", "v4");
- settingsFileINI.WriteAll("Confidentiality Tweaks", INIManager.userTweaksConfidentiality);
- settingsFileINI.WriteAll("Interface Tweaks", INIManager.userTweaksInterface);
- settingsFileINI.WriteAll("Services Tweaks", INIManager.userTweaksServices);
- settingsFileINI.WriteAll("System Tweaks", INIManager.userTweaksSystem);
- }
- catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
+ PathConfig = Path.GetDirectoryName(saveFileDialog.FileName) + @"\" + Path.GetFileNameWithoutExtension(saveFileDialog.FileName) + ".ini";
+
+ if (File.Exists(PathConfig))
+ File.Delete(PathConfig);
+
+ INIManager iniManager = new INIManager(PathConfig);
+ iniManager.Write("GTweak", "Author", "Greedeks");
+ iniManager.Write("GTweak", "Release", "v4");
+ iniManager.WriteAll("Confidentiality Tweaks", INIManager.UserTweaksConfidentiality);
+ iniManager.WriteAll("Interface Tweaks", INIManager.UserTweaksInterface);
+ iniManager.WriteAll("Services Tweaks", INIManager.UserTweaksServices);
+ iniManager.WriteAll("System Tweaks", INIManager.UserTweaksSystem);
}
+ catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
}
}
@@ -155,14 +150,15 @@ namespace GTweak.Utilities
{
Filter = "(*.INI)|*.INI"
};
+
bool? isResult = openFileDialog.ShowDialog();
if (isResult == true)
{
PathConfig = openFileDialog.FileName;
- INIManager settingsFileINI = new INIManager(PathConfig);
+ INIManager iniManager = new INIManager(PathConfig);
- if (settingsFileINI.Read("GTweak", "Author").Contains("Greedeks") && settingsFileINI.Read("GTweak", "Release").Contains("v4"))
+ if (iniManager.Read("GTweak", "Author").Contains("Greedeks") && iniManager.Read("GTweak", "Release").Contains("v4"))
{
if (File.ReadLines(PathConfig).Any(line => line.Contains("TglButton")) || File.ReadLines(PathConfig).Any(line => line.Contains("Slider")))
new ImportWindow().ShowDialog();
diff --git a/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs b/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs
index 1a8b3803..f55c119d 100644
--- a/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs
@@ -196,13 +196,13 @@ namespace GTweak.Utilities.Tweaks
internal static void StartMemoryCleanup()
{
BackgroundWorker backgroundWorker = new BackgroundWorker();
- backgroundWorker.DoWork += (s, e) =>
+ backgroundWorker.DoWork += delegate
{
Parallel.Invoke(() => { ClearFileSystemCache(true); },
EmptyWorkingSetFunction,
ClearTempSystemCache);
};
- backgroundWorker.RunWorkerCompleted += (s, e) =>
+ backgroundWorker.RunWorkerCompleted += delegate
{
new Thread(() => backgroundWorker.Dispose()).Start();
new Thread(() => backgroundWorker.Dispose()).IsBackground = true;
diff --git a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
index 9192bd5b..ca9110be 100644
--- a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
@@ -12,7 +12,7 @@ namespace GTweak.Utilities.Tweaks
{
internal sealed class ConfidentialityTweaks : Firewall
{
- private static readonly string[] schedulerTasks = {
+ private static readonly string[] SchedulerTasks = {
@"Microsoft\Windows\Maintenance\WinSAT",
@"Microsoft\Windows\Autochk\Proxy",
@"Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser",
@@ -26,12 +26,12 @@ namespace GTweak.Utilities.Tweaks
@"Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticResolver",
@"Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector"};
- private static readonly string[] nvidiaTasks = {
+ private static readonly string[] NvidiaTasks = {
@"NvTmRepOnLogon_{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}",
@"NvTmRep_{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}",
@"NvTmMon_{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}" };
- private static readonly string[] telemetryTasks = {
+ private static readonly string[] TelemetryTasks = {
@"Microsoft\Office\Office ClickToRun Service Monitor",
@"Microsoft\Office\OfficeTelemetry\AgentFallBack2016",
@"Microsoft\Office\OfficeTelemetry\OfficeTelemetryAgentLogOn2016",
@@ -41,7 +41,7 @@ namespace GTweak.Utilities.Tweaks
@"Microsoft\Office\OfficeTelemetryAgentLogOn",
@"Microsoft\Office\Office 15 Subscription Heartbeat" };
- private static readonly string[] hostsRules = {
+ private static readonly string[] HostsRules = {
@"0.0.0.0 hk2sch130021829.wns.windows.com",
@"0.0.0.0 v10-win.vortex.data.microsoft.com.akadns.net",
@"0.0.0.0 watson.live.com",
@@ -84,7 +84,7 @@ namespace GTweak.Utilities.Tweaks
confidentialityV.TglButton3.StateNA = false;
- if (ViewTaskState(schedulerTasks) > 0)
+ if (ViewTaskState(SchedulerTasks) > 0)
confidentialityV.TglButton4.StateNA = true;
else
confidentialityV.TglButton4.StateNA = false;
@@ -128,7 +128,7 @@ namespace GTweak.Utilities.Tweaks
confidentialityV.TglButton8.StateNA = false;
- if (ViewHosts(hostsRules) < 4)
+ if (ViewHosts(HostsRules) < 4)
confidentialityV.TglButton9.StateNA = true;
else
confidentialityV.TglButton9.StateNA = false;
@@ -195,7 +195,7 @@ namespace GTweak.Utilities.Tweaks
{
if (Registry.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NvTelemetryContainer", "Start", null) == null ||
Registry.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NvTelemetryContainer", "Start", string.Empty).ToString() != "4" ||
- ViewTaskState(nvidiaTasks) > 0)
+ ViewTaskState(NvidiaTasks) > 0)
confidentialityV.TglButton17.StateNA = true;
else
confidentialityV.TglButton17.StateNA = false;
@@ -213,41 +213,41 @@ namespace GTweak.Utilities.Tweaks
}
- private byte ViewTaskState(string[] _tasklist)
+ private byte ViewTaskState(string[] tasklist)
{
- byte _countTaskRun = 0;
+ byte countTaskRun = 0;
using (Microsoft.Win32.TaskScheduler.TaskService taskService = new Microsoft.Win32.TaskScheduler.TaskService())
{
- foreach (string taskname in _tasklist)
+ foreach (string taskname in tasklist)
{
- Microsoft.Win32.TaskScheduler.Task _task = taskService.GetTask(taskname);
- if (_task != null)
+ Microsoft.Win32.TaskScheduler.Task task = taskService.GetTask(taskname);
+ if (task != null)
{
- if (_task.Enabled)
- _countTaskRun++;
+ if (task.Enabled)
+ countTaskRun++;
}
}
}
- return _countTaskRun;
+ return countTaskRun;
}
- internal byte ViewHosts(string[] _hostslist)
+ internal byte ViewHosts(string[] hostslist)
{
try
{
- byte _count = 0;
+ byte count = 0;
StreamReader streamReader = new StreamReader(Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts");
- string _hosts = streamReader.ReadToEnd();
+ string hosts = streamReader.ReadToEnd();
- foreach (string hostsrules in _hostslist)
+ foreach (string hostsrules in hostslist)
{
- if (_hosts.Contains(hostsrules))
- _count++;
+ if (hosts.Contains(hostsrules))
+ count++;
}
streamReader.Close();
streamReader.Dispose();
- return _count;
+ return count;
}
catch { return 0; }
}
@@ -255,8 +255,8 @@ namespace GTweak.Utilities.Tweaks
internal static void UseСonfidentiality(string tweak, bool isChoose)
{
- INIManager.userTweaksConfidentiality.Remove(tweak);
- INIManager.userTweaksConfidentiality.Add(tweak, Convert.ToString(isChoose));
+ INIManager.UserTweaksConfidentiality.Remove(tweak);
+ INIManager.UserTweaksConfidentiality.Add(tweak, Convert.ToString(isChoose));
switch (tweak)
{
@@ -297,25 +297,25 @@ namespace GTweak.Utilities.Tweaks
{
RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\Diagtrack-Listener", "Start", 0, RegistryValueKind.DWord);
RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Attachments", "SaveZoneInformation", 1, RegistryValueKind.DWord);
- DisablingTasks(telemetryTasks);
+ DisablingTasks(TelemetryTasks);
}
else
{
RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\Diagtrack-Listener", "Start", 1, RegistryValueKind.DWord);
RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Attachments", "SaveZoneInformation");
- EnablingTasks(telemetryTasks);
+ EnablingTasks(TelemetryTasks);
}
break;
case "TglButton4":
if (isChoose)
{
- new Thread(() => DisablingTasks(schedulerTasks)).Start();
- new Thread(() => DisablingTasks(schedulerTasks)).IsBackground = true;
+ new Thread(() => DisablingTasks(SchedulerTasks)).Start();
+ new Thread(() => DisablingTasks(SchedulerTasks)).IsBackground = true;
}
else
{
- new Thread(() => EnablingTasks(schedulerTasks)).Start();
- new Thread(() => EnablingTasks(schedulerTasks)).IsBackground = true;
+ new Thread(() => EnablingTasks(SchedulerTasks)).Start();
+ new Thread(() => EnablingTasks(SchedulerTasks)).IsBackground = true;
}
break;
case "TglButton5":
@@ -367,7 +367,7 @@ namespace GTweak.Utilities.Tweaks
case "TglButton9":
if (isChoose)
{
- BlockSpyDomain(isChoose);
+ BlockSpyDomain(true);
try { File.Delete(Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts (Default GTweak)"); }
catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
@@ -388,7 +388,7 @@ namespace GTweak.Utilities.Tweaks
{
try
{
- BlockSpyDomain(isChoose);
+ 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)");
}
@@ -469,12 +469,12 @@ namespace GTweak.Utilities.Tweaks
if (isChoose)
{
RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\NvTelemetryContainer", "Start", 4, RegistryValueKind.DWord);
- DisablingTasks(nvidiaTasks);
+ DisablingTasks(NvidiaTasks);
}
else
{
RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\NvTelemetryContainer", "Start", 2, RegistryValueKind.DWord);
- EnablingTasks(nvidiaTasks);
+ EnablingTasks(NvidiaTasks);
}
break;
case "TglButton18":
@@ -493,20 +493,20 @@ namespace GTweak.Utilities.Tweaks
}
- private static void EnablingTasks(string[] _tasklist)
+ private static void EnablingTasks(string[] tasklist)
{
Parallel.Invoke(() =>
{
Microsoft.Win32.TaskScheduler.TaskService taskService = new Microsoft.Win32.TaskScheduler.TaskService();
- foreach (string taskname in _tasklist)
+ foreach (string taskname in tasklist)
{
- Microsoft.Win32.TaskScheduler.Task _task = taskService.GetTask(taskname);
- if (_task != null)
+ Microsoft.Win32.TaskScheduler.Task task = taskService.GetTask(taskname);
+ if (task != null)
{
- if (!_task.Enabled)
+ if (!task.Enabled)
{
- _task.Definition.Settings.Enabled = true;
- _task.RegisterChanges();
+ task.Definition.Settings.Enabled = true;
+ task.RegisterChanges();
}
}
@@ -514,20 +514,20 @@ namespace GTweak.Utilities.Tweaks
});
}
- private static void DisablingTasks(string[] _tasklist)
+ private static void DisablingTasks(string[] tasklist)
{
Parallel.Invoke(() =>
{
Microsoft.Win32.TaskScheduler.TaskService taskService = new Microsoft.Win32.TaskScheduler.TaskService();
- foreach (string taskname in _tasklist)
+ foreach (string taskname in tasklist)
{
- Microsoft.Win32.TaskScheduler.Task _task = taskService.GetTask(taskname);
- if (_task != null)
+ Microsoft.Win32.TaskScheduler.Task task = taskService.GetTask(taskname);
+ if (task != null)
{
- if (_task.Enabled)
+ if (task.Enabled)
{
- _task.Definition.Settings.Enabled = false;
- _task.RegisterChanges();
+ task.Definition.Settings.Enabled = false;
+ task.RegisterChanges();
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/Firewall.cs b/.Source/GTweak/Utilities/Tweaks/Firewall.cs
index 54732e4f..0fbec584 100644
--- a/.Source/GTweak/Utilities/Tweaks/Firewall.cs
+++ b/.Source/GTweak/Utilities/Tweaks/Firewall.cs
@@ -9,14 +9,14 @@ namespace GTweak.Utilities.Tweaks
{
internal abstract class Firewall
{
- private static readonly SortedList<string, string> nameRules = new SortedList<string, string>
+ private static readonly SortedList<string, string> NameRules = new SortedList<string, string>
{
["Update"] = @"GTweak - Windows Update blocking",
["Domain"] = @"GTweak - Spy domain names",
["WDefender"] = @"GTweak - Windows Defender blocking"
};
- private static readonly SortedList<string, string> programPaths = new SortedList<string, string>
+ private static readonly SortedList<string, string> ProgramPaths = 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"),
@@ -41,17 +41,17 @@ namespace GTweak.Utilities.Tweaks
{
try
{
- if (CheckRulesWindows(nameRules["Update"]) && isChoose)
+ if (CheckRulesWindows(NameRules["Update"]) && isChoose)
{
Parallel.Invoke(() => {
- AddRulesIN(isChoose, programPaths["MoUso_New"], nameRules["Update"]);
- AddRulesIN(isChoose, programPaths["MoUso_Old"], string.Concat(nameRules["Update"], " (Old Way)"));
- AddRulesIN(isChoose, programPaths["Uso"], string.Concat(nameRules["Update"], " (Update Orchestrator)"));
+ AddRulesIn(isChoose, ProgramPaths["MoUso_New"], NameRules["Update"]);
+ AddRulesIn(isChoose, ProgramPaths["MoUso_Old"], string.Concat(NameRules["Update"], " (Old Way)"));
+ AddRulesIn(isChoose, ProgramPaths["Uso"], string.Concat(NameRules["Update"], " (Update Orchestrator)"));
},
() => {
- AddRulesOUT(isChoose, programPaths["MoUso_New"], nameRules["Update"]);
- AddRulesOUT(isChoose, programPaths["MoUso_Old"], string.Concat(nameRules["Update"], " (Old Way)"));
- AddRulesOUT(isChoose, programPaths["Uso"], string.Concat(nameRules["Update"], " (Update Orchestrator)"));
+ AddRulesOut(isChoose, ProgramPaths["MoUso_New"], NameRules["Update"]);
+ AddRulesOut(isChoose, ProgramPaths["MoUso_Old"], string.Concat(NameRules["Update"], " (Old Way)"));
+ AddRulesOut(isChoose, ProgramPaths["Uso"], string.Concat(NameRules["Update"], " (Update Orchestrator)"));
});
}
else
@@ -60,16 +60,16 @@ namespace GTweak.Utilities.Tweaks
{
try
{
- AddRulesIN(isChoose, programPaths["MoUso_New"], nameRules["Update"]);
- AddRulesIN(isChoose, programPaths["MoUso_Old"], string.Concat(nameRules["Update"], " (Old Way)"));
- AddRulesIN(isChoose, programPaths["Uso"], string.Concat(nameRules["Update"], " (Update Orchestrator)"));
+ AddRulesIn(isChoose, ProgramPaths["MoUso_New"], NameRules["Update"]);
+ AddRulesIn(isChoose, ProgramPaths["MoUso_Old"], string.Concat(NameRules["Update"], " (Old Way)"));
+ AddRulesIn(isChoose, ProgramPaths["Uso"], string.Concat(NameRules["Update"], " (Update Orchestrator)"));
}
catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
try
{
- AddRulesOUT(isChoose, programPaths["MoUso_New"], nameRules["Update"]);
- AddRulesOUT(isChoose, programPaths["MoUso_Old"], string.Concat(nameRules["Update"], " (Old Way)"));
- AddRulesOUT(isChoose, programPaths["Uso"], string.Concat(nameRules["Update"], " (Update Orchestrator)"));
+ AddRulesOut(isChoose, ProgramPaths["MoUso_New"], NameRules["Update"]);
+ AddRulesOut(isChoose, ProgramPaths["MoUso_Old"], string.Concat(NameRules["Update"], " (Old Way)"));
+ AddRulesOut(isChoose, ProgramPaths["Uso"], string.Concat(NameRules["Update"], " (Update Orchestrator)"));
}
catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
});
@@ -82,7 +82,7 @@ namespace GTweak.Utilities.Tweaks
}
}
- private static void AddRulesIN(in bool isChoose, in string pathProgram, in string nameRule, in string description = "Windows update blocking")
+ private static void AddRulesIn(in bool isChoose, in string pathProgram, in string nameRule, in string description = "Windows update blocking")
{
INetFwRule firewallRule = (INetFwRule)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FWRule"));
INetFwPolicy2 firewallPolicy = (INetFwPolicy2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));
@@ -104,7 +104,7 @@ namespace GTweak.Utilities.Tweaks
firewallPolicy.Rules.Remove(nameRule);
}
- private static void AddRulesOUT(in bool isChoose, in string pathProgram, in string nameRule, in string description = "Windows update blocking")
+ private static void AddRulesOut(in bool isChoose, in string pathProgram, in string nameRule, in string description = "Windows update blocking")
{
INetFwRule firewallRule = (INetFwRule)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FWRule"));
INetFwPolicy2 firewallPolicy = (INetFwPolicy2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));
@@ -132,7 +132,7 @@ namespace GTweak.Utilities.Tweaks
App.ViewLang();
try
{
- if (CheckRulesWindows(nameRules["Domain"]) && isChoose)
+ if (CheckRulesWindows(NameRules["Domain"]) && isChoose)
RulesHosts(isChoose);
else
{
@@ -173,15 +173,15 @@ namespace GTweak.Utilities.Tweaks
firewallRule.Description = "Spy domain names";
firewallRule.Enabled = true;
firewallRule.InterfaceTypes = "All";
- firewallRule.Name = nameRules["Domain"];
+ firewallRule.Name = NameRules["Domain"];
if (isChoose)
{
- firewallPolicy.Rules.Remove(nameRules["Domain"]);
+ firewallPolicy.Rules.Remove(NameRules["Domain"]);
firewallPolicy.Rules.Add(firewallRule);
}
else
- firewallPolicy.Rules.Remove(nameRules["Domain"]);
+ firewallPolicy.Rules.Remove(NameRules["Domain"]);
}
protected static void BlockWDefender(bool isChoose)
@@ -189,15 +189,15 @@ namespace GTweak.Utilities.Tweaks
App.ViewLang();
try
{
- if (CheckRulesWindows(nameRules["WDefender"]) && isChoose)
+ if (CheckRulesWindows(NameRules["WDefender"]) && isChoose)
{
- Parallel.Invoke(() => { AddRulesOUT(isChoose, programPaths["WD"], nameRules["WDefender"], "blocking Windows Defender database updates"); });
+ Parallel.Invoke(() => { AddRulesOut(isChoose, ProgramPaths["WD"], NameRules["WDefender"], "blocking Windows Defender database updates"); });
}
else
{
Parallel.Invoke(() =>
{
- try { AddRulesOUT(isChoose, programPaths["WD"], nameRules["WDefender"], "blocking Windows Defender database updates"); }
+ try { AddRulesOut(isChoose, ProgramPaths["WD"], NameRules["WDefender"], "blocking Windows Defender database updates"); }
catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
});
}
diff --git a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
index 3b5f223f..fe748f16 100644
--- a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
@@ -360,8 +360,8 @@ namespace GTweak.Utilities.Tweaks
internal static void UseInterface(string tweak, bool isChoose)
{
- INIManager.userTweaksInterface.Remove(tweak);
- INIManager.userTweaksInterface.Add(tweak, Convert.ToString(isChoose));
+ INIManager.UserTweaksInterface.Remove(tweak);
+ INIManager.UserTweaksInterface.Add(tweak, Convert.ToString(isChoose));
switch (tweak)
{
@@ -456,8 +456,8 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseHoverTime", "400", RegistryValueKind.String);
break;
case "TglButton11":
- Environment.SpecialFolder _folderWindows = Environment.SpecialFolder.Windows;
- string _pathToWinF = Environment.GetFolderPath(_folderWindows);
+ Environment.SpecialFolder folderWindows = Environment.SpecialFolder.Windows;
+ string pathToWinF = Environment.GetFolderPath(folderWindows);
try
{
if (isChoose)
@@ -470,13 +470,13 @@ namespace GTweak.Utilities.Tweaks
gz.CopyTo(ms);
_iconByte = ms.ToArray();
}
- File.WriteAllBytes(_pathToWinF + @"\Blank.ico", _iconByte);
+ File.WriteAllBytes(pathToWinF + @"\Blank.ico", _iconByte);
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons", "29", @"%systemroot%\\Blank.ico,0", RegistryValueKind.String);
}
else
{
- File.Delete(_pathToWinF + @"\Blank.ico");
+ File.Delete(pathToWinF + @"\Blank.ico");
RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons");
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/RecoveryPoint.cs b/.Source/GTweak/Utilities/Tweaks/RecoveryPoint.cs
index 07be9972..9c3673ad 100644
--- a/.Source/GTweak/Utilities/Tweaks/RecoveryPoint.cs
+++ b/.Source/GTweak/Utilities/Tweaks/RecoveryPoint.cs
@@ -30,15 +30,15 @@ namespace GTweak.Utilities.Tweaks
{
RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore");
- Microsoft.Win32.TaskScheduler.TaskService _taskService = new Microsoft.Win32.TaskScheduler.TaskService();
- Microsoft.Win32.TaskScheduler.Task _task = _taskService.GetTask(@"Microsoft\Windows\SystemRestore\SR");
+ Microsoft.Win32.TaskScheduler.TaskService taskService = new Microsoft.Win32.TaskScheduler.TaskService();
+ Microsoft.Win32.TaskScheduler.Task task = taskService.GetTask(@"Microsoft\Windows\SystemRestore\SR");
- if (_task != null)
+ if (task != null)
{
- if (_task.Enabled)
+ if (task.Enabled)
{
- _task.Definition.Settings.Enabled = true;
- _task.RegisterChanges();
+ task.Definition.Settings.Enabled = true;
+ task.RegisterChanges();
}
}
@@ -110,15 +110,15 @@ namespace GTweak.Utilities.Tweaks
internal static void DisablePoint()
{
- Microsoft.Win32.TaskScheduler.TaskService _taskService = new Microsoft.Win32.TaskScheduler.TaskService();
- Microsoft.Win32.TaskScheduler.Task _task = _taskService.GetTask(@"Microsoft\Windows\SystemRestore\SR");
+ Microsoft.Win32.TaskScheduler.TaskService taskService = new Microsoft.Win32.TaskScheduler.TaskService();
+ Microsoft.Win32.TaskScheduler.Task task = taskService.GetTask(@"Microsoft\Windows\SystemRestore\SR");
- if (_task != null)
+ if (task != null)
{
- if (_task.Enabled)
+ if (task.Enabled)
{
- _task.Definition.Settings.Enabled = false;
- _task.RegisterChanges();
+ task.Definition.Settings.Enabled = false;
+ task.RegisterChanges();
}
}
@@ -139,14 +139,14 @@ namespace GTweak.Utilities.Tweaks
DisableSR(Settings.PathSystemDisk + @"\\");
}
- private static string StartPowerShell(string _arguments)
+ private static string StartPowerShell(string arguments)
{
Parallel.Invoke(() =>
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = @"powershell.exe",
- Arguments = _arguments,
+ Arguments = arguments,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
diff --git a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
index 4b833a7b..715abe2c 100644
--- a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
@@ -364,8 +364,8 @@ namespace GTweak.Utilities.Tweaks
internal static void UseServices(string tweak, bool isChoose)
{
- INIManager.userTweaksServices.Remove(tweak);
- INIManager.userTweaksServices.Add(tweak, Convert.ToString(isChoose));
+ INIManager.UserTweaksServices.Remove(tweak);
+ INIManager.UserTweaksServices.Add(tweak, Convert.ToString(isChoose));
switch (tweak)
{
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemData.cs b/.Source/GTweak/Utilities/Tweaks/SystemData.cs
index 21de35db..737ebce0 100644
--- a/.Source/GTweak/Utilities/Tweaks/SystemData.cs
+++ b/.Source/GTweak/Utilities/Tweaks/SystemData.cs
@@ -1,6 +1,4 @@
-using Microsoft.Win32;
-using Newtonsoft.Json;
-using System;
+using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Management;
@@ -12,8 +10,10 @@ 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
+namespace GTweak.Utilities.Tweaks
{
internal sealed class SystemData
{
@@ -23,12 +23,12 @@ namespace GTweak.Utilities
{
try
{
- RegistryKey _regKey = default, _ourKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users", true);
+ RegistryKey regKey = default, ourKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users", true);
- foreach (string keyname in _ourKey.GetSubKeyNames())
- _regKey = _ourKey.OpenSubKey(keyname);
+ foreach (string keyname in ourKey!.GetSubKeyNames())
+ regKey = ourKey!.OpenSubKey(keyname);
- return new BitmapImage(new Uri(_regKey?.GetValue("Image1080").ToString() ?? string.Empty));
+ return new BitmapImage(new Uri(regKey?.GetValue("Image1080").ToString() ?? string.Empty));
}
catch { return null; }
}
@@ -233,12 +233,12 @@ namespace GTweak.Utilities
{
try {
TimeSpan timeout = TimeSpan.FromSeconds(5.0);
- Task<IPAddress> _task = Task.Run(() => {
+ Task<IPAddress> task = Task.Run(() => {
return !string.IsNullOrEmpty(Dns.GetHostEntry("google.com").AddressList[0].ToString())
? Dns.GetHostEntry("google.com").AddressList[0]
: Dns.GetHostEntry("baidu.com").AddressList[0];
});
- if (!_task.Wait(timeout))
+ if (!task.Wait(timeout))
return false;
return true;
}
@@ -271,24 +271,24 @@ namespace GTweak.Utilities
if (isConnectionBlock)
isConnectionBlock = false;
- if (IPAddress.TryParse(clientInternetProtocol.Ip, out IPAddress ip) && !string.IsNullOrEmpty(clientInternetProtocol.Ip) && !string.IsNullOrEmpty(clientInternetProtocol.Country))
+ if (IPAddress.TryParse(clientInternetProtocol.Ip, out _) && !string.IsNullOrEmpty(clientInternetProtocol.Ip) && !string.IsNullOrEmpty(clientInternetProtocol.Country))
{
+ isConnectionLose = false;
СonfigurationData["IpAddress"] = clientInternetProtocol.Ip + " (" + clientInternetProtocol.Country + ")";
- isConnectionLose = false && isConnectionLose;
}
else
{
App.ViewLang();
- СonfigurationData["IpAddress"] = (string)Application.Current.Resources["connection_block_systemInformation"];
isConnectionBlock = true;
+ СonfigurationData["IpAddress"] = (string)Application.Current.Resources["connection_block_systemInformation"];
}
}
}
else
{
App.ViewLang();
- СonfigurationData["IpAddress"] = (string)Application.Current.Resources["connection_lose_systemInformation"];
isConnectionLose = true;
+ СonfigurationData["IpAddress"] = (string)Application.Current.Resources["connection_lose_systemInformation"];
}
});
}
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
index 43b6350d..c2247c57 100644
--- a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
@@ -342,8 +342,8 @@ namespace GTweak.Utilities.Tweaks
private static extern bool SystemParametersInfo(uint _uiAction, uint _uiParam, uint[] _pvParam, uint _fWinIni);
internal static void UseSystem(string tweak, bool isChoose)
{
- INIManager.userTweaksSystem.Remove(tweak);
- INIManager.userTweaksSystem.Add(tweak, Convert.ToString(isChoose));
+ INIManager.UserTweaksSystem.Remove(tweak);
+ INIManager.UserTweaksSystem.Add(tweak, Convert.ToString(isChoose));
switch (tweak)
{
diff --git a/.Source/GTweak/Utilities/Tweaks/UninstallingApps.cs b/.Source/GTweak/Utilities/Tweaks/UninstallingApps.cs
index 837399c2..cec24d5b 100644
--- a/.Source/GTweak/Utilities/Tweaks/UninstallingApps.cs
+++ b/.Source/GTweak/Utilities/Tweaks/UninstallingApps.cs
@@ -14,7 +14,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;
- internal static Dictionary<string, bool> isAppDeletedList = new Dictionary<string, bool>
+ internal static Dictionary<string, bool> IsAppDeletedList = new Dictionary<string, bool>
{
["MicrosoftStore"] = false,
["Todos"] = false,
@@ -57,7 +57,7 @@ namespace GTweak.Utilities.Tweaks
["QuickAssist"] = false
};
- internal static readonly SortedList<string, List<string>> listAppsScipt = new SortedList<string, List<string>>
+ internal static readonly SortedList<string, List<string>> ListAppsScipt = new SortedList<string, List<string>>
{
["MicrosoftStore"] = new List<string>(1) { "Microsoft.WindowsStore" },
["Todos"] = new List<string>(1) { "Microsoft.Todos" },
@@ -98,7 +98,7 @@ namespace GTweak.Utilities.Tweaks
["Outlook"] = new List<string>(1) { "Microsoft.OutlookForWindows" },
["QuickAssist"] = new List<string>(1) { "MicrosoftCorporationII.QuickAssist" }
};
- private static readonly SortedList<string, string> alternativeName = new SortedList<string, string>
+ private static readonly SortedList<string, string> AlternativeName = new SortedList<string, string>
{
["MicrosoftSolitaireCollection"] = "solitaire",
["MicrosoftOfficeHub"] = "officehub",
@@ -148,14 +148,14 @@ namespace GTweak.Utilities.Tweaks
process.StartInfo.Arguments = "Get-AppxProvisionedPackage -online | where-object {$_.PackageName -like '*" + appName + "*'} | Remove-AppxProvisionedPackage -alluser -online –Verbose";
process.Start();
- foreach (var appDelete in listAppsScipt[appName])
+ foreach (var appDelete in ListAppsScipt[appName])
{
process.StartInfo.Arguments = string.Format("Get-AppxPackage -Name " + appDelete + " -AllUsers | Remove-AppxPackage");
process.Start();
}
- if (!string.IsNullOrEmpty(alternativeName[appName]))
- process.StartInfo.Arguments = "Get-AppxProvisionedPackage -online | where-object {$_.PackageName -like '*" + !string.IsNullOrEmpty(alternativeName[appName]) + "*'} | Remove-AppxProvisionedPackage -alluser -online –Verbose";
+ if (!string.IsNullOrEmpty(AlternativeName[appName]))
+ process.StartInfo.Arguments = "Get-AppxProvisionedPackage -online | where-object {$_.PackageName -like '*" + !string.IsNullOrEmpty(AlternativeName[appName]) + "*'} | Remove-AppxProvisionedPackage -alluser -online –Verbose";
process.WaitForExit();
process.Dispose();
@@ -190,7 +190,7 @@ namespace GTweak.Utilities.Tweaks
process.EnableRaisingEvents = true;
process.StartInfo.FileName = "powershell.exe";
- foreach (var appNm in listAppsScipt)
+ foreach (var appNm in ListAppsScipt)
{
process.StartInfo.Arguments = "Get-AppxProvisionedPackage -online | where-object {$_.PackageName -like '*" + appNm + "*'} | Remove-AppxProvisionedPackage -alluser -online –Verbose";
process.Start();
@@ -201,7 +201,7 @@ namespace GTweak.Utilities.Tweaks
process.Start();
}
- foreach (string altName in alternativeName.Values)
+ foreach (string altName in AlternativeName.Values)
{
process.StartInfo.Arguments = "Get-AppxProvisionedPackage -online | where-object {$_.PackageName -like '*" + altName + "*'} | Remove-AppxProvisionedPackage -alluser -online –Verbose";
process.Start();
@@ -276,7 +276,7 @@ namespace GTweak.Utilities.Tweaks
internal static void ResetOneDrive()
{
- isAppDeletedList["OneDrive"] = true;
+ IsAppDeletedList["OneDrive"] = true;
using (Process process = new Process())
{
diff --git a/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs b/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs
index dd896439..649ca3cd 100644
--- a/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs
+++ b/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs
@@ -349,35 +349,39 @@ namespace GTweak.Utilities.Tweaks
private void KillProcess(string getName)
{
- foreach (Process _process in Process.GetProcessesByName(getName))
+ foreach (Process process in Process.GetProcessesByName(getName))
{
- try { _process.Kill();}
+ try { process.Kill();}
catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
}
}
- private string RunPowerShellCommand(string command) => RunProcess(Path.Combine(Environment.SystemDirectory, @"WindowsPowerShell\v1.0\powershell.exe"), "-NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -EncodedCommand \"" + Convert.ToBase64String(Encoding.Unicode.GetBytes(command)) + "\"");
+ private void RunPowerShellCommand(string command)
+ {
+ RunProcess(Path.Combine(Environment.SystemDirectory, @"WindowsPowerShell\v1.0\powershell.exe"),
+ "-NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -EncodedCommand \"" +
+ Convert.ToBase64String(Encoding.Unicode.GetBytes(command)) + "\"");
+ }
private void RunCmdCommand(string command) => RunProcess(Path.Combine(Environment.SystemDirectory, "Cmd.exe"), "/d /q /c " + command);
- private string RunProcess(string _path, string _arguments)
+ private void RunProcess(string path, string arguments)
{
try
{
Process comandoAEjecutar = new Process();
- comandoAEjecutar.StartInfo.FileName = _path;
- comandoAEjecutar.StartInfo.Arguments = _arguments;
+ comandoAEjecutar.StartInfo.FileName = path;
+ comandoAEjecutar.StartInfo.Arguments = arguments;
comandoAEjecutar.StartInfo.UseShellExecute = false;
comandoAEjecutar.StartInfo.RedirectStandardOutput = true;
comandoAEjecutar.StartInfo.RedirectStandardError = true;
comandoAEjecutar.StartInfo.CreateNoWindow = true;
comandoAEjecutar.Start();
- return comandoAEjecutar.StandardOutput.ReadToEnd();
+ comandoAEjecutar.StandardOutput.ReadToEnd();
+ return;
}
catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
-
- return null;
}
private void EnableTask(string path) => SetTask(path, "/Enable");
diff --git a/.Source/GTweak/View/ApplicationsView.xaml.cs b/.Source/GTweak/View/ApplicationsView.xaml.cs
index 175b9185..82ccd3f8 100644
--- a/.Source/GTweak/View/ApplicationsView.xaml.cs
+++ b/.Source/GTweak/View/ApplicationsView.xaml.cs
@@ -53,12 +53,12 @@ namespace GTweak.View
{
if (applicationName != "YandexMusic")
{
- UninstallingApps.isAppDeletedList[applicationName] = true;
+ UninstallingApps.IsAppDeletedList[applicationName] = true;
UninstallingApps.DeletedApp(applicationName);
}
else
{
- UninstallingApps.isAppDeletedList["Yandex.Music"] = true;
+ UninstallingApps.IsAppDeletedList["Yandex.Music"] = true;
UninstallingApps.DeletedApp("Yandex.Music");
}
};
@@ -66,9 +66,9 @@ namespace GTweak.View
{
await Task.Delay(25000);
if (applicationName != "YandexMusic")
- UninstallingApps.isAppDeletedList[appImage.Name] = false;
+ UninstallingApps.IsAppDeletedList[appImage.Name] = false;
else
- UninstallingApps.isAppDeletedList["Yandex.Music"] = false;
+ UninstallingApps.IsAppDeletedList["Yandex.Music"] = false;
UpdateViewStateApps();
backgroundWorker.Dispose();
};
@@ -85,7 +85,7 @@ namespace GTweak.View
backgroundWorker.RunWorkerCompleted += async delegate
{
await Task.Delay(15000);
- UninstallingApps.isAppDeletedList[appImage.Name] = false;
+ UninstallingApps.IsAppDeletedList[appImage.Name] = false;
UpdateViewStateApps();
backgroundWorker.Dispose();
};
@@ -97,9 +97,9 @@ namespace GTweak.View
{
if (e.LeftButton == MouseButtonState.Pressed)
{
- foreach (string key in UninstallingApps.isAppDeletedList.Keys.ToList())
+ foreach (string key in UninstallingApps.IsAppDeletedList.Keys.ToList())
{
- UninstallingApps.isAppDeletedList[key] = true;
+ UninstallingApps.IsAppDeletedList[key] = true;
UpdateViewStateApps();
}
@@ -112,9 +112,9 @@ namespace GTweak.View
backgroundWorker.RunWorkerCompleted += async delegate
{
await Task.Delay(60000);
- foreach (string key in UninstallingApps.isAppDeletedList.Keys.ToList())
+ foreach (string key in UninstallingApps.IsAppDeletedList.Keys.ToList())
{
- UninstallingApps.isAppDeletedList[key] = false;
+ UninstallingApps.IsAppDeletedList[key] = false;
UpdateViewStateApps();
}
backgroundWorker.Dispose();
@@ -149,46 +149,46 @@ namespace GTweak.View
private void UpdateViewStateApps()
{
- MicrosoftStore.Source = !UninstallingApps.isAppDeletedList["MicrosoftStore"] ? UninstallingApps.UserAppsList.Contains("Microsoft.WindowsStore") ? (DrawingImage)FindResource("A_DI_MicrosoftStore") : (DrawingImage)FindResource("DA_DI_MicrosoftStore") : (DrawingImage)FindResource("DI_Sandtime");
- Todos.Source = !UninstallingApps.isAppDeletedList["Todos"] ? UninstallingApps.UserAppsList.Contains("Microsoft.Todos") ? (DrawingImage)FindResource("A_DI_Todos") : (DrawingImage)FindResource("DA_DI_Todos") : (DrawingImage)FindResource("DI_Sandtime");
- BingWeather.Source = !UninstallingApps.isAppDeletedList["BingWeather"] ? UninstallingApps.UserAppsList.Contains("Microsoft.BingWeather") ? (DrawingImage)FindResource("A_DI_BingWeather") : (DrawingImage)FindResource("DA_DI_BingWeather") : (DrawingImage)FindResource("DI_Sandtime");
- Microsoft3D.Source = !UninstallingApps.isAppDeletedList["Microsoft3D"] ? UninstallingApps.UserAppsList.Contains("Microsoft.Microsoft3DViewer") ? (DrawingImage)FindResource("A_DI_Microsoft3D") : (DrawingImage)FindResource("DA_DI_Microsoft3D") : (DrawingImage)FindResource("DI_Sandtime");
- Music.Source = !UninstallingApps.isAppDeletedList["Music"] ? UninstallingApps.UserAppsList.Contains("Microsoft.ZuneMusic") ? (DrawingImage)FindResource("A_DI_Music") : (DrawingImage)FindResource("DA_DI_Music") : (DrawingImage)FindResource("DI_Sandtime");
- GetHelp.Source = !UninstallingApps.isAppDeletedList["GetHelp"] ? UninstallingApps.UserAppsList.Contains("Microsoft.GetHelp") ? (DrawingImage)FindResource("A_DI_GetHelp") : (DrawingImage)FindResource("DA_DI_GetHelp") : (DrawingImage)FindResource("DI_Sandtime");
- MicrosoftOfficeHub.Source = !UninstallingApps.isAppDeletedList["MicrosoftOfficeHub"] ? UninstallingApps.UserAppsList.Contains("Microsoft.MicrosoftOfficeHub") || UninstallingApps.UserAppsList.Contains("Microsoft.OutlookForWindows") ? (DrawingImage)FindResource("A_DI_MicrosoftOfficeHub") : (DrawingImage)FindResource("DA_DI_MicrosoftOfficeHub") : (DrawingImage)FindResource("DI_Sandtime");
- MicrosoftSolitaireCollection.Source = !UninstallingApps.isAppDeletedList["MicrosoftSolitaireCollection"] ? UninstallingApps.UserAppsList.Contains("Microsoft.MicrosoftSolitaireCollection") ? (DrawingImage)FindResource("A_DI_MicrosoftSolitaireCollection") : (DrawingImage)FindResource("DA_DI_MicrosoftSolitaireCollection") : (DrawingImage)FindResource("DI_Sandtime"); MixedReality.Source = !UninstallingApps.isAppDeletedList["MixedReality"] ? UninstallingApps.UserAppsList.Contains("Microsoft.MixedReality.Portal") ? (DrawingImage)FindResource("A_DI_MixedReality") : (DrawingImage)FindResource("DA_DI_MixedReality") : (DrawingImage)FindResource("DI_Sandtime");
- Xbox.Source = !UninstallingApps.isAppDeletedList["Xbox"] ? UninstallingApps.UserAppsList.Contains("Microsoft.XboxApp") || UninstallingApps.UserAppsList.Contains("Microsoft.GamingApp") || UninstallingApps.UserAppsList.Contains("Microsoft.XboxGamingOverlay") ||
+ MicrosoftStore.Source = !UninstallingApps.IsAppDeletedList["MicrosoftStore"] ? UninstallingApps.UserAppsList.Contains("Microsoft.WindowsStore") ? (DrawingImage)FindResource("A_DI_MicrosoftStore") : (DrawingImage)FindResource("DA_DI_MicrosoftStore") : (DrawingImage)FindResource("DI_Sandtime");
+ Todos.Source = !UninstallingApps.IsAppDeletedList["Todos"] ? UninstallingApps.UserAppsList.Contains("Microsoft.Todos") ? (DrawingImage)FindResource("A_DI_Todos") : (DrawingImage)FindResource("DA_DI_Todos") : (DrawingImage)FindResource("DI_Sandtime");
+ BingWeather.Source = !UninstallingApps.IsAppDeletedList["BingWeather"] ? UninstallingApps.UserAppsList.Contains("Microsoft.BingWeather") ? (DrawingImage)FindResource("A_DI_BingWeather") : (DrawingImage)FindResource("DA_DI_BingWeather") : (DrawingImage)FindResource("DI_Sandtime");
+ Microsoft3D.Source = !UninstallingApps.IsAppDeletedList["Microsoft3D"] ? UninstallingApps.UserAppsList.Contains("Microsoft.Microsoft3DViewer") ? (DrawingImage)FindResource("A_DI_Microsoft3D") : (DrawingImage)FindResource("DA_DI_Microsoft3D") : (DrawingImage)FindResource("DI_Sandtime");
+ Music.Source = !UninstallingApps.IsAppDeletedList["Music"] ? UninstallingApps.UserAppsList.Contains("Microsoft.ZuneMusic") ? (DrawingImage)FindResource("A_DI_Music") : (DrawingImage)FindResource("DA_DI_Music") : (DrawingImage)FindResource("DI_Sandtime");
+ GetHelp.Source = !UninstallingApps.IsAppDeletedList["GetHelp"] ? UninstallingApps.UserAppsList.Contains("Microsoft.GetHelp") ? (DrawingImage)FindResource("A_DI_GetHelp") : (DrawingImage)FindResource("DA_DI_GetHelp") : (DrawingImage)FindResource("DI_Sandtime");
+ MicrosoftOfficeHub.Source = !UninstallingApps.IsAppDeletedList["MicrosoftOfficeHub"] ? UninstallingApps.UserAppsList.Contains("Microsoft.MicrosoftOfficeHub") || UninstallingApps.UserAppsList.Contains("Microsoft.OutlookForWindows") ? (DrawingImage)FindResource("A_DI_MicrosoftOfficeHub") : (DrawingImage)FindResource("DA_DI_MicrosoftOfficeHub") : (DrawingImage)FindResource("DI_Sandtime");
+ MicrosoftSolitaireCollection.Source = !UninstallingApps.IsAppDeletedList["MicrosoftSolitaireCollection"] ? UninstallingApps.UserAppsList.Contains("Microsoft.MicrosoftSolitaireCollection") ? (DrawingImage)FindResource("A_DI_MicrosoftSolitaireCollection") : (DrawingImage)FindResource("DA_DI_MicrosoftSolitaireCollection") : (DrawingImage)FindResource("DI_Sandtime"); MixedReality.Source = !UninstallingApps.IsAppDeletedList["MixedReality"] ? UninstallingApps.UserAppsList.Contains("Microsoft.MixedReality.Portal") ? (DrawingImage)FindResource("A_DI_MixedReality") : (DrawingImage)FindResource("DA_DI_MixedReality") : (DrawingImage)FindResource("DI_Sandtime");
+ Xbox.Source = !UninstallingApps.IsAppDeletedList["Xbox"] ? UninstallingApps.UserAppsList.Contains("Microsoft.XboxApp") || UninstallingApps.UserAppsList.Contains("Microsoft.GamingApp") || UninstallingApps.UserAppsList.Contains("Microsoft.XboxGamingOverlay") ||
UninstallingApps.UserAppsList.Contains("Microsoft.XboxGameOverlay") || UninstallingApps.UserAppsList.Contains("Microsoft.XboxIdentityProvider") || UninstallingApps.UserAppsList.Contains("Microsoft.Xbox.TCUI") ||
UninstallingApps.UserAppsList.Contains("Microsoft.XboxSpeechToTextOverlay") ? (DrawingImage)FindResource("A_DI_Xbox") : (DrawingImage)FindResource("DA_DI_Xbox") : (DrawingImage)FindResource("DI_Sandtime");
- Paint3D.Source = !UninstallingApps.isAppDeletedList["Paint3D"] ? UninstallingApps.UserAppsList.Contains("Microsoft.MSPaint") || UninstallingApps.UserAppsList.Contains("Microsoft.Paint") ? (DrawingImage)FindResource("A_DI_Paint3D") : (DrawingImage)FindResource("DA_DI_Paint3D") : (DrawingImage)FindResource("DI_Sandtime");
- OneNote.Source = !UninstallingApps.isAppDeletedList["OneNote"] ? UninstallingApps.UserAppsList.Contains("Microsoft.Office.OneNote") ? (DrawingImage)FindResource("A_DI_OneNote") : (DrawingImage)FindResource("DA_DI_OneNote") : (DrawingImage)FindResource("DI_Sandtime");
- People.Source = !UninstallingApps.isAppDeletedList["People"] ? UninstallingApps.UserAppsList.Contains("Microsoft.People") ? (DrawingImage)FindResource("A_DI_People") : (DrawingImage)FindResource("DA_DI_People") : (DrawingImage)FindResource("DI_Sandtime");
- MicrosoftStickyNotes.Source = !UninstallingApps.isAppDeletedList["MicrosoftStickyNotes"] ? UninstallingApps.UserAppsList.Contains("Microsoft.MicrosoftStickyNotes") ? (DrawingImage)FindResource("A_DI_MicrosoftStickyNotes") : (DrawingImage)FindResource("DA_DI_MicrosoftStickyNotes") : (DrawingImage)FindResource("DI_Sandtime");
- Widgets.Source = !UninstallingApps.isAppDeletedList["Widgets"] ? UninstallingApps.UserAppsList.Contains("MicrosoftWindows.Client.WebExperience") ? (DrawingImage)FindResource("A_DI_Widgets") : (DrawingImage)FindResource("DA_DI_Widgets") : (DrawingImage)FindResource("DI_Sandtime");
- ScreenSketch.Source = !UninstallingApps.isAppDeletedList["ScreenSketch"] ? UninstallingApps.UserAppsList.Contains("Microsoft.ScreenSketch") ? (DrawingImage)FindResource("A_DI_ScreenSketch") : (DrawingImage)FindResource("DA_DI_ScreenSketch") : (DrawingImage)FindResource("DI_Sandtime");
- Phone.Source = !UninstallingApps.isAppDeletedList["Phone"] ? UninstallingApps.UserAppsList.Contains("Microsoft.YourPhone") ? (DrawingImage)FindResource("A_DI_Phone") : (DrawingImage)FindResource("DA_DI_Phone") : (DrawingImage)FindResource("DI_Sandtime");
- Photos.Source = !UninstallingApps.isAppDeletedList["Photos"] ? UninstallingApps.UserAppsList.Contains("Microsoft.Windows.Photos") ? (DrawingImage)FindResource("A_DI_Photos") : (DrawingImage)FindResource("DA_DI_Photos") : (DrawingImage)FindResource("DI_Sandtime");
- FeedbackHub.Source = !UninstallingApps.isAppDeletedList["FeedbackHub"] ? UninstallingApps.UserAppsList.Contains("Microsoft.WindowsFeedbackHub") ? (DrawingImage)FindResource("A_DI_FeedbackHub") : (DrawingImage)FindResource("DA_DI_FeedbackHub") : (DrawingImage)FindResource("DI_Sandtime");
- SoundRecorder.Source = !UninstallingApps.isAppDeletedList["SoundRecorder"] ? UninstallingApps.UserAppsList.Contains("Microsoft.WindowsSoundRecorder") ? (DrawingImage)FindResource("A_DI_SoundRecorder") : (DrawingImage)FindResource("DA_DI_SoundRecorder") : (DrawingImage)FindResource("DI_Sandtime");
- Alarms.Source = !UninstallingApps.isAppDeletedList["Alarms"] ? UninstallingApps.UserAppsList.Contains("Microsoft.WindowsAlarms") ? (DrawingImage)FindResource("A_DI_Alarms") : (DrawingImage)FindResource("DA_DI_Alarms") : (DrawingImage)FindResource("DI_Sandtime");
- SkypeApp.Source = !UninstallingApps.isAppDeletedList["SkypeApp"] ? UninstallingApps.UserAppsList.Contains("Microsoft.SkypeApp") ? (DrawingImage)FindResource("A_DI_SkypeApp") : (DrawingImage)FindResource("DA_DI_SkypeApp") : (DrawingImage)FindResource("DI_Sandtime");
- Maps.Source = !UninstallingApps.isAppDeletedList["Maps"] ? UninstallingApps.UserAppsList.Contains("Microsoft.WindowsMaps") ? (DrawingImage)FindResource("A_DI_Maps") : (DrawingImage)FindResource("DA_DI_Maps") : (DrawingImage)FindResource("DI_Sandtime");
- Camera.Source = !UninstallingApps.isAppDeletedList["Camera"] ? UninstallingApps.UserAppsList.Contains("Microsoft.WindowsCamera") ? (DrawingImage)FindResource("A_DI_Camera") : (DrawingImage)FindResource("DA_DI_Camera") : (DrawingImage)FindResource("DI_Sandtime");
- Video.Source = !UninstallingApps.isAppDeletedList["Video"] ? UninstallingApps.UserAppsList.Contains("Microsoft.ZuneVideo") ? (DrawingImage)FindResource("A_DI_Video") : (DrawingImage)FindResource("DA_DI_Video") : (DrawingImage)FindResource("DI_Sandtime");
- BingNews.Source = !UninstallingApps.isAppDeletedList["BingNews"] ? UninstallingApps.UserAppsList.Contains("Microsoft.BingNews") ? (DrawingImage)FindResource("A_DI_BingNews") : (DrawingImage)FindResource("DA_DI_BingNews") : (DrawingImage)FindResource("DI_Sandtime");
- Mail.Source = !UninstallingApps.isAppDeletedList["Mail"] ? UninstallingApps.UserAppsList.Contains("microsoft.windowscommunicationsapps") ? (DrawingImage)FindResource("A_DI_Mail") : (DrawingImage)FindResource("DA_DI_Mail") : (DrawingImage)FindResource("DI_Sandtime");
- MicrosoftTeams.Source = !UninstallingApps.isAppDeletedList["MicrosoftTeams"] ? UninstallingApps.UserAppsList.Contains("MicrosoftTeams") ? (DrawingImage)FindResource("A_DI_MicrosoftTeams") : (DrawingImage)FindResource("DA_DI_MicrosoftTeams") : (DrawingImage)FindResource("DI_Sandtime");
- PowerAutomateDesktop.Source = !UninstallingApps.isAppDeletedList["PowerAutomateDesktop"] ? UninstallingApps.UserAppsList.Contains("Microsoft.PowerAutomateDesktop") ? (DrawingImage)FindResource("A_DI_PowerAutomateDesktop") : (DrawingImage)FindResource("DA_DI_PowerAutomateDesktop") : (DrawingImage)FindResource("DI_Sandtime");
- Cortana.Source = !UninstallingApps.isAppDeletedList["Cortana"] ? UninstallingApps.UserAppsList.Contains("Microsoft.549981C3F5F10") ? (DrawingImage)FindResource("A_DI_Cortana") : (DrawingImage)FindResource("DA_DI_Cortana") : (DrawingImage)FindResource("DI_Sandtime");
- ClipChamp.Source = !UninstallingApps.isAppDeletedList["ClipChamp"] ? UninstallingApps.UserAppsList.Contains("Clipchamp.Clipchamp") ? (DrawingImage)FindResource("A_DI_ClipChamp") : (DrawingImage)FindResource("DA_DI_ClipChamp") : (DrawingImage)FindResource("DI_Sandtime");
- GetStarted.Source = !UninstallingApps.isAppDeletedList["GetStarted"] ? UninstallingApps.UserAppsList.Contains("Microsoft.Getstarted") ? (DrawingImage)FindResource("A_DI_GetStarted") : (DrawingImage)FindResource("DA_DI_GetStarted") : (DrawingImage)FindResource("DI_Sandtime");
- OneDrive.Source = !UninstallingApps.isAppDeletedList["OneDrive"] ? UninstallingApps.IsOneDriveInstalled ? (DrawingImage)FindResource("A_DI_OneDrive") : (DrawingImage)FindResource("DA_DI_OneDrive") : (DrawingImage)FindResource("DI_Sandtime");
- BingSports.Source = !UninstallingApps.isAppDeletedList["BingSports"] ? UninstallingApps.UserAppsList.Contains("Microsoft.BingSports") ? (DrawingImage)FindResource("A_DI_BingSports") : (DrawingImage)FindResource("DA_DI_BingSports") : (DrawingImage)FindResource("DI_Sandtime");
- BingFinance.Source = !UninstallingApps.isAppDeletedList["BingFinance"] ? UninstallingApps.UserAppsList.Contains("Microsoft.BingFinance") ? (DrawingImage)FindResource("A_DI_BingFinance") : (DrawingImage)FindResource("DA_DI_BingFinance") : (DrawingImage)FindResource("DI_Sandtime");
- YandexMusic.Source = !UninstallingApps.isAppDeletedList["Yandex.Music"] ? UninstallingApps.UserAppsList.Contains("Yandex.Music") ? (DrawingImage)FindResource("A_DI_YandexMusic") : (DrawingImage)FindResource("DA_DI_YandexMusic") : (DrawingImage)FindResource("DI_Sandtime");
- Netflix.Source = !UninstallingApps.isAppDeletedList["Netflix"] ? UninstallingApps.UserAppsList.Contains("Netflix") ? (DrawingImage)FindResource("A_DI_Netflix") : (DrawingImage)FindResource("DA_DI_Netflix") : (DrawingImage)FindResource("DI_Sandtime");
- Outlook.Source = !UninstallingApps.isAppDeletedList["Outlook"] ? UninstallingApps.UserAppsList.Contains("Microsoft.OutlookForWindows") ? (DrawingImage)FindResource("A_DI_Outlook") : (DrawingImage)FindResource("DA_DI_Outlook") : (DrawingImage)FindResource("DI_Sandtime");
- QuickAssist.Source = !UninstallingApps.isAppDeletedList["QuickAssist"] ? UninstallingApps.UserAppsList.Contains("MicrosoftCorporationII.QuickAssist") ? (DrawingImage)FindResource("A_DI_QuickAssist") : (DrawingImage)FindResource("DA_DI_QuickAssist") : (DrawingImage)FindResource("DI_Sandtime");
+ Paint3D.Source = !UninstallingApps.IsAppDeletedList["Paint3D"] ? UninstallingApps.UserAppsList.Contains("Microsoft.MSPaint") || UninstallingApps.UserAppsList.Contains("Microsoft.Paint") ? (DrawingImage)FindResource("A_DI_Paint3D") : (DrawingImage)FindResource("DA_DI_Paint3D") : (DrawingImage)FindResource("DI_Sandtime");
+ OneNote.Source = !UninstallingApps.IsAppDeletedList["OneNote"] ? UninstallingApps.UserAppsList.Contains("Microsoft.Office.OneNote") ? (DrawingImage)FindResource("A_DI_OneNote") : (DrawingImage)FindResource("DA_DI_OneNote") : (DrawingImage)FindResource("DI_Sandtime");
+ People.Source = !UninstallingApps.IsAppDeletedList["People"] ? UninstallingApps.UserAppsList.Contains("Microsoft.People") ? (DrawingImage)FindResource("A_DI_People") : (DrawingImage)FindResource("DA_DI_People") : (DrawingImage)FindResource("DI_Sandtime");
+ MicrosoftStickyNotes.Source = !UninstallingApps.IsAppDeletedList["MicrosoftStickyNotes"] ? UninstallingApps.UserAppsList.Contains("Microsoft.MicrosoftStickyNotes") ? (DrawingImage)FindResource("A_DI_MicrosoftStickyNotes") : (DrawingImage)FindResource("DA_DI_MicrosoftStickyNotes") : (DrawingImage)FindResource("DI_Sandtime");
+ Widgets.Source = !UninstallingApps.IsAppDeletedList["Widgets"] ? UninstallingApps.UserAppsList.Contains("MicrosoftWindows.Client.WebExperience") ? (DrawingImage)FindResource("A_DI_Widgets") : (DrawingImage)FindResource("DA_DI_Widgets") : (DrawingImage)FindResource("DI_Sandtime");
+ ScreenSketch.Source = !UninstallingApps.IsAppDeletedList["ScreenSketch"] ? UninstallingApps.UserAppsList.Contains("Microsoft.ScreenSketch") ? (DrawingImage)FindResource("A_DI_ScreenSketch") : (DrawingImage)FindResource("DA_DI_ScreenSketch") : (DrawingImage)FindResource("DI_Sandtime");
+ Phone.Source = !UninstallingApps.IsAppDeletedList["Phone"] ? UninstallingApps.UserAppsList.Contains("Microsoft.YourPhone") ? (DrawingImage)FindResource("A_DI_Phone") : (DrawingImage)FindResource("DA_DI_Phone") : (DrawingImage)FindResource("DI_Sandtime");
+ Photos.Source = !UninstallingApps.IsAppDeletedList["Photos"] ? UninstallingApps.UserAppsList.Contains("Microsoft.Windows.Photos") ? (DrawingImage)FindResource("A_DI_Photos") : (DrawingImage)FindResource("DA_DI_Photos") : (DrawingImage)FindResource("DI_Sandtime");
+ FeedbackHub.Source = !UninstallingApps.IsAppDeletedList["FeedbackHub"] ? UninstallingApps.UserAppsList.Contains("Microsoft.WindowsFeedbackHub") ? (DrawingImage)FindResource("A_DI_FeedbackHub") : (DrawingImage)FindResource("DA_DI_FeedbackHub") : (DrawingImage)FindResource("DI_Sandtime");
+ SoundRecorder.Source = !UninstallingApps.IsAppDeletedList["SoundRecorder"] ? UninstallingApps.UserAppsList.Contains("Microsoft.WindowsSoundRecorder") ? (DrawingImage)FindResource("A_DI_SoundRecorder") : (DrawingImage)FindResource("DA_DI_SoundRecorder") : (DrawingImage)FindResource("DI_Sandtime");
+ Alarms.Source = !UninstallingApps.IsAppDeletedList["Alarms"] ? UninstallingApps.UserAppsList.Contains("Microsoft.WindowsAlarms") ? (DrawingImage)FindResource("A_DI_Alarms") : (DrawingImage)FindResource("DA_DI_Alarms") : (DrawingImage)FindResource("DI_Sandtime");
+ SkypeApp.Source = !UninstallingApps.IsAppDeletedList["SkypeApp"] ? UninstallingApps.UserAppsList.Contains("Microsoft.SkypeApp") ? (DrawingImage)FindResource("A_DI_SkypeApp") : (DrawingImage)FindResource("DA_DI_SkypeApp") : (DrawingImage)FindResource("DI_Sandtime");
+ Maps.Source = !UninstallingApps.IsAppDeletedList["Maps"] ? UninstallingApps.UserAppsList.Contains("Microsoft.WindowsMaps") ? (DrawingImage)FindResource("A_DI_Maps") : (DrawingImage)FindResource("DA_DI_Maps") : (DrawingImage)FindResource("DI_Sandtime");
+ Camera.Source = !UninstallingApps.IsAppDeletedList["Camera"] ? UninstallingApps.UserAppsList.Contains("Microsoft.WindowsCamera") ? (DrawingImage)FindResource("A_DI_Camera") : (DrawingImage)FindResource("DA_DI_Camera") : (DrawingImage)FindResource("DI_Sandtime");
+ Video.Source = !UninstallingApps.IsAppDeletedList["Video"] ? UninstallingApps.UserAppsList.Contains("Microsoft.ZuneVideo") ? (DrawingImage)FindResource("A_DI_Video") : (DrawingImage)FindResource("DA_DI_Video") : (DrawingImage)FindResource("DI_Sandtime");
+ BingNews.Source = !UninstallingApps.IsAppDeletedList["BingNews"] ? UninstallingApps.UserAppsList.Contains("Microsoft.BingNews") ? (DrawingImage)FindResource("A_DI_BingNews") : (DrawingImage)FindResource("DA_DI_BingNews") : (DrawingImage)FindResource("DI_Sandtime");
+ Mail.Source = !UninstallingApps.IsAppDeletedList["Mail"] ? UninstallingApps.UserAppsList.Contains("microsoft.windowscommunicationsapps") ? (DrawingImage)FindResource("A_DI_Mail") : (DrawingImage)FindResource("DA_DI_Mail") : (DrawingImage)FindResource("DI_Sandtime");
+ MicrosoftTeams.Source = !UninstallingApps.IsAppDeletedList["MicrosoftTeams"] ? UninstallingApps.UserAppsList.Contains("MicrosoftTeams") ? (DrawingImage)FindResource("A_DI_MicrosoftTeams") : (DrawingImage)FindResource("DA_DI_MicrosoftTeams") : (DrawingImage)FindResource("DI_Sandtime");
+ PowerAutomateDesktop.Source = !UninstallingApps.IsAppDeletedList["PowerAutomateDesktop"] ? UninstallingApps.UserAppsList.Contains("Microsoft.PowerAutomateDesktop") ? (DrawingImage)FindResource("A_DI_PowerAutomateDesktop") : (DrawingImage)FindResource("DA_DI_PowerAutomateDesktop") : (DrawingImage)FindResource("DI_Sandtime");
+ Cortana.Source = !UninstallingApps.IsAppDeletedList["Cortana"] ? UninstallingApps.UserAppsList.Contains("Microsoft.549981C3F5F10") ? (DrawingImage)FindResource("A_DI_Cortana") : (DrawingImage)FindResource("DA_DI_Cortana") : (DrawingImage)FindResource("DI_Sandtime");
+ ClipChamp.Source = !UninstallingApps.IsAppDeletedList["ClipChamp"] ? UninstallingApps.UserAppsList.Contains("Clipchamp.Clipchamp") ? (DrawingImage)FindResource("A_DI_ClipChamp") : (DrawingImage)FindResource("DA_DI_ClipChamp") : (DrawingImage)FindResource("DI_Sandtime");
+ GetStarted.Source = !UninstallingApps.IsAppDeletedList["GetStarted"] ? UninstallingApps.UserAppsList.Contains("Microsoft.Getstarted") ? (DrawingImage)FindResource("A_DI_GetStarted") : (DrawingImage)FindResource("DA_DI_GetStarted") : (DrawingImage)FindResource("DI_Sandtime");
+ OneDrive.Source = !UninstallingApps.IsAppDeletedList["OneDrive"] ? UninstallingApps.IsOneDriveInstalled ? (DrawingImage)FindResource("A_DI_OneDrive") : (DrawingImage)FindResource("DA_DI_OneDrive") : (DrawingImage)FindResource("DI_Sandtime");
+ BingSports.Source = !UninstallingApps.IsAppDeletedList["BingSports"] ? UninstallingApps.UserAppsList.Contains("Microsoft.BingSports") ? (DrawingImage)FindResource("A_DI_BingSports") : (DrawingImage)FindResource("DA_DI_BingSports") : (DrawingImage)FindResource("DI_Sandtime");
+ BingFinance.Source = !UninstallingApps.IsAppDeletedList["BingFinance"] ? UninstallingApps.UserAppsList.Contains("Microsoft.BingFinance") ? (DrawingImage)FindResource("A_DI_BingFinance") : (DrawingImage)FindResource("DA_DI_BingFinance") : (DrawingImage)FindResource("DI_Sandtime");
+ YandexMusic.Source = !UninstallingApps.IsAppDeletedList["Yandex.Music"] ? UninstallingApps.UserAppsList.Contains("Yandex.Music") ? (DrawingImage)FindResource("A_DI_YandexMusic") : (DrawingImage)FindResource("DA_DI_YandexMusic") : (DrawingImage)FindResource("DI_Sandtime");
+ Netflix.Source = !UninstallingApps.IsAppDeletedList["Netflix"] ? UninstallingApps.UserAppsList.Contains("Netflix") ? (DrawingImage)FindResource("A_DI_Netflix") : (DrawingImage)FindResource("DA_DI_Netflix") : (DrawingImage)FindResource("DI_Sandtime");
+ Outlook.Source = !UninstallingApps.IsAppDeletedList["Outlook"] ? UninstallingApps.UserAppsList.Contains("Microsoft.OutlookForWindows") ? (DrawingImage)FindResource("A_DI_Outlook") : (DrawingImage)FindResource("DA_DI_Outlook") : (DrawingImage)FindResource("DI_Sandtime");
+ QuickAssist.Source = !UninstallingApps.IsAppDeletedList["QuickAssist"] ? UninstallingApps.UserAppsList.Contains("MicrosoftCorporationII.QuickAssist") ? (DrawingImage)FindResource("A_DI_QuickAssist") : (DrawingImage)FindResource("DA_DI_QuickAssist") : (DrawingImage)FindResource("DI_Sandtime");
}
}
}
diff --git a/.Source/GTweak/View/InformationSystemView.xaml.cs b/.Source/GTweak/View/InformationSystemView.xaml.cs
index 063da811..8429f52b 100644
--- a/.Source/GTweak/View/InformationSystemView.xaml.cs
+++ b/.Source/GTweak/View/InformationSystemView.xaml.cs
@@ -12,6 +12,7 @@ using System.Windows.Input;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Threading;
+using GTweak.Utilities.Tweaks;
namespace GTweak.View
{
@@ -78,8 +79,8 @@ namespace GTweak.View
{
BackgroundWorker backgroundWorker = new BackgroundWorker();
backgroundWorker.RunWorkerAsync();
- backgroundWorker.DoWork += (s, e) => { SystemData.СomputerСonfiguration.GetUserIP(); };
- backgroundWorker.RunWorkerCompleted += (s, e) => DataContext = new InformationSystemVM();
+ backgroundWorker.DoWork += delegate { SystemData.СomputerСonfiguration.GetUserIP(); };
+ backgroundWorker.RunWorkerCompleted += delegate { DataContext = new InformationSystemVM(); };
}
time = time.Add(TimeSpan.FromSeconds(+1));
@@ -184,10 +185,10 @@ namespace GTweak.View
private void Page_MouseMove(object sender, MouseEventArgs e)
{
- Point _currentPos = this.PointToScreen(Mouse.GetPosition(this));
+ Point currentPos = this.PointToScreen(Mouse.GetPosition(this));
PopupCopy.Placement = PlacementMode.Absolute;
- PopupCopy.HorizontalOffset = _currentPos.X + 10;
- PopupCopy.VerticalOffset = _currentPos.Y - 30;
+ PopupCopy.HorizontalOffset = currentPos.X + 10;
+ PopupCopy.VerticalOffset = currentPos.Y - 30;
}
diff --git a/.Source/GTweak/View/SystemView.xaml.cs b/.Source/GTweak/View/SystemView.xaml.cs
index 96bb79b2..b94488b1 100644
--- a/.Source/GTweak/View/SystemView.xaml.cs
+++ b/.Source/GTweak/View/SystemView.xaml.cs
@@ -52,8 +52,8 @@ namespace GTweak.View
private void Sliders_PreviewMouseUp(object sender, MouseButtonEventArgs e)
{
Slider slider = (Slider)sender;
- INIManager.userTweaksSystem.Remove(slider.Name);
- INIManager.userTweaksSystem.Add(slider.Name, Convert.ToString(slider.Value));
+ INIManager.UserTweaksSystem.Remove(slider.Name);
+ INIManager.UserTweaksSystem.Add(slider.Name, Convert.ToString(slider.Value));
}
private void Sliders_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
@@ -94,8 +94,8 @@ namespace GTweak.View
if (!SystemTweaks.isTweakWorkingAntivirus)
{
SystemTweaks.isTweakWorkingAntivirus = true;
- INIManager.userTweaksSystem.Remove(toggleButton.Name);
- INIManager.userTweaksSystem.Add(toggleButton.Name, Convert.ToString(toggleButton.State));
+ INIManager.UserTweaksSystem.Remove(toggleButton.Name);
+ INIManager.UserTweaksSystem.Add(toggleButton.Name, Convert.ToString(toggleButton.State));
SystemTweaks.UseSystem(toggleButton.Name, toggleButton.State);
new ViewNotification().Show("", (string)FindResource("title1_notification"), (string)FindResource("windefender_notification"));
}
diff --git a/.Source/GTweak/Windows/ImportWindow.xaml.cs b/.Source/GTweak/Windows/ImportWindow.xaml.cs
index c2599552..68a4da06 100644
--- a/.Source/GTweak/Windows/ImportWindow.xaml.cs
+++ b/.Source/GTweak/Windows/ImportWindow.xaml.cs
@@ -12,8 +12,8 @@ using System.Windows.Input;
namespace GTweak.Windows
{
public partial class ImportWindow : Window
- {
- private class SectionName
+ {
+ internal class SectionName
{
internal const string Confidentiality = "Confidentiality Tweaks";
internal const string Interface = "Interface Tweaks";
@@ -36,13 +36,13 @@ namespace GTweak.Windows
private async void Window_Loaded(object sender, RoutedEventArgs e)
{
- Progress<int> _progress = new Progress<int>(ReportProgress);
- try { await SortByPageDate(_cancellationTokenSource.Token, _progress); } catch { }
+ Progress<int> progress = new Progress<int>(ReportProgress);
+ try { await SortByPageDate(_cancellationTokenSource.Token, progress); } catch { }
}
- private void ReportProgress(int _valueProgress)
+ private void ReportProgress(int valueProgress)
{
- if (_valueProgress == 100)
+ if (valueProgress == 100)
{
if (isRestartNeed)
new ViewNotification().Show("restart");
@@ -74,7 +74,7 @@ namespace GTweak.Windows
foreach (var set in acceptanceList)
{
- await Task.Delay(700);
+ await Task.Delay(700, _token);
Parallel.Invoke(() => ConfidentialityTweaks.UseСonfidentiality(set.Tweak, Convert.ToBoolean(set.Value)));
switch (set.Tweak)
@@ -98,7 +98,7 @@ namespace GTweak.Windows
foreach (var set in acceptanceList)
{
- await Task.Delay(700);
+ await Task.Delay(700, _token);
Parallel.Invoke(() => InterfaceTweaks.UseInterface(set.Tweak, Convert.ToBoolean(set.Value)));
switch (set.Tweak)
@@ -133,7 +133,7 @@ namespace GTweak.Windows
foreach (var set in acceptanceList)
{
- await Task.Delay(700);
+ await Task.Delay(700, _token);
Parallel.Invoke(() => ServicesTweaks.UseServices(set.Tweak, Convert.ToBoolean(set.Value)));
isRestartNeed = true;
}
@@ -150,7 +150,7 @@ namespace GTweak.Windows
foreach (var set in acceptanceList)
{
- await Task.Delay(700);
+ await Task.Delay(700, _token);
if (set.Tweak != "TglButton8")
{
@@ -182,13 +182,13 @@ namespace GTweak.Windows
{
SystemTweaks.isTweakWorkingAntivirus = true;
SystemTweaks.UseSystem(set.Tweak, Convert.ToBoolean(set.Value));
- await Task.Delay(20000);
+ await Task.Delay(20000, _token);
}
}
}
}
- await Task.Delay(1);
+ await Task.Delay(1, _token);
_progress.Report(i);
}