Skip to content

Commit

Permalink
Merge branch 'testing'
Browse files Browse the repository at this point in the history
  • Loading branch information
rayenghanmi committed Apr 15, 2024
2 parents 6bfd03c + 066ac20 commit d63d788
Show file tree
Hide file tree
Showing 10 changed files with 394 additions and 78 deletions.
4 changes: 1 addition & 3 deletions App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ protected async override void OnLaunched(LaunchActivatedEventArgs args)
{
base.OnLaunched(args);

var showWelcomeNotification = ShouldShowWelcomeNotification();

if (showWelcomeNotification)
if (ShouldShowWelcomeNotification())
{
await LogHelper.Log("Showing Welcome Notification");
App.MainWindow.DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () =>
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

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

## 0.8.1 - Released

> This is a hotfix for version 0.8.0
## Added

- Add Simplified Chinese translation

## Fixes

- [x] Resolved an issue stopping users on Windows 10 from using `Debloat`.

## Known Issues

- This hotfix broke the ability to remove `MicrosoftEdge` (will be fixed in the next version).

## 0.8.0 - Released

### Fixes
Expand Down
79 changes: 45 additions & 34 deletions Helpers/OptimizationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using System.Collections.ObjectModel;
using System.Management.Automation;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml;
using System.Reflection;

namespace RyTuneX.Helpers;
internal class OptimizationOptions
Expand All @@ -13,51 +11,64 @@ public static List<KeyValuePair<string, string>> GetUWPApps(bool uninstallableOn
{
var installedApps = new List<KeyValuePair<string, string>>();

using (var PowerShellInstance = PowerShell.Create())
string command;
if (uninstallableOnly)
{
LogHelper.Log("Getting Installed Apps [OptimizationOptions.cs]");
PowerShellInstance.AddScript("Set-ExecutionPolicy RemoteSigned -Scope Process");
PowerShellInstance.AddScript("Import-Module Appx")
.AddArgument("-ExecutionPolicy Bypass");
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""";
}

if (uninstallableOnly)
try
{
using var process = new Process
{
PowerShellInstance.AddScript(@"Get-AppxPackage | Where {$_.NonRemovable -like ""False""} | Select Name,InstallLocation");
}
else
StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = $"/C {command}",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
}
};
{
PowerShellInstance.AddScript("Get-AppxPackage | Select Name,InstallLocation");
}
process.Start();

string[] tmp;
Collection<PSObject> psResult;
try
{
psResult = PowerShellInstance.Invoke();
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
return installedApps;
}
/* Skip the first two lines as they contain headers
Removing this will cause two apps to appear named
"----" and "Name" */
process.StandardOutput.ReadLine();
process.StandardOutput.ReadLine();
process.StandardOutput.ReadLine();

if (psResult == null)
{
return installedApps;
}
foreach (var x in psResult)
{
tmp = x.ToString().Replace("@", string.Empty).Replace("{", string.Empty).Replace("}", string.Empty).Replace("Name=", string.Empty).Replace("InstallLocation=", string.Empty).Trim().Split(';');
if (!installedApps.Exists(i => i.Key == tmp[0]))
// Read the output directly
while (!process.StandardOutput.EndOfStream)
{
installedApps.Add(new KeyValuePair<string, string>(tmp[0], tmp[1]));
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]));
}
}

process.WaitForExit();
}
}
LogHelper.Log("Returning Installed Apps [OptimizationOptions.cs]");
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)));
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 Ghanmi"
Version="0.8.0.0" />
Version="0.8.1.0" />

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

Expand Down
30 changes: 15 additions & 15 deletions RyTuneX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.0.230907" />
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.0.240109" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.240109" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240404000" />
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
<PackageReference Include="System.Management" Version="8.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="8.0.0" />
<PackageReference Include="WinUI3Localizer" Version="2.1.0" />
<PackageReference Include="WinUIEx" Version="2.3.3" />
<PackageReference Include="Microsoft.PowerShell.Commands.Diagnostics" Version="7.4.0" />
<PackageReference Include="Microsoft.PowerShell.Commands.Management" Version="7.4.0" />
<PackageReference Include="Microsoft.PowerShell.Commands.Utility" Version="7.4.0" />
<PackageReference Include="Microsoft.PowerShell.ConsoleHost" Version="7.4.0" />
<PackageReference Include="Microsoft.WSMan.Management" Version="7.4.0" />
<PackageReference Include="WinUI3Localizer" Version="2.2.0" />
<PackageReference Include="WinUIEx" Version="2.3.4" />
<PackageReference Include="Microsoft.PowerShell.Commands.Diagnostics" Version="7.4.2" />
<PackageReference Include="Microsoft.PowerShell.Commands.Management" Version="7.4.2" />
<PackageReference Include="Microsoft.PowerShell.Commands.Utility" Version="7.4.2" />
<PackageReference Include="Microsoft.PowerShell.ConsoleHost" Version="7.4.2" />
<PackageReference Include="Microsoft.WSMan.Management" Version="7.4.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="8.0.0" />
<PackageReference Include="System.Management.Automation" Version="7.4.0" />
<PackageReference Include="System.Management.Automation" Version="7.4.2" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -99,26 +99,26 @@
</PropertyGroup>

<ItemGroup>
<Compile Remove="C:\Users\Ghanmi\.nuget\packages\microsoft.windowsappsdk\1.4.231115000\buildTransitive\..\include\DeploymentManagerAutoInitializer.cs" />
<Compile Remove="C:\Users\Ghanmi\.nuget\packages\microsoft.windowsappsdk\1.5.240404000\buildTransitive\..\include\DeploymentManagerAutoInitializer.cs" />
</ItemGroup>

<ItemGroup>
<Compile Remove="C:\Users\Ghanmi\.nuget\packages\microsoft.windowsappsdk\1.4.231115000\buildTransitive\..\include\WindowsAppSDK-VersionInfo.cs" />
<Compile Remove="C:\Users\Ghanmi\.nuget\packages\microsoft.windowsappsdk\1.5.240404000\buildTransitive\..\include\WindowsAppSDK-VersionInfo.cs" />
</ItemGroup>

<ItemGroup>
<Compile Remove="C:\Users\Ghanmi\.nuget\packages\microsoft.windowsappsdk\1.4.231115000\buildTransitive\..\include\WindowsAppSDK-VersionInfo.cs" />
<Compile Remove="C:\Users\Ghanmi\.nuget\packages\microsoft.windowsappsdk\1.5.240404000\buildTransitive\..\include\WindowsAppSDK-VersionInfo.cs" />
</ItemGroup>

<ItemGroup>
<Compile Remove="C:\Users\Ghanmi\.nuget\packages\microsoft.windowsappsdk\1.4.231115000\buildTransitive\..\include\WindowsAppSDK-VersionInfo.cs" />
<Compile Remove="C:\Users\Ghanmi\.nuget\packages\microsoft.windowsappsdk\1.5.240404000\buildTransitive\..\include\WindowsAppSDK-VersionInfo.cs" />
</ItemGroup>

<ItemGroup>
<Compile Remove="C:\Users\Ghanmi\.nuget\packages\microsoft.windowsappsdk\1.4.231115000\buildTransitive\..\include\WindowsAppSDK-VersionInfo.cs" />
<Compile Remove="C:\Users\Ghanmi\.nuget\packages\microsoft.windowsappsdk\1.5.240404000\buildTransitive\..\include\WindowsAppSDK-VersionInfo.cs" />
</ItemGroup>

<ItemGroup>
<Compile Remove="C:\Users\Ghanmi\.nuget\packages\microsoft.windowsappsdk\1.4.231115000\buildTransitive\..\include\DeploymentManagerAutoInitializer.cs" />
<Compile Remove="C:\Users\Ghanmi\.nuget\packages\microsoft.windowsappsdk\1.5.240404000\buildTransitive\..\include\DeploymentManagerAutoInitializer.cs" />
</ItemGroup>
</Project>
Loading

0 comments on commit d63d788

Please sign in to comment.