Skip to content

Portable Tool for an Ideal Windows Setup

fix cropped blur effect & new instances deb v 5.2.9

Greedeks122b8871a2c5
diff --git a/.Source/GTweak/Properties/AssemblyInfo.cs b/.Source/GTweak/Properties/AssemblyInfo.cs
index ba55b0b7..cae3ab9d 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("© 2024-2025 Greedeks")]
[assembly: AssemblyTrademark("Greedeks")]
-[assembly: AssemblyInformationalVersion("Build: 5.2.8")]
-[assembly: AssemblyVersion("5.2.40.606")]
-[assembly: AssemblyFileVersion("5.2.40.606")]
+[assembly: AssemblyInformationalVersion("Build: 5.2.9")]
+[assembly: AssemblyVersion("5.2.65.481")]
+[assembly: AssemblyFileVersion("5.2.65.481")]
[assembly: ComVisible(false)]
diff --git a/.Source/GTweak/Properties/AssemblyInfo.tt b/.Source/GTweak/Properties/AssemblyInfo.tt
index 275105c1..84a2f3b9 100644
--- a/.Source/GTweak/Properties/AssemblyInfo.tt
+++ b/.Source/GTweak/Properties/AssemblyInfo.tt
@@ -20,7 +20,7 @@ using System.Windows;
ResourceDictionaryLocation.SourceAssembly
)]
<#+
- private const string majorVersion = "Build: 5.2.8";
+ private const string majorVersion = "Build: 5.2.9";
private string GenerateVersion()
{
diff --git a/.Source/GTweak/Utilities/Configuration/MonitoringSystem.cs b/.Source/GTweak/Utilities/Configuration/MonitoringSystem.cs
index 08c037ff..14cba663 100644
--- a/.Source/GTweak/Utilities/Configuration/MonitoringSystem.cs
+++ b/.Source/GTweak/Utilities/Configuration/MonitoringSystem.cs
@@ -10,16 +10,16 @@ namespace GTweak.Utilities.Configuration
{
internal int GetMemoryUsage => GetPhysicalAvailableMemory();
internal string GetNumberRunningProcesses => Process.GetProcesses().Length.ToString();
- internal static int GetProcessorUsage = default;
+ internal static int GetProcessorUsage { get; private set; } = 1;
[StructLayout(LayoutKind.Sequential)]
private struct SystemTime
{
- public uint dwLowDateTime;
- public uint dwHighDateTime;
+ internal uint dwLowDateTime;
+ internal uint dwHighDateTime;
}
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+ [StructLayout(LayoutKind.Sequential)]
private class MemoryStatus
{
public uint dwLength;
@@ -31,8 +31,7 @@ namespace GTweak.Utilities.Configuration
public ulong ullTotalVirtual;
public ulong ullAvailVirtual;
public ulong ullAvailExtendedVirtual;
- public MemoryStatus() => dwLength = (uint)Marshal.SizeOf(typeof(MemoryStatus));
-
+ internal MemoryStatus() => dwLength = (uint)Marshal.SizeOf(typeof(MemoryStatus));
}
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
@@ -41,42 +40,26 @@ namespace GTweak.Utilities.Configuration
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetSystemTimes(out SystemTime lpIdleTime, out SystemTime lpKernelTime, out SystemTime lpUserTime);
- private static int GetTotalMemory()
- {
- MemoryStatus memStatus = new MemoryStatus();
- if (GlobalMemoryStatusEx(memStatus))
- return (int)(memStatus.ullTotalPhys / 1048576);
- else
- return 0;
- }
-
- private static int GetAvailableMemory()
+ private static int GetPhysicalAvailableMemory()
{
MemoryStatus memStatus = new MemoryStatus();
- if (GlobalMemoryStatusEx(memStatus))
- return (int)(memStatus.ullAvailPhys / 1048576);
- else
+ if (!GlobalMemoryStatusEx(memStatus))
return 0;
- }
- private static int GetPhysicalAvailableMemory()
- {
- int totalMemory = GetTotalMemory();
- int availableMemory = GetAvailableMemory();
+ int totalMemory = (int)(memStatus.ullTotalPhys / 1048576);
+ int availableMemory = (int)(memStatus.ullAvailPhys / 1048576);
return (int)((float)(totalMemory - availableMemory) / totalMemory * 100);
}
internal async Task GetTotalProcessorUsage()
{
+ bool success = false;
try
{
static ulong ConvertTimeToTicks(SystemTime systemTime) => ((ulong)systemTime.dwHighDateTime << 32) | systemTime.dwLowDateTime;
if (!GetSystemTimes(out SystemTime idleTime, out SystemTime kernelTime, out SystemTime userTime))
- {
- GetProcessorUsage = 1;
return;
- }
ulong idleTicks = ConvertTimeToTicks(idleTime);
ulong totalTicks = ConvertTimeToTicks(kernelTime) + ConvertTimeToTicks(userTime);
@@ -84,10 +67,7 @@ namespace GTweak.Utilities.Configuration
await Task.Delay(1000);
if (!GetSystemTimes(out idleTime, out kernelTime, out userTime))
- {
- GetProcessorUsage = 1;
return;
- }
ulong newIdleTicks = ConvertTimeToTicks(idleTime);
ulong newTotalTicks = ConvertTimeToTicks(kernelTime) + ConvertTimeToTicks(userTime);
@@ -95,13 +75,10 @@ namespace GTweak.Utilities.Configuration
ulong totalTicksDiff = newTotalTicks - totalTicks;
GetProcessorUsage = (int)(100.0 * (totalTicksDiff - (newIdleTicks - idleTicks)) / totalTicksDiff);
-
- }
- catch (Exception ex)
- {
- ErrorLogging.LogDebug(ex);
- GetProcessorUsage = 1;
+ success = true;
}
+ catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ finally { if (!success) GetProcessorUsage = 1; }
}
}
}
diff --git a/.Source/GTweak/View/ConfidentialityView.xaml.cs b/.Source/GTweak/View/ConfidentialityView.xaml.cs
index 350e2395..b1aa4438 100644
--- a/.Source/GTweak/View/ConfidentialityView.xaml.cs
+++ b/.Source/GTweak/View/ConfidentialityView.xaml.cs
@@ -11,6 +11,8 @@ namespace GTweak.View
{
public partial class ConfidentialityView : UserControl
{
+ private readonly ConfidentialityTweaks confTweaks = new ConfidentialityTweaks();
+
public ConfidentialityView()
{
InitializeComponent();
@@ -39,10 +41,10 @@ namespace GTweak.View
if (NotificationManager.ConfActions.TryGetValue(toggleButton.Name, out string action))
new NotificationManager(300).Show(action);
- Parallel.Invoke(async delegate { await Task.Delay(1000); new ConfidentialityTweaks().AnalyzeAndUpdate(this); });
+ Parallel.Invoke(async delegate { await Task.Delay(1000); confTweaks.AnalyzeAndUpdate(this); });
}
- private void Page_Loaded(object sender, RoutedEventArgs e) => Parallel.Invoke(() => new ConfidentialityTweaks().AnalyzeAndUpdate(this));
+ private void Page_Loaded(object sender, RoutedEventArgs e) => Parallel.Invoke(() => confTweaks.AnalyzeAndUpdate(this));
}
}
diff --git a/.Source/GTweak/View/DataSystemView.xaml b/.Source/GTweak/View/DataSystemView.xaml
index 9492d8cf..1380689b 100644
--- a/.Source/GTweak/View/DataSystemView.xaml
+++ b/.Source/GTweak/View/DataSystemView.xaml
@@ -14,10 +14,8 @@
<Grid>
<Grid.RowDefinitions>
- <RowDefinition Height="131"/>
- <RowDefinition Height="19"/>
- <RowDefinition/>
- <RowDefinition Height="30"/>
+ <RowDefinition Height="149"/>
+ <RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Popup x:Name="PopupCopy" AllowsTransparency="True" Placement="Mouse" HorizontalOffset="20">
@@ -28,8 +26,7 @@
</Border>
</Popup>
- <Grid Grid.Row="0">
-
+ <Grid Grid.Row="0" Margin="0,0,0,19">
<Grid HorizontalAlignment="Left" Margin="50,0,0,0" Width="110" Height="110">
<Ellipse Height="90" Width="90" Stroke="{StaticResource Color_Background_RadialProgressBar}" StrokeThickness="4.5" VerticalAlignment="Center" HorizontalAlignment="Center" Opacity="0.2"/>
@@ -96,7 +93,7 @@
</Grid>
<ScrollViewer Grid.Row="2" Style="{StaticResource ScrollPage}">
- <Grid>
+ <Grid Margin="0,0,0,25">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
@@ -132,7 +129,7 @@
</StackPanel>
</Grid>
</Grid>
-
+
<Grid Grid.Row="2">
<Grid Width="543">
<StackPanel Orientation="Vertical" Margin="60,20,0,0">
@@ -151,7 +148,6 @@
</Grid>
</Grid>
-
<Grid Grid.Row="4">
<Grid Width="543">
<StackPanel Orientation="Vertical" Margin="60,20,0,0">
@@ -190,7 +186,7 @@
<TextBlock Text="{Binding [Audio].Data}" Style="{StaticResource Text}" HorizontalAlignment="Left" Margin="1,0,0,0" Foreground="{StaticResource Color_Highlighted}" Height="Auto" Width="Auto" PreviewMouseLeftButtonDown="TextComputerData_PreviewMouseDown" Cursor="Hand"/>
</StackPanel>
</Grid>
- </Grid>
+ </Grid>
<Grid Grid.Row="2">
<Grid Width="543">
@@ -217,10 +213,8 @@
</Grid>
</Grid>
</Grid>
-
</Grid>
</ScrollViewer>
-
</Grid>
-
+
</UserControl>
diff --git a/.Source/GTweak/View/DataSystemView.xaml.cs b/.Source/GTweak/View/DataSystemView.xaml.cs
index 3ed00329..4080bef8 100644
--- a/.Source/GTweak/View/DataSystemView.xaml.cs
+++ b/.Source/GTweak/View/DataSystemView.xaml.cs
@@ -19,6 +19,8 @@ namespace GTweak.View
{
public partial class DataSystemView : UserControl
{
+ private readonly MonitoringSystem monitoringSystem = new MonitoringSystem();
+ private readonly SystemDiagnostics systemDiagnostics = new SystemDiagnostics();
private readonly DispatcherTimer _timer = default;
private TimeSpan _time = TimeSpan.FromSeconds(0);
@@ -44,15 +46,15 @@ namespace GTweak.View
BackgroundQueue backgroundQueue = new BackgroundQueue();
await backgroundQueue.QueueTask(async delegate
{
- new SystemDiagnostics().UpdatingDevicesData();
- await new MonitoringSystem().GetTotalProcessorUsage();
+ systemDiagnostics.UpdatingDevicesData();
+ await monitoringSystem.GetTotalProcessorUsage();
});
AnimationProgressBars();
}
else if ((int)_time.TotalSeconds % 5 == 0)
{
BackgroundQueue backgroundQueue = new BackgroundQueue();
- await backgroundQueue.QueueTask(delegate { new SystemDiagnostics().GetUserIpAddress(); });
+ await backgroundQueue.QueueTask(delegate { systemDiagnostics.GetUserIpAddress(); });
DataContext = new DataSystemVM();
}
@@ -68,7 +70,7 @@ namespace GTweak.View
}, Application.Current.Dispatcher);
_timer.Start();
- RAMLoad.Value = new MonitoringSystem().GetMemoryUsage;
+ RAMLoad.Value = monitoringSystem.GetMemoryUsage;
CPULoad.Value = MonitoringSystem.GetProcessorUsage;
}
@@ -90,7 +92,7 @@ namespace GTweak.View
doubleAnim = new DoubleAnimation()
{
From = RAMLoad.Value,
- To = new MonitoringSystem().GetMemoryUsage,
+ To = monitoringSystem.GetMemoryUsage,
EasingFunction = new QuadraticEase(),
Duration = TimeSpan.FromSeconds(0.2)
};
diff --git a/.Source/GTweak/View/InterfaceView.xaml.cs b/.Source/GTweak/View/InterfaceView.xaml.cs
index e66c57c8..996b2668 100644
--- a/.Source/GTweak/View/InterfaceView.xaml.cs
+++ b/.Source/GTweak/View/InterfaceView.xaml.cs
@@ -15,6 +15,8 @@ namespace GTweak.View
{
public partial class InterfaceView : UserControl
{
+ private readonly InterfaceTweaks intfTweaks = new InterfaceTweaks();
+
public InterfaceView()
{
InitializeComponent();
@@ -74,10 +76,10 @@ namespace GTweak.View
if (NotificationManager.IntfActions.TryGetValue(toggleButton.Name, out string action))
new NotificationManager(300).Show(action);
- Parallel.Invoke(async delegate { await Task.Delay(1000); new InterfaceTweaks().AnalyzeAndUpdate(this); });
+ Parallel.Invoke(async delegate { await Task.Delay(1000); intfTweaks.AnalyzeAndUpdate(this); });
}
- private void Page_Loaded(object sender, RoutedEventArgs e) => Parallel.Invoke(() => new InterfaceTweaks().AnalyzeAndUpdate(this));
+ private void Page_Loaded(object sender, RoutedEventArgs e) => Parallel.Invoke(() => intfTweaks.AnalyzeAndUpdate(this));
}
}
diff --git a/.Source/GTweak/View/ServicesView.xaml.cs b/.Source/GTweak/View/ServicesView.xaml.cs
index c9f53dc9..4e67e1f8 100644
--- a/.Source/GTweak/View/ServicesView.xaml.cs
+++ b/.Source/GTweak/View/ServicesView.xaml.cs
@@ -10,6 +10,8 @@ namespace GTweak.View
{
public partial class ServicesView : UserControl
{
+ private readonly ServicesTweaks svcTweaks = new ServicesTweaks();
+
public ServicesView()
{
InitializeComponent();
@@ -35,9 +37,9 @@ namespace GTweak.View
new NotificationManager(300).Show("restart");
- Parallel.Invoke(async delegate { await Task.Delay(((ToggleButton)sender).Name.Contains("15") ? 2000 : 1000); new ServicesTweaks().AnalyzeAndUpdate(this); });
+ Parallel.Invoke(async delegate { await Task.Delay(((ToggleButton)sender).Name.Contains("15") ? 2000 : 1000); svcTweaks.AnalyzeAndUpdate(this); });
}
- private void Page_Loaded(object sender, System.Windows.RoutedEventArgs e) => Parallel.Invoke(() => new ServicesTweaks().AnalyzeAndUpdate(this));
+ private void Page_Loaded(object sender, System.Windows.RoutedEventArgs e) => Parallel.Invoke(() => svcTweaks.AnalyzeAndUpdate(this));
}
}
diff --git a/.Source/GTweak/View/SystemView.xaml.cs b/.Source/GTweak/View/SystemView.xaml.cs
index 3eee9893..480b8e8d 100644
--- a/.Source/GTweak/View/SystemView.xaml.cs
+++ b/.Source/GTweak/View/SystemView.xaml.cs
@@ -11,6 +11,8 @@ namespace GTweak.View
{
public partial class SystemView : UserControl
{
+ private readonly SystemTweaks sysTweaks = new SystemTweaks();
+
public SystemView()
{
InitializeComponent();
@@ -50,12 +52,12 @@ namespace GTweak.View
if (NotificationManager.SysActions.TryGetValue(toggleButton.Name, out string action))
new NotificationManager(300).Show(action);
- Parallel.Invoke(async delegate { await Task.Delay(1000); new SystemTweaks().AnalyzeAndUpdate(this); });
+ Parallel.Invoke(async delegate { await Task.Delay(1000); sysTweaks.AnalyzeAndUpdate(this); });
}
else
SystemTweaks.ApplyTweaks(toggleButton.Name, toggleButton.State);
}
- private void Page_Loaded(object sender, RoutedEventArgs e) => Parallel.Invoke(() => new SystemTweaks().AnalyzeAndUpdate(this));
+ private void Page_Loaded(object sender, RoutedEventArgs e) => Parallel.Invoke(() => sysTweaks.AnalyzeAndUpdate(this));
}
}