Delete RemoveUWPAll.cs

This commit is contained in:
Belim 2020-09-20 19:21:58 +02:00 committed by GitHub
parent 73347f8e00
commit dd515a1c84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,72 +0,0 @@
using System;
using System.Management.Automation;
using System.IO;
namespace Privatezilla.Setting.Bloatware
{
internal class RemoveUWPAll : SettingBase
{
public override string ID()
{
return Properties.Resources.settingsBloatwareRemoveUWPAll;
}
public override string Info()
{
return Properties.Resources.settingsBloatwareRemoveUWPAllInfo;
}
public override bool CheckSetting()
{
// NOTE! OPTIMIZE
// Check if app Windows.Photos exists and return true as not configured
var appPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Packages", "Microsoft.Windows.Photos_8wekyb3d8bbwe");
if (Directory.Exists(appPath))
{
return true;
}
return false;
}
public override bool DoSetting()
{
using (PowerShell script = PowerShell.Create())
{
script.AddScript("Get-appxprovisionedpackage online | where-object {$_.packagename notlike “*store*”} | Remove-AppxProvisionedPackage online");
script.AddScript("Get-AppxPackage | where-object {$_.name notlike “*store*”} | Remove-AppxPackage");
try
{
script.Invoke();
}
catch
{ }
}
return true;
}
public override bool UndoSetting()
{
using (PowerShell script = PowerShell.Create())
{
script.AddScript("Get-AppxPackage -AllUsers| Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\\AppXManifest.xml”}");
try
{
script.Invoke();
return true;
}
catch
{}
return false;
}
}
}
}