privatezilla/src/Privatezilla/Privatezilla/Settings/Apps/OtherDevices.cs
2020-09-20 19:08:59 +02:00

57 lines
No EOL
1.6 KiB
C#

using Microsoft.Win32;
namespace Privatezilla.Setting.Apps
{
internal class OtherDevices: SettingBase
{
private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\bluetooth";
private const string AppKey2 = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\bluetoothSync";
private const string DesiredValue ="Deny";
public override string ID()
{
return Properties.Resources.settingsAppsOtherDevices;
}
public override string Info()
{
return "";
}
public override bool CheckSetting()
{
return !(
RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) &&
RegistryHelper.StringEquals(AppKey2, "Value", DesiredValue)
);
}
public override bool DoSetting()
{
try
{
Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String);
Registry.SetValue(AppKey2, "Value", DesiredValue, RegistryValueKind.String);
return true;
}
catch
{ }
return false;
}
public override bool UndoSetting()
{
try
{
Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String);
return true;
}
catch
{ }
return false;
}
}
}