using System; using System.Linq; using System.Windows.Forms; using System.Drawing; using System.IO; using Newtonsoft.Json; namespace Optimizer { [Serializable] public class SettingsJson { public Theme Color { get; set; } public bool EnablePerformanceTweaks { get; set; } public bool DisableNetworkThrottling { get; set; } public bool DisableWindowsDefender { get; set; } public bool DisableSystemRestore { get; set; } public bool DisablePrintService { get; set; } public bool DisableMediaPlayerSharing { get; set; } public bool BlockSkypeAds { get; set; } public bool DisableErrorReporting { get; set; } public bool DisableHomeGroup { get; set; } public bool DisableSuperfetch { get; set; } public bool DisableTelemetryTasks { get; set; } public bool DisableOffice2016Telemetry { get; set; } public bool DisableCompatibilityAssistant { get; set; } public bool DisableFaxService { get; set; } public bool DisableSmartScreen { get; set; } public bool DisableCloudClipboard { get; set; } public bool DisableStickyKeys { get; set; } public bool EnableLegacyVolumeSlider { get; set; } public bool EnableTaskbarColor { get; set; } public bool DisableQuickAccessHistory { get; set; } public bool DisableStartMenuAds { get; set; } public bool EnableDarkTheme { get; set; } public bool UninstallOneDrive { get; set; } public bool DisableMyPeople { get; set; } public bool DisableAutomaticUpdates { get; set; } public bool ExcludeDrivers { get; set; } public bool DisableTelemetryServices { get; set; } public bool DisablePrivacyOptions { get; set; } public bool DisableSilentAppInstall { get; set; } public bool DisableCortana { get; set; } public bool DisableSensorServices { get; set; } public bool DisableWindowsInk { get; set; } public bool DisableSpellingTyping { get; set; } public bool DisableXboxLive { get; set; } public bool DisableGameBar { get; set; } public bool DisableInsiderService { get; set; } public bool DisableFeatureUpdates { get; set; } public bool EnableLongPaths { get; set; } public bool DisableOneDrive { get; set; } } internal static class Options { readonly static string _themeFlag = "themeable"; internal readonly static string SettingsFile = Required.CoreFolder + "\\Optimizer.json"; internal static SettingsJson CurrentOptions = new SettingsJson(); internal static void ApplyTheme(Form f) { switch (CurrentOptions.Color) { case Theme.Caramel: SetTheme(f, Color.DarkOrange, Color.Chocolate); break; case Theme.Lime: SetTheme(f, Color.LimeGreen, Color.ForestGreen); break; case Theme.Magma: SetTheme(f, Color.Tomato, Color.Red); break; case Theme.Minimal: SetTheme(f, Color.Gray, Color.DimGray); break; case Theme.Ocean: SetTheme(f, Color.DodgerBlue, Color.RoyalBlue); break; case Theme.Zerg: SetTheme(f, Color.MediumOrchid, Color.DarkOrchid); break; } } private static void SetTheme(Form f, Color c1, Color c2) { Utilities.GetSelfAndChildrenRecursive(f).OfType