using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Drawing; using System.IO; using System.Linq; using System.Windows.Forms; namespace Optimizer { [Serializable] public class SettingsJson { public Theme Color { get; set; } public string AppsFolder { get; set; } public bool EnableTray { get; set; } public bool ShowHelp { get; set; } public LanguageCode LanguageCode { get; set; } // universal 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 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; } // windows 10 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 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 RemoveCastToDevice { get; set; } public bool DisableActionCenter { get; set; } // windows 8 public bool DisableOneDrive { get; set; } // windows 11 public bool TaskbarToLeft { get; set; } public bool DisableSnapAssist { get; set; } public bool DisableWidgets { get; set; } public bool DisableChat { get; set; } public bool TaskbarSmaller { get; set; } public bool ClassicRibbon { get; set; } public bool ClassicMenu { get; set; } public bool DisableTPMCheck { get; set; } } internal static class Options { internal static Color ForegroundColor = Color.MediumOrchid; internal static Color ForegroundAccentColor = Color.DarkOrchid; internal static Color BackgroundColor = Color.FromArgb(((int)(((byte)(10)))), ((int)(((byte)(10)))), ((int)(((byte)(10))))); readonly static string _themeFlag = "themeable"; internal readonly static string SettingsFile = Required.CoreFolder + "\\Optimizer.json"; internal static SettingsJson CurrentOptions = new SettingsJson(); internal static dynamic TranslationList; internal static void ApplyTheme(Form f) { switch (CurrentOptions.Color) { case Theme.Caramel: SetTheme(f, Color.DarkOrange, Color.Chocolate); ForegroundColor = Color.DarkOrange; ForegroundAccentColor = Color.Chocolate; break; case Theme.Lime: SetTheme(f, Color.LimeGreen, Color.ForestGreen); ForegroundColor = Color.LimeGreen; ForegroundAccentColor = Color.ForestGreen; break; case Theme.Magma: SetTheme(f, Color.Tomato, Color.Red); ForegroundColor = Color.Tomato; ForegroundAccentColor = Color.Red; break; case Theme.Minimal: SetTheme(f, Color.Gray, Color.DimGray); ForegroundColor = Color.Gray; ForegroundAccentColor = Color.DimGray; break; case Theme.Ocean: SetTheme(f, Color.DodgerBlue, Color.RoyalBlue); ForegroundColor = Color.DodgerBlue; ForegroundAccentColor = Color.RoyalBlue; break; case Theme.Zerg: SetTheme(f, Color.MediumOrchid, Color.DarkOrchid); ForegroundColor = Color.MediumOrchid; ForegroundAccentColor = Color.DarkOrchid; break; } } private static void SetTheme(Form f, Color c1, Color c2) { Utilities.GetSelfAndChildrenRecursive(f).OfType