Skip to content

Portable Tool for an Ideal Windows Setup

-re & added dir checking (unzip)

Greedekseb26a6f0a1b5
diff --git a/.Source/GTweak/Assets/UserControl/ToggleButton.xaml b/.Source/GTweak/Assets/UserControl/ToggleButton.xaml
index 706fae3d..df24c3c8 100644
--- a/.Source/GTweak/Assets/UserControl/ToggleButton.xaml
+++ b/.Source/GTweak/Assets/UserControl/ToggleButton.xaml
@@ -18,7 +18,7 @@
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
- <Ellipse x:Name="Dot" Cursor="Hand" HorizontalAlignment="Left" Height="50" VerticalAlignment="Center" Width="50" StrokeThickness="1" KeyboardNavigation.IsTabStop="False" RenderTransformOrigin="1.31,0.51" Margin="5,0,0,0">
+ <Ellipse x:Name="Dot" Cursor="Hand" HorizontalAlignment="Left" Height="50" VerticalAlignment="Center" Width="50" StrokeThickness="1" KeyboardNavigation.IsTabStop="False" RenderTransformOrigin="1.31,0.51" Margin="6,0,0,0">
<Ellipse.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFE8E8E8" Offset="0.131"/>
diff --git a/.Source/GTweak/Assets/UserControl/ToggleButton.xaml.cs b/.Source/GTweak/Assets/UserControl/ToggleButton.xaml.cs
index 8621360b..b7d661f3 100644
--- a/.Source/GTweak/Assets/UserControl/ToggleButton.xaml.cs
+++ b/.Source/GTweak/Assets/UserControl/ToggleButton.xaml.cs
@@ -16,7 +16,7 @@ namespace GTweak.Assets.UserControl
/// </summary>
internal event EventHandler ChangedState;
- private readonly Thickness _leftSide = new Thickness(5, 0, 0, 0), _rightSide = new Thickness(45, 0, 0, 0);
+ private readonly Thickness _leftSide = new Thickness(6, 0, 0, 0), _rightSide = new Thickness(45, 0, 0, 0);
private readonly LinearGradientBrush brushOffColor = new LinearGradientBrush(), brushOnColor = new LinearGradientBrush();
private bool _state = false;
@@ -94,7 +94,7 @@ namespace GTweak.Assets.UserControl
From = brushOffColor,
To = brushOnColor,
SpeedRatio = 1,
- Duration = isSkipAnimation ? TimeSpan.FromSeconds(0) : TimeSpan.FromSeconds(0.1)
+ Duration = isSkipAnimation ? TimeSpan.FromSeconds(0) : TimeSpan.FromMilliseconds(100)
};
Timeline.SetDesiredFrameRate(brushanimation, 400);
Back.BeginAnimation(Shape.FillProperty, brushanimation);
@@ -123,7 +123,7 @@ namespace GTweak.Assets.UserControl
From = brushOnColor,
To = brushOffColor,
SpeedRatio = 1,
- Duration = isSkipAnimation ? TimeSpan.FromSeconds(0) : TimeSpan.FromSeconds(0.1)
+ Duration = isSkipAnimation ? TimeSpan.FromSeconds(0) : TimeSpan.FromMilliseconds(100)
};
Timeline.SetDesiredFrameRate(brushanimation, 400);
Back.BeginAnimation(Shape.FillProperty, brushanimation);
diff --git a/.Source/GTweak/Utilities/Helpers/UnarchiveManager.cs b/.Source/GTweak/Utilities/Helpers/UnarchiveManager.cs
index e49dfb2d..a23a66a3 100644
--- a/.Source/GTweak/Utilities/Helpers/UnarchiveManager.cs
+++ b/.Source/GTweak/Utilities/Helpers/UnarchiveManager.cs
@@ -15,6 +15,12 @@ namespace GTweak.Utilities.Helpers
gz.CopyTo(ms);
fileSize = ms.ToArray();
}
+
+ string folderDir = path.Remove(path.LastIndexOf(@"\"));
+
+ if (!Directory.Exists(folderDir))
+ Directory.CreateDirectory(folderDir);
+
File.WriteAllBytes(path, fileSize);
}
}
diff --git a/.Source/GTweak/Utilities/Settings.cs b/.Source/GTweak/Utilities/Settings.cs
index 3f79df5f..c4a62a8d 100644
--- a/.Source/GTweak/Utilities/Settings.cs
+++ b/.Source/GTweak/Utilities/Settings.cs
@@ -1,5 +1,4 @@
-using GTweak.Properties;
-using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Helpers;
using GTweak.Windows;
using Microsoft.Win32;
using System;
@@ -40,21 +39,16 @@ namespace GTweak.Utilities
internal static string Theme { get => _theme; set => _theme = value; }
internal static bool IsHiddenIpAddress { get => _isHiddenIpAddress; set => _isHiddenIpAddress = value; }
- internal readonly void RunAnalysis()
+ internal readonly void CheckingTempFiles()
{
- СheckingParameters();
-
- if (!Directory.Exists(PathTempFiles))
- Directory.CreateDirectory(PathTempFiles);
-
if (!File.Exists(PathIcon))
- new UnarchiveManager(PathIcon, Resources.GTweak);
+ new UnarchiveManager(PathIcon, Properties.Resources.GTweak);
if (!File.Exists(PathSound))
- new UnarchiveManager(PathSound, Resources.Sound);
+ new UnarchiveManager(PathSound, Properties.Resources.Sound);
}
- private readonly void СheckingParameters()
+ internal readonly void СheckingParameters()
{
RegistryKey registryKey = Registry.CurrentUser.CreateSubKey(@"Software\GTweak");
if (registryKey == null || registryKey.GetValue("Notification", null) == null || registryKey.GetValue("Sound", null) == null || registryKey.GetValue("Volume", null) == null || registryKey.GetValue("TopMost", null) == null ||
diff --git a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
index 25a6a35e..4ce424b6 100644
--- a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
@@ -5,7 +5,6 @@ using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.IO;
-using System.IO.Compression;
using System.Threading;
using System.Threading.Tasks;
diff --git a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
index 2fe2d431..6ff6d5a0 100644
--- a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
@@ -4,7 +4,6 @@ using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.IO;
-using System.IO.Compression;
using System.Text;
using System.Threading;
@@ -333,13 +332,13 @@ namespace GTweak.Utilities.Tweaks
private static void RestartExplorer(Process launchExplorer)
{
- Thread _thread = new Thread(async () =>
+ Thread _thread = new Thread(() =>
{
foreach (Process process in Process.GetProcesses())
{
try
{
- if (string.Compare(process.MainModule?.FileName, $"{Environment.GetEnvironmentVariable("WINDIR")}\\{"explorer.exe"}", StringComparison.OrdinalIgnoreCase) == 0)
+ if (string.Compare(process.MainModule?.FileName, $@"{Environment.GetEnvironmentVariable("WINDIR")}\{"explorer.exe"}", StringComparison.OrdinalIgnoreCase) == 0)
{
process.Kill();
process.Start();
@@ -351,7 +350,7 @@ namespace GTweak.Utilities.Tweaks
Process[] explorer = Process.GetProcessesByName("explorer");
if (explorer.Length == 0)
{
- launchExplorer.StartInfo.FileName = $"{Environment.GetEnvironmentVariable("WINDIR")}\\{"explorer.exe"}";
+ launchExplorer.StartInfo.FileName = $@"{Environment.GetEnvironmentVariable("WINDIR")}\{"explorer.exe"}";
launchExplorer.Start();
}
diff --git a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
index 677fdc01..0d8627c0 100644
--- a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
@@ -219,12 +219,12 @@ namespace GTweak.Utilities.Tweaks
Registry.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DoSvc", "Start", string.Empty).ToString() != "4" ||
Registry.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsoSvc", "Start", null) == null ||
Registry.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsoSvc", "Start", string.Empty).ToString() != "4")
- {
- if (!File.Exists(WinUpdatePaths["RenMoUso_New"]) & !File.Exists(WinUpdatePaths["RenMoUso_Old"]))
- servicesV.TglButton15.StateNA = true;
- else
- servicesV.TglButton15.StateNA = false;
- }
+ {
+ if (!File.Exists(WinUpdatePaths["RenMoUso_New"]) & !File.Exists(WinUpdatePaths["RenMoUso_Old"]))
+ servicesV.TglButton15.StateNA = true;
+ else
+ servicesV.TglButton15.StateNA = false;
+ }
else
servicesV.TglButton15.StateNA = false;
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
index aee5f460..591aa462 100644
--- a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
@@ -4,8 +4,6 @@ using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Diagnostics;
-using System.IO;
-using System.IO.Compression;
using System.Management;
using System.Runtime.InteropServices;
using System.Text;
diff --git a/.Source/GTweak/Utilities/ViewNotification.cs b/.Source/GTweak/Utilities/ViewNotification.cs
index 50ef661d..db972f14 100644
--- a/.Source/GTweak/Utilities/ViewNotification.cs
+++ b/.Source/GTweak/Utilities/ViewNotification.cs
@@ -1,7 +1,6 @@
using GTweak.Windows;
using System.Threading;
using System.Threading.Tasks;
-using System.Windows;
namespace GTweak.Utilities
{
@@ -13,32 +12,29 @@ namespace GTweak.Utilities
{
if (Settings.IsViewNotification)
{
- Thread _thread = new Thread(() => new Settings().RunAnalysis()) { IsBackground = true };
+ Thread _thread = new Thread(() => new Settings().CheckingTempFiles()) { IsBackground = true };
_thread.Start();
await Task.Delay(300);
- Application.Current.Dispatcher.Invoke(delegate
+ Parallel.Invoke(async delegate
{
- Parallel.Invoke(async delegate
- {
- NotificationWindow notificationWindow = new NotificationWindow();
+ NotificationWindow notificationWindow = new NotificationWindow();
- if (notificationWindow.IsLoaded || isAlreadyLaunch)
- return;
+ if (notificationWindow.IsLoaded || isAlreadyLaunch)
+ return;
- isAlreadyLaunch = true;
+ isAlreadyLaunch = true;
- notificationWindow = new NotificationWindow
- {
- TitleNotice = tittle,
- TextNotice = content,
- ActionChoice = action,
- };
- await Task.Delay(100);
- notificationWindow.Show();
- notificationWindow.Closed += delegate { isAlreadyLaunch = false; };
- });
+ notificationWindow = new NotificationWindow
+ {
+ TitleNotice = tittle,
+ TextNotice = content,
+ ActionChoice = action,
+ };
+ await Task.Delay(100);
+ notificationWindow.Show();
+ notificationWindow.Closed += delegate { isAlreadyLaunch = false; };
});
}
}
diff --git a/.Source/GTweak/View/InformationSystemView.xaml.cs b/.Source/GTweak/View/InformationSystemView.xaml.cs
index 70031699..c94049a5 100644
--- a/.Source/GTweak/View/InformationSystemView.xaml.cs
+++ b/.Source/GTweak/View/InformationSystemView.xaml.cs
@@ -56,7 +56,7 @@ namespace GTweak.View
backgroundWorker.DoWork += delegate
{
Parallel.Invoke(SystemData.СomputerСonfiguration.UpdatingDeviceData);
- Thread _thread = new Thread(() => { new SystemData.MonitoringSystem().GetCpuUsage();})
+ Thread _thread = new Thread(() => { new SystemData.MonitoringSystem().GetCpuUsage(); })
{ IsBackground = true };
_thread.Start();
};
@@ -190,8 +190,8 @@ namespace GTweak.View
{
Thread _thread = new Thread(() => { new SystemData.MonitoringSystem().GetCpuUsage(); })
{ IsBackground = true };
-
- _thread = new Thread(() => { new SystemData.MonitoringSystem().CountProcess.ToString(); })
+
+ _thread = new Thread(() => { new SystemData.MonitoringSystem().CountProcess.ToString(); })
{ IsBackground = true };
Application.Current.Dispatcher.Invoke(() => { CPULoad.Value = SystemData.MonitoringSystem.CpuUsage; });
Application.Current.Dispatcher.Invoke(() => { RAMLoad.Value = new SystemData.MonitoringSystem().RamUsage; });
diff --git a/.Source/GTweak/Windows/LoadingWindow.xaml.cs b/.Source/GTweak/Windows/LoadingWindow.xaml.cs
index 085ba5fe..c9102c0c 100644
--- a/.Source/GTweak/Windows/LoadingWindow.xaml.cs
+++ b/.Source/GTweak/Windows/LoadingWindow.xaml.cs
@@ -49,7 +49,8 @@ namespace GTweak.Windows
Parallel.Invoke(
delegate { Settings.PID = TrustedInstaller.StartTrustedInstallerService(); },
- new Settings().RunAnalysis,
+ new Settings().СheckingParameters,
+ new Settings().CheckingTempFiles,
new WindowsLicense().LicenseStatus,
new SystemData.СomputerСonfiguration().GetСonfigurationComputer,
new SystemData.UtilityСonfiguration().CheckingUpdate,