64 lines
1.7 KiB
C#
64 lines
1.7 KiB
C#
using FlybyScript;
|
|
using Microsoft.Win32;
|
|
using System;
|
|
using System.Drawing;
|
|
|
|
namespace Settings.Ads
|
|
{
|
|
public class WelcomeExperienceAds : FeatureBase
|
|
{
|
|
public WelcomeExperienceAds(Logger logger) : base(logger)
|
|
{
|
|
}
|
|
|
|
private const string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager";
|
|
private const string valueName = "SubscribedContent-310093Enabled";
|
|
private const int desiredValue = 0;
|
|
|
|
public override string ID() => "Disable Welcome Experience Ads";
|
|
|
|
public override string Info() => "This feature will disable ads in the welcome experience.";
|
|
|
|
public override string GetRegistryKey()
|
|
{
|
|
return $"{keyName} | Value: {valueName} | Desired Value: {desiredValue}";
|
|
}
|
|
|
|
public override bool CheckFeature()
|
|
{
|
|
return Utils.IntEquals(keyName, valueName, 0);
|
|
}
|
|
|
|
public override bool DoFeature()
|
|
{
|
|
try
|
|
{
|
|
Registry.SetValue(keyName, valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);
|
|
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Log("Code red in " + ex.Message, Color.Red);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public override bool UndoFeature()
|
|
{
|
|
try
|
|
{
|
|
Registry.SetValue(keyName, valueName, 1, Microsoft.Win32.RegistryValueKind.DWord);
|
|
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Log("Code red in " + ex.Message, Color.Red);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
} |