Delete UninstallCortana.cs

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

View file

@ -1,70 +0,0 @@
using System;
using System.Management.Automation;
using System.IO;
namespace Privatezilla.Setting.Cortana
{
internal class UninstallCortana : SettingBase
{
public override string ID()
{
return Properties.Resources.settingsCortanaUninstallCortana;
}
public override string Info()
{
return Properties.Resources.settingsCortanaUninstallCortanaInfo;
}
public override bool CheckSetting()
{
// Cortana Package ID on Windows 10, version 2004 is *Microsoft.549981C3F5F10*
var appPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Packages", "Microsoft.549981C3F5F10");
if (Directory.Exists(appPath))
{
return true;
}
return false;
}
public override bool DoSetting()
{
using (PowerShell script = PowerShell.Create())
{
script.AddScript("Get-appxpackage *Microsoft.549981C3F5F10* | Remove-AppxPackage");
try
{
script.Invoke();
}
catch
{ }
}
return true;
}
public override bool UndoSetting()
{
using (PowerShell script = PowerShell.Create())
{
script.AddScript("Get-AppXPackage -Name Microsoft.Windows.Cortana | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register \"$($_.InstallLocation)AppXManifest.xml}\"");
try
{
script.Invoke();
return true;
}
catch
{ }
return false;
}
}
}
}