Skip to content

Commit

Permalink
Merge branch 'testing'
Browse files Browse the repository at this point in the history
  • Loading branch information
rayenghanmi committed Dec 14, 2024
2 parents e8fcdb2 + 0b8c4e1 commit 367c589
Show file tree
Hide file tree
Showing 28 changed files with 678 additions and 527 deletions.
Binary file added Assets/support.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

All notable changes to this branch will be documented in this file.

## 0.9.1 - Released

### Added

- Added detailed sections for Network and Battery information in `System Info` page.
- Enhanced `System Info` page to include more detailed information and options.
- Replaced the old Win32 folder picker with the modern `FolderPicker` from the `Windows.Storage.Pickers` namespace for selecting the folder path in the `System Info` page.
- Added caching to some pages to retain their data when navigating away and returning.

### Changes

- Optimized the loading of installed apps by parallelizing tasks and minimizing UI updates.
- Improved the efficiency of the uninstallation process by running tasks in parallel.
- Enhanced the responsiveness of the `Debloat` page.
- Introduced an enhanced way to gather system information in `System Info` page.
- Optimized the `Networking` page by caching network interfaces, enhancing DNS setting process and improving the UI responsiveness.
- Enhanced the UI by initializing toggle switches asynchronously and minimizing UI updates.
- Improved logging and error handling.

## 0.9.0 - Released

### Added
Expand Down
2 changes: 1 addition & 1 deletion Helpers/LogHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal class LogHelper

public static async Task ShowErrorMessageAndLog(Exception ex, XamlRoot xamlRoot)
{
var errorMessage = $"Caught Error: {ex.Message}";
var errorMessage = $"Caught Error: {ex.Message}\nStack Trace: {ex.StackTrace}";

await Log($"Error: {errorMessage}");

Expand Down
69 changes: 30 additions & 39 deletions Helpers/OptimizationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,14 @@ internal class OptimizationOptions
{
[DllImport("psapi.dll")]
public static extern bool EmptyWorkingSet(IntPtr hProcess);

public static List<KeyValuePair<string, string>> GetUWPApps(bool uninstallableOnly)
{
var installedApps = new List<KeyValuePair<string, string>>();

string command;
if (uninstallableOnly)
{
command = @"powershell.exe -Command ""Get-AppxPackage | Where-Object { $_.NonRemovable -eq $false } | Select-Object Name,InstallLocation""";
}
else
{
command = @"powershell.exe -Command ""Get-AppxPackage | Select-Object Name,InstallLocation""";
}
string command = uninstallableOnly
? @"powershell.exe -Command ""Get-AppxPackage | Where-Object { $_.NonRemovable -eq $false } | Select-Object Name,InstallLocation"""
: @"powershell.exe -Command ""Get-AppxPackage | Select-Object Name,InstallLocation""";

try
{
Expand All @@ -36,38 +31,35 @@ public static List<KeyValuePair<string, string>> GetUWPApps(bool uninstallableOn
CreateNoWindow = true
}
};
{
process.Start();
process.Start();

// Read the output directly
while (!process.StandardOutput.EndOfStream)
// Read the output directly
while (!process.StandardOutput.EndOfStream)
{
var line = process.StandardOutput.ReadLine();
var parts = line?.Split(new[] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries);
if (parts?.Length == 2 && !installedApps.Exists(i => i.Key == parts[0]))
{
var line = process.StandardOutput.ReadLine();
var parts = line?.Split(new[] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries);
if (parts?.Length == 2 && !installedApps.Exists(i => i.Key == parts[0]))
{
installedApps.Add(new KeyValuePair<string, string>(parts[0], parts[1]));
}
installedApps.Add(new KeyValuePair<string, string>(parts[0], parts[1]));
}

process.WaitForExit();
}

process.WaitForExit();
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
return installedApps;
}

LogHelper.Log("Returning Installed Apps [GetUWPApps]");
return installedApps;
}


internal static bool ServiceExists(string serviceName)
{
return Array.Exists(ServiceController.GetServices(), (serviceController => serviceController.ServiceName.Equals(serviceName)));
return Array.Exists(ServiceController.GetServices(), serviceController => serviceController.ServiceName.Equals(serviceName));
}

internal static void StopService(string serviceName)
{
if (ServiceExists(serviceName))
Expand All @@ -88,16 +80,14 @@ internal static async Task ExecuteBatchFileAsync()
// Get the path to the PowerShell script file
var scriptFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Assets", "RemoveEdge.ps1");



if (!File.Exists(scriptFilePath))
{
await LogHelper.Log($"Script file not found: {scriptFilePath}");
return;
}

// Read the content of the script file
var scriptContent = File.ReadAllText(scriptFilePath);
var scriptContent = await File.ReadAllTextAsync(scriptFilePath);

// Create a PowerShell instance
using var PowerShellInstance = PowerShell.Create();
Expand Down Expand Up @@ -147,18 +137,20 @@ internal static async Task<int> StartInCmd(string command)
{
try
{
using var p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = $"/C {command}";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = true;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
using var p = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = $"/C {command}",
CreateNoWindow = true,
UseShellExecute = true,
WindowStyle = ProcessWindowStyle.Hidden
}
};

// Start the process in a separate Task
Task startTask = Task.Run(() => p.Start());

// Await the start task to ensure process starts
await startTask;
await Task.Run(() => p.Start());

// Await process completion and capture exit code
await p.WaitForExitAsync();
Expand All @@ -171,7 +163,6 @@ internal static async Task<int> StartInCmd(string command)
}
}


internal static void StartService(string serviceName)
{
if (ServiceExists(serviceName))
Expand All @@ -188,7 +179,7 @@ internal static void ClearWorkingSet()
EmptyWorkingSet(Process.GetCurrentProcess().Handle);

// Get all running processes
foreach (Process process in Process.GetProcesses())
foreach (var process in Process.GetProcesses())
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<Identity
Name="Rayen.RyTuneX"
Publisher="CN=Rayen"
Version="0.9.0.0" />
Version="0.9.1.0" />

<mp:PhoneIdentity PhoneProductId="593c7ba8-f1c9-47cf-a952-7c22b10aac3a" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down
2 changes: 1 addition & 1 deletion RyTuneX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<Version>0.9.0</Version>
<Version>0.9.1</Version>
<Authors>Rayen Ghanmi</Authors>
</PropertyGroup>
<ItemGroup>
Expand Down
25 changes: 24 additions & 1 deletion Strings/ar-tn/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -753,5 +753,28 @@
<data name="Update" xml:space="preserve">
<value>تحديث</value>
</data>

<data name="HomePage_SupportButton.Text" xml:space="preserve">
<value>ساندنا</value>
</data>
<data name="SystemInfoPage_Battery.Text" xml:space="preserve">
<value>البطارية</value>
</data>
<data name="SystemInfoPage_Network.Text" xml:space="preserve">
<value>الشبكة</value>
</data>
<data name="MACAddress" xml:space="preserve">
<value>عنوان ماك</value>
</data>
<data name="AdapterType" xml:space="preserve">
<value>نوع المهايئ</value>
</data>
<data name="EstimatedChargeRemaining" xml:space="preserve">
<value>النسبة المتبقية للشحن</value>
</data>
<data name="BatteryStatus" xml:space="preserve">
<value>حالة البطارية</value>
</data>
<data name="Chemistry" xml:space="preserve">
<value>نوع التركيبة الكيميائية للبطارية</value>
</data>
</root>
24 changes: 24 additions & 0 deletions Strings/de/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -753,4 +753,28 @@
<data name="Update" xml:space="preserve">
<value>Aktualisieren</value>
</data>
<data name="HomePage_SupportButton.Text" xml:space="preserve">
<value>Unterstütze uns</value>
</data>
<data name="SystemInfoPage_Network.Text" xml:space="preserve">
<value>Netzwerk</value>
</data>
<data name="SystemInfoPage_Battery.Text" xml:space="preserve">
<value>Batterie</value>
</data>
<data name="MACAddress" xml:space="preserve">
<value>MAC-Adresse</value>
</data>
<data name="AdapterType" xml:space="preserve">
<value>Adaptertyp</value>
</data>
<data name="EstimatedChargeRemaining" xml:space="preserve">
<value>Geschätzte verbleibende Ladung</value>
</data>
<data name="BatteryStatus" xml:space="preserve">
<value>Batteriestatus</value>
</data>
<data name="Chemistry" xml:space="preserve">
<value>Chemische Zusammensetzung</value>
</data>
</root>
24 changes: 24 additions & 0 deletions Strings/en-us/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -753,4 +753,28 @@
<data name="Update" xml:space="preserve">
<value>Update</value>
</data>
<data name="HomePage_SupportButton.Text" xml:space="preserve">
<value>Support us</value>
</data>
<data name="SystemInfoPage_Network.Text" xml:space="preserve">
<value>Network</value>
</data>
<data name="SystemInfoPage_Battery.Text" xml:space="preserve">
<value>Battery</value>
</data>
<data name="MACAddress" xml:space="preserve">
<value>MAC Address</value>
</data>
<data name="AdapterType" xml:space="preserve">
<value>Adapter Type</value>
</data>
<data name="EstimatedChargeRemaining" xml:space="preserve">
<value>Estimated Charge Remaining</value>
</data>
<data name="BatteryStatus" xml:space="preserve">
<value>Battery Status</value>
</data>
<data name="Chemistry" xml:space="preserve">
<value>Chemistry</value>
</data>
</root>
24 changes: 24 additions & 0 deletions Strings/fr-fr/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -750,4 +750,28 @@
<data name="Update" xml:space="preserve">
<value>Mettre à jour</value>
</data>
<data name="HomePage_SupportButton.Text" xml:space="preserve">
<value>Soutenez-nous</value>
</data>
<data name="SystemInfoPage_Battery.Text" xml:space="preserve">
<value>Batterie</value>
</data>
<data name="SystemInfoPage_Network.Text" xml:space="preserve">
<value>Réseau</value>
</data>
<data name="MACAddress" xml:space="preserve">
<value>Adresse MAC</value>
</data>
<data name="AdapterType" xml:space="preserve">
<value>Type d’adaptateur</value>
</data>
<data name="EstimatedChargeRemaining" xml:space="preserve">
<value>Charge restante estimée</value>
</data>
<data name="BatteryStatus" xml:space="preserve">
<value>État de la batterie</value>
</data>
<data name="Chemistry" xml:space="preserve">
<value>Composition chimique</value>
</data>
</root>
24 changes: 24 additions & 0 deletions Strings/zh-Hans/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -753,4 +753,28 @@
<data name="Update" xml:space="preserve">
<value>更新</value>
</data>
<data name="HomePage_SupportButton.Text" xml:space="preserve">
<value>支持我们</value>
</data>
<data name="SystemInfoPage_Network.Text" xml:space="preserve">
<value>网络</value>
</data>
<data name="SystemInfoPage_Battery.Text" xml:space="preserve">
<value>电池</value>
</data>
<data name="MACAddress" xml:space="preserve">
<value>MAC地址</value>
</data>
<data name="AdapterType" xml:space="preserve">
<value>适配器类型</value>
</data>
<data name="EstimatedChargeRemaining" xml:space="preserve">
<value>预计剩余电量</value>
</data>
<data name="BatteryStatus" xml:space="preserve">
<value>电池状态</value>
</data>
<data name="Chemistry" xml:space="preserve">
<value>化学成分</value>
</data>
</root>
10 changes: 5 additions & 5 deletions Views/DebloatSystemPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
xmlns:behaviors="using:CommunityToolkit.WinUI.Behaviors"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
mc:Ignorable="d">
<Grid Margin="0,0,0,26">
<Grid Margin="-26,0,-30,40">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
Expand All @@ -19,7 +19,7 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Padding="5" CornerRadius="8" BorderThickness="1" BorderBrush="{ThemeResource LayerOnMicaBaseAltFillColorSecondaryBrush}" Background="{ThemeResource LayerOnMicaBaseAltFillColorDefaultBrush}">
<TreeView Grid.Row="0" x:Name="appTreeView" Visibility="Collapsed" ItemsSource="{x:Bind AppList}" SelectionMode="Multiple" DragItemsStarting="AppTreeView_DragItemsStarting">
<TreeView Grid.Row="0" x:Name="appTreeView" Visibility="Collapsed" ItemsSource="{x:Bind AppList}" SelectionMode="Multiple" DragItemsStarting="AppTreeView_DragItemsStarting" VirtualizingStackPanel.VirtualizationMode="Recycling">
<TreeView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
Expand All @@ -36,9 +36,9 @@
</StackPanel>
<TextBlock Margin="3" Grid.Row="1" x:Name="installedAppsCount" Visibility="Collapsed"/>
<CheckBox x:Uid="DebloatSystemPage_ShowAll" Margin="3" Grid.Row="2" x:Name="showAll" Visibility="Collapsed" Checked="ShowAll_Checked" Unchecked="ShowAll_Unchecked"/>
<ScrollView Margin="3" Grid.Row="3">
<ScrollViewer Margin="3" Grid.Row="3">
<TextBlock Margin="3" x:Name="uninstallingStatusText"/>
</ScrollView>
</ScrollViewer>

<ProgressBar Margin="2" Grid.Row="4" x:Name="uninstallingStatusBar" Width="Auto" IsIndeterminate="True" Visibility="Collapsed"/>
<muxc:InfoBar
Expand All @@ -63,4 +63,4 @@
</StackPanel>
</StackPanel>
</Grid>
</Page>
</Page>
Loading

0 comments on commit 367c589

Please sign in to comment.