privatezilla/src/Privatezilla/Settings/Privacy/DisableMSExperiments.cs
2020-09-18 23:10:17 +02:00

55 lines
No EOL
1.4 KiB
C#

using Microsoft.Win32;
namespace Privatezilla.Setting.Privacy
{
internal class DisableMSExperiments: SettingBase
{
private const string ExperimentationKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\System";
private const int DesiredValue = 0;
public override string ID()
{
return Properties.Resources.settingsPrivacyDisableMSExperiments;
}
public override string Info()
{
return Properties.Resources.settingsPrivacyDisableMSExperimentsInfo;
}
public override bool CheckSetting()
{
return !(
RegistryHelper.IntEquals(ExperimentationKey, "AllowExperimentation", DesiredValue)
);
}
public override bool DoSetting()
{
try
{
Registry.SetValue(ExperimentationKey, "AllowExperimentation", DesiredValue, RegistryValueKind.DWord);
return true;
}
catch
{ }
return false;
}
public override bool UndoSetting()
{
try
{
Registry.SetValue(ExperimentationKey, "AllowExperimentation", 1, RegistryValueKind.DWord);
return true;
}
catch
{ }
return false;
}
}
}