Delete UninstallCortana.cs
This commit is contained in:
parent
dd515a1c84
commit
b750b0cb59
1 changed files with 0 additions and 70 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue