Exemple #1
0
        protected IIntSetting GetIntSetting(int key, int defaultValue)
        {
            var setting = new IntSetting(this.data.IntValues, key, defaultValue);

            this.settings.Add(setting);
            return(setting);
        }
Exemple #2
0
        protected static void PushIntSetting(
            SettingScope scope,
            SettingProtection protectionLevel,
            string label,
            string name,
            int defaultVal,
            int minVal = int.MinValue,
            int maxVal = int.MaxValue,
            Func <int, string> translator = null,
            string postFix    = "",
            string maskerName = "",
            Func <SettingBase, bool> maskingEvaluator = null,
            bool dropdown = false)
        {
            SettingBase newSetting = new IntSetting(
                scope,
                protectionLevel,
                label,
                name,
                defaultVal,
                minVal: minVal,
                maxVal: maxVal,
                translator: translator,
                dropdown: dropdown,
                postFix: postFix);

            settings.Add(newSetting);
            nameSettingsMap.Add(name, newSetting);

            if (!string.IsNullOrEmpty(maskerName))
            {
                AddToMaskerMap(maskerName, name, maskingEvaluator);
            }
        }
        /// <summary>
        /// Appends a <paramref name="setting"/> in the form <code>SettingName = SettingValue</code>.
        /// The setting will be written only if the value is different from the default value in the
        /// corresponding <paramref name="parameter"/>.
        /// </summary>
        /// <param name="setting"></param>
        /// <param name="parameter"></param>
        public LoliCodeWriter AppendSetting(BlockSetting setting, BlockParameter parameter = null,
                                            int spaces = 2, bool printDefaults = false)
        {
            if (parameter == null)
            {
                AppendLine($"{setting.Name} = {GetSettingValue(setting)}", spaces);
                return(this);
            }

            var isDefaultValue = setting.FixedSetting switch
            {
                StringSetting x => x.Value == (parameter as StringParameter).DefaultValue,
                IntSetting x => x.Value == (parameter as IntParameter).DefaultValue,
                FloatSetting x => x.Value == (parameter as FloatParameter).DefaultValue,
                BoolSetting x => x.Value == (parameter as BoolParameter).DefaultValue,
                ByteArraySetting x => Compare(x.Value, (parameter as ByteArrayParameter).DefaultValue),
                ListOfStringsSetting x => Compare(x.Value, (parameter as ListOfStringsParameter).DefaultValue),
                DictionaryOfStringsSetting x =>
                Compare(x.Value?.Keys, (parameter as DictionaryOfStringsParameter).DefaultValue?.Keys) &&
                Compare(x.Value?.Values, (parameter as DictionaryOfStringsParameter).DefaultValue?.Values),
                EnumSetting x => x.Value == (parameter as EnumParameter).DefaultValue,
                _ => throw new NotImplementedException(),
            };

            if (setting.InputMode != SettingInputMode.Fixed || !isDefaultValue || printDefaults)
            {
                AppendLine($"{parameter.Name} = {GetSettingValue(setting)}", spaces);
            }

            return(this);
        }
Exemple #4
0
        protected override void initEditor()
        {
            IntSetting typedSetting = (IntSetting)setting;

            valueNumericField.Minimum = typedSetting.MinValue ?? -99999;
            valueNumericField.Maximum = typedSetting.MaxValue ?? 99999;

            List <string> hintTexts = new List <string>();

            if (typedSetting.MinValue != null)
            {
                hintTexts.Add(string.Format("min: {0}", typedSetting.MinValue));
            }
            if (typedSetting.MaxValue != null)
            {
                hintTexts.Add(string.Format("max: {0}", typedSetting.MaxValue));
            }

            if (hintTexts.Count > 0)
            {
                minMaxHintLabel.Text = string.Format("({0})", string.Join(", ", hintTexts.ToArray()));
            }
            else
            {
                minMaxHintLabel.Text = "";
            }
        }
Exemple #5
0
        private void IntSettingEditor_Load(object sender, EventArgs e)
        {
            IntSetting typedSetting = (IntSetting)setting;

            valueNumericField.Minimum = typedSetting.MinValue ?? -99999;
            valueNumericField.Maximum = typedSetting.MaxValue ?? 99999;
            valueNumericField.Value   = typedSetting.Value;

            List <string> hintTexts = new List <string>();

            if (typedSetting.MinValue != null)
            {
                hintTexts.Add(string.Format("min: {0}", typedSetting.MinValue));
            }
            if (typedSetting.MaxValue != null)
            {
                hintTexts.Add(string.Format("max: {0}", typedSetting.MaxValue));
            }

            if (hintTexts.Count > 0)
            {
                minMaxHintLabel.Text = string.Format("({0})", string.Join(", ", hintTexts.ToArray()));
            }
            else
            {
                minMaxHintLabel.Text = "";
            }
        }
Exemple #6
0
 private static int SetScaling(IntSetting set)
 {
     if (!UIManager.HUDAutoScaleGUI.Value)
     {
         return(set.Value);
     }
     return(Mathf.RoundToInt(set.DefaultValue * UIManager.HUDScaleGUI.Value));
 }
        public IFontManager GetFontManager(ISettings settings)
        {
            string defaultFontName  = "SourceCodePro-Regular";
            int    defaultSize      = 14;
            var    _currentFontName = new StringSetting("CurrentFontName", defaultFontName, settings);
            var    _currentFontSize = new IntSetting("CurrentFontSize", defaultSize, settings);

            return(new FontManager(_currentFontName, _currentFontSize));
        }
        void Init(Rect screenActivatorRect, CodeCompletionWindowInput input, ISettings settings)
        {
            _input         = input;
            _activatorRect = screenActivatorRect;
            _userWidth     = settings.GetSetting("PopupUserWidth") as IntSetting ?? new IntSetting("PopupUserWidth", -1, settings);
            _userHeight    = settings.GetSetting("PopupUserHeight") as IntSetting ?? new IntSetting("PopupUserHeight", -1, settings);

            ShowAsDropDown(screenActivatorRect, GetWindowSize());
            Repaint();
        }
Exemple #9
0
        public static ConfigSetting LoadSetting(XmlElement xmlElement)
        {
            var configSetting = new ConfigSetting();
            var type          = GetAttribute(xmlElement, "type", null);

            if (type == "enum")
            {
                var enumSetting          = new EnumSetting();
                var configOptionElements = xmlElement.SelectNodes("./ConfigOption").OfType <XmlElement>();
                foreach (var configOptionElement in configOptionElements)
                {
                    var enumOption = new EnumOption();
                    enumOption.Name  = GetAttribute(configOptionElement, "name", null);
                    enumOption.Title = GetAttribute(configOptionElement, "title", null);
                    enumOption.Desc  = GetAttribute(configOptionElement, "desc", null);
                    enumSetting.Options.Add(enumOption);
                }

                configSetting = enumSetting;
            }

            if (type == "int")
            {
                var intSetting = new IntSetting();
                intSetting.Min = GetAttribute(xmlElement, "min");
                intSetting.Max = GetAttribute(xmlElement, "max");
                configSetting  = intSetting;
            }

            if (type == "certificate")
            {
                var certificateSetting = new CertificateSetting();
                certificateSetting.IsSsl             = GetBoolAttribute(xmlElement, "isSsl") ?? false;
                certificateSetting.CanGenerate       = GetBoolAttribute(xmlElement, "canGenerate") ?? true;
                certificateSetting.CanExport         = GetBoolAttribute(xmlElement, "canExport") ?? true;
                certificateSetting.CanImport         = GetBoolAttribute(xmlElement, "canImport") ?? true;
                certificateSetting.CanSelect         = GetBoolAttribute(xmlElement, "canSelect") ?? false;
                certificateSetting.CanRemove         = GetBoolAttribute(xmlElement, "canRemove") ?? false;
                certificateSetting.RequirePrivateKey = GetBoolAttribute(xmlElement, "requirePrivateKey") ?? true;
                configSetting = certificateSetting;
            }

            configSetting.Name     = GetAttribute(xmlElement, "name", null);
            configSetting.Default  = GetAttribute(xmlElement, "default", null);
            configSetting.Enabled  = GetAttribute(xmlElement, "enabled", null);
            configSetting.Required = Convert.ToBoolean(GetAttribute(xmlElement, "required", "false"));
            configSetting.Title    = GetAttribute(xmlElement, "title", null);
            configSetting.Type     = GetAttribute(xmlElement, "type", null);
            configSetting.XPath    = GetAttribute(xmlElement, "xpath", null);
            return(configSetting);
        }
Exemple #10
0
 static Config()
 {
     LicensePath          = new StringSetting("Mileage/LicensePath", string.Empty);
     EnableDefaultMetrics = new BoolSetting("Mileage/EnableDefaultMetrics", false);
     CompressResponses    = new BoolSetting("Mileage/CompressResponses", true);
     EnableDebugRequestResponseLogging = new BoolSetting("Mileage/EnableDebugRequestResponseLogging", false);
     FormatResponses       = new BoolSetting("Mileage/FormatResponses", false);
     RavenHttpServerPort   = new IntSetting("Mileage/RavenHttpServerPort", 8000);
     RavenName             = new StringSetting("Mileage/RavenName", "Mileage");
     EnableRavenHttpServer = new BoolSetting("Mileage/EnableRavenHttpServer", false);
     Addresses             = new UriListSetting("Mileage/Addresses", new List <Uri>()
     {
         new Uri("http://localhost")
     }, "|");
 }
Exemple #11
0
        public void SettingTestIntBoolFalse()
        {
            const int value   = 0;
            var       setting = new IntSetting()
            {
                Category           = "none",
                Description        = "none",
                HumanReadableName  = "Test setting",
                IdentificationName = "mySetting",
                Value = value
            };

            bool convSetting = (bool)setting;

            Assert.AreEqual(false, convSetting);
        }
        public SettingsDialog(ITextView textView)
        {
            _settings             = textView.Settings;
            _mouseCursorsRegions  = textView.MouseCursorsRegions;
            _mouseCursors         = textView.MouseCursors;
            _fontManager          = textView.FontManager;
            _classificationStyler = textView.Document.ClassificationStyler;
            _appearance           = textView.Appearance;

            _colorSchemeIndex          = new IntSetting("ColorSchemeIndex", 0, _settings);
            _colorSchemeIndex.Changed += (sender, args) => SetClassificationColors();

            _fontSizes      = _fontManager.GetCurrentFontSizes();
            _fontSizesNames = _fontSizes.Select(size => new GUIContent(size.ToString())).ToArray();
            SetClassificationColors();
        }
Exemple #13
0
        public void SettingTestIntString()
        {
            const int value   = 555;
            var       setting = new IntSetting()
            {
                Category           = "none",
                Description        = "none",
                HumanReadableName  = "Test setting",
                IdentificationName = "mySetting",
                Value = value
            };

            string convSetting = (string)setting;

            Assert.AreEqual(value.ToString(), convSetting);
        }
Exemple #14
0
        public void SettingTestIntFloat()
        {
            const float value   = 1234.5678f;
            var         setting = new IntSetting()
            {
                Category           = "none",
                Description        = "none",
                HumanReadableName  = "Test setting",
                IdentificationName = "mySetting",
                Value = (int)value
            };

            int convSetting = (int)setting;

            Assert.AreEqual((int)value, convSetting);
        }
Exemple #15
0
        private static IntSetting ParseIntSetting(string line, string prefix)
        {
            var result = new IntSetting();
            var strret = ParseStringSetting(line, prefix);

            if (strret.IsValid)
            {
                string text  = strret.Value;
                int    value = 0;
                if (int.TryParse(text, out value))
                {
                    result.IsValid = true;
                    result.Value   = value;
                }
            }
            return(result);
        }
Exemple #16
0
        public void SettingsManagerTestIndexingTest()
        {
            var manager = new SettingsManager(null);

            const string settingKey   = "TestSetting";
            const int    settingValue = 345;

            var s = new IntSetting()
            {
                Category           = "none",
                HumanReadableName  = "none",
                Description        = "none",
                IdentificationName = settingKey,
                Value = settingValue
            };

            manager.AddSetting(s);

            Assert.AreEqual(settingValue, (int)manager[settingKey]);
        }
    public void incrementInt(string key)
    {
        for (int i = 0; i < intSettings.Count; i++)
        {
            if (key.ToLower() == intSettings[i].key.ToLower())
            {
                intSettings[i].setting += 1;
                return;
            }
        }

        IntSetting newSetting = new IntSetting();

        newSetting.key     = key;
        newSetting.setting = 1;

        intSettings.Add(newSetting);

        Debug.Log("Couldn't find a setting with the name " + key);
    }
        private List <Setting> getSettings()
        {
            _propertyDict = new Dictionary <Setting, System.Reflection.PropertyInfo>();

            string[] ignored = { "Type", "AllowedInteractionModes" };

            var detailsSettings = new List <Setting>();

            Type t     = _command.Control.GetType();
            var  props = t.GetProperties().Where(p => !ignored.Contains(p.Name));

            int     i = 0;
            Setting s = null;
            string  name;

            foreach (var p in props)
            {
                Type targetType = p.PropertyType;
                name = p.Name;

                switch (name)
                {
                case "Invert":
                case "Blend":
                    s = new BoolSetting(i++, name + ":");
                    break;

                case "SoftTakeOver":
                    s = new BoolSetting(i++, "Soft Takeover:");
                    break;

                case "AutoRepeat":
                    s = new BoolSetting(i++, "Auto Repeat:");
                    break;

                case "RotaryAcceleration":
                    s = new IntSetting(i++, "Rotary Acceleration:", 0, 100);
                    break;

                case "RotarySensitivity":
                    s = new IntSetting(i++, "Rotary Sensitivity:", 0, 300);
                    break;

                case "Mode":
                case "EncoderMode":
                    AGenericMidiDefinition midiBinding = (this._mappings.First().MidiBinding as AGenericMidiDefinition);
                    if (midiBinding != null)
                    {
                        MidiEncoderMode actual_encoder_mode = midiBinding.MidiEncoderMode;
                        _command.set_EncoderMode(actual_encoder_mode);
                    }
                    s = new EnumSetting <MidiEncoderMode>(i++, name + ":");
                    break;

                case "MidiRangeMin":
                    // pestrela 2020/04/11: there is no source code to "IntSetting", comes from "SettingControlLibrary.dll" that is pre-compiled.
                    //s = new IntSetting(i++, "MIDI Range Min:", 0, 127);

                    // pestrela: replaced this with a realy large enum.
                    s = new EnumSetting <MidiOutRange>(i++, "MIDI Range Min:");
                    break;

                case "MidiRangeMax":
                    // s = new IntSetting(i++, "MIDI Range Max:", 0, 127);
                    s = new EnumSetting <MidiOutRange>(i++, "MIDI Range Max:");
                    break;

                case "Resolution":
                    s = new EnumSetting <MappingResolution>(i++, name + ":");
                    break;

                default:
                    s = null;
                    break;
                }

                if (s != null)
                {
                    object rawValue = p.GetValue(_command.Control, null);

                    s.TryParse(rawValue.ToString());
                    s.AcceptChanges();
                    detailsSettings.Add(s);
                    _propertyDict.Add(s, p);
                    s.PropertyChanged += s_PropertyChanged;
                }
                else
                {
                    // Datatype not supported
                }
            }
            return(detailsSettings);
        }
Exemple #19
0
 public IntSettingViewModel(IntSetting setting)
     : base(setting)
 {
     Text = setting.DefaultValue.ToString();
 }
        protected UserINISettings(IniFile iniFile)
        {
            SettingsIni = iniFile;

#if YR || ARES
            const string WINDOWED_MODE_KEY = "Video.Windowed";
            BackBufferInVRAM = new BoolSetting(iniFile, VIDEO, "VideoBackBuffer", false);
#else
            const string WINDOWED_MODE_KEY = "Video.Windowed";
            BackBufferInVRAM = new BoolSetting(iniFile, VIDEO, "UseGraphicsPatch", true);
#endif

            IngameScreenWidth      = new IntSetting(iniFile, VIDEO, "ScreenWidth", 1024);
            IngameScreenHeight     = new IntSetting(iniFile, VIDEO, "ScreenHeight", 768);
            ClientTheme            = new StringSetting(iniFile, MULTIPLAYER, "Theme", string.Empty);
            DetailLevel            = new IntSetting(iniFile, OPTIONS, "DetailLevel", 2);
            Renderer               = new StringSetting(iniFile, COMPATIBILITY, "Renderer", string.Empty);
            WindowedMode           = new BoolSetting(iniFile, VIDEO, WINDOWED_MODE_KEY, false);
            BorderlessWindowedMode = new BoolSetting(iniFile, VIDEO, "NoWindowFrame", false);

            ClientResolutionX        = new IntSetting(iniFile, VIDEO, "ClientResolutionX", Screen.PrimaryScreen.Bounds.Width);
            ClientResolutionY        = new IntSetting(iniFile, VIDEO, "ClientResolutionY", Screen.PrimaryScreen.Bounds.Height);
            BorderlessWindowedClient = new BoolSetting(iniFile, VIDEO, "BorderlessWindowedClient", true);
            ClientFPS = new IntSetting(iniFile, VIDEO, "ClientFPS", 60);

            ScoreVolume       = new DoubleSetting(iniFile, AUDIO, "ScoreVolume", 0.7);
            SoundVolume       = new DoubleSetting(iniFile, AUDIO, "SoundVolume", 0.7);
            VoiceVolume       = new DoubleSetting(iniFile, AUDIO, "VoiceVolume", 0.7);
            IsScoreShuffle    = new BoolSetting(iniFile, AUDIO, "IsScoreShuffle", true);
            ClientVolume      = new DoubleSetting(iniFile, AUDIO, "ClientVolume", 1.0);
            PlayMainMenuMusic = new BoolSetting(iniFile, AUDIO, "PlayMainMenuMusic", true);
            StopMusicOnMenu   = new BoolSetting(iniFile, AUDIO, "StopMusicOnMenu", true);
            MessageSound      = new BoolSetting(iniFile, AUDIO, "ChatMessageSound", true);

            ScrollRate          = new IntSetting(iniFile, OPTIONS, "ScrollRate", 3);
            TargetLines         = new BoolSetting(iniFile, OPTIONS, "UnitActionLines", true);
            ScrollCoasting      = new IntSetting(iniFile, OPTIONS, "ScrollMethod", 0);
            Tooltips            = new BoolSetting(iniFile, OPTIONS, "ToolTips", true);
            ShowHiddenObjects   = new BoolSetting(iniFile, OPTIONS, "ShowHidden", true);
            MoveToUndeploy      = new BoolSetting(iniFile, OPTIONS, "MoveToUndeploy", true);
            TextBackgroundColor = new IntSetting(iniFile, OPTIONS, "TextBackgroundColor", 0);
            DragDistance        = new IntSetting(iniFile, OPTIONS, "DragDistance", 4);
            DoubleTapInterval   = new IntSetting(iniFile, OPTIONS, "DoubleTapInterval", 30);
            Win8CompatMode      = new StringSetting(iniFile, OPTIONS, "Win8Compat", "No");

            PlayerName = new StringSetting(iniFile, MULTIPLAYER, "Handle", string.Empty);

            ChatColor    = new IntSetting(iniFile, MULTIPLAYER, "ChatColor", -1);
            LANChatColor = new IntSetting(iniFile, MULTIPLAYER, "LANChatColor", -1);
            PingUnofficialCnCNetTunnels = new BoolSetting(iniFile, MULTIPLAYER, "PingCustomTunnels", true);
            WritePathToRegistry         = new BoolSetting(iniFile, OPTIONS, "WriteInstallationPathToRegistry", true);
            PlaySoundOnGameHosted       = new BoolSetting(iniFile, MULTIPLAYER, "PlaySoundOnGameHosted", true);
            SkipConnectDialog           = new BoolSetting(iniFile, MULTIPLAYER, "SkipConnectDialog", false);
            PersistentMode                  = new BoolSetting(iniFile, MULTIPLAYER, "PersistentMode", false);
            AutomaticCnCNetLogin            = new BoolSetting(iniFile, MULTIPLAYER, "AutomaticCnCNetLogin", false);
            DiscordIntegration              = new BoolSetting(iniFile, MULTIPLAYER, "DiscordIntegration", true);
            AllowGameInvitesFromFriendsOnly = new BoolSetting(iniFile, MULTIPLAYER, "AllowGameInvitesFromFriendsOnly", false);
            NotifyOnUserListChange          = new BoolSetting(iniFile, MULTIPLAYER, "NotifyOnUserListChange", true);
            DisablePrivateMessagePopups     = new BoolSetting(iniFile, MULTIPLAYER, "DisablePrivateMessagePopups", false);
            AllowPrivateMessagesFromState   = new IntSetting(iniFile, MULTIPLAYER, "AllowPrivateMessagesFromState", (int)AllowPrivateMessagesFromEnum.All);
            EnableMapSharing                = new BoolSetting(iniFile, MULTIPLAYER, "EnableMapSharing", true);
            AlwaysDisplayTunnelList         = new BoolSetting(iniFile, MULTIPLAYER, "AlwaysDisplayTunnelList", false);

            CheckForUpdates = new BoolSetting(iniFile, OPTIONS, "CheckforUpdates", true);

            PrivacyPolicyAccepted  = new BoolSetting(iniFile, OPTIONS, "PrivacyPolicyAccepted", false);
            IsFirstRun             = new BoolSetting(iniFile, OPTIONS, "IsFirstRun", true);
            CustomComponentsDenied = new BoolSetting(iniFile, OPTIONS, "CustomComponentsDenied", false);
            Difficulty             = new IntSetting(iniFile, OPTIONS, "Difficulty", 1);
            ScrollDelay            = new IntSetting(iniFile, OPTIONS, "ScrollDelay", 4);
            GameSpeed                     = new IntSetting(iniFile, OPTIONS, "GameSpeed", 1);
            PreloadMapPreviews            = new BoolSetting(iniFile, VIDEO, "PreloadMapPreviews", false);
            ForceLowestDetailLevel        = new BoolSetting(iniFile, VIDEO, "ForceLowestDetailLevel", false);
            MinimizeWindowsOnGameStart    = new BoolSetting(iniFile, OPTIONS, "MinimizeWindowsOnGameStart", true);
            AutoRemoveUnderscoresFromName = new BoolSetting(iniFile, OPTIONS, "AutoRemoveUnderscoresFromName", true);

            SortState             = new IntSetting(iniFile, GAME_FILTERS, "SortState", (int)SortDirection.None);
            ShowFriendGamesOnly   = new BoolSetting(iniFile, GAME_FILTERS, "ShowFriendGamesOnly", DEFAULT_SHOW_FRIENDS_ONLY_GAMES);
            HideLockedGames       = new BoolSetting(iniFile, GAME_FILTERS, "HideLockedGames", DEFAULT_HIDE_LOCKED_GAMES);
            HidePasswordedGames   = new BoolSetting(iniFile, GAME_FILTERS, "HidePasswordedGames", DEFAULT_HIDE_PASSWORDED_GAMES);
            HideIncompatibleGames = new BoolSetting(iniFile, GAME_FILTERS, "HideIncompatibleGames", DEFAULT_HIDE_INCOMPATIBLE_GAMES);
            MaxPlayerCount        = new IntRangeSetting(iniFile, GAME_FILTERS, "MaxPlayerCount", DEFAULT_MAX_PLAYER_COUNT, 2, 8);

            FavoriteMaps = new StringListSetting(iniFile, OPTIONS, "FavoriteMaps", new List <string>());
        }
 public static int GetSetting( IntSetting key )
 {
    return PlayerPrefs.GetInt( Enum.GetName( key.GetType(), key ) );
 }
 public static void SetSetting( IntSetting key, int value )
 {
    PlayerPrefs.SetInt( Enum.GetName( key.GetType(), key ), value );
    PlayerPrefs.Save();
 }
Exemple #23
0
 public FontManager(StringSetting currentFontName, IntSetting currentFontSize)
 {
     _currentFontName = currentFontName;
     _currentFontSize = currentFontSize;
     InitIfNeeded();
 }
Exemple #24
0
        protected UserINISettings(IniFile iniFile)
        {
            SettingsIni = iniFile;

            const string VIDEO       = "Video";
            const string MULTIPLAYER = "MultiPlayer";
            const string OPTIONS     = "Options";
            const string AUDIO       = "Audio";

#if YR || ARES
            const string WINDOWED_MODE_KEY = "Video.Windowed";
            BackBufferInVRAM = new BoolSetting(iniFile, VIDEO, "VideoBackBuffer", false);
#else
            const string WINDOWED_MODE_KEY = "Video.Windowed";
            BackBufferInVRAM = new BoolSetting(iniFile, VIDEO, "UseGraphicsPatch", true);
#endif

            IngameScreenWidth      = new IntSetting(iniFile, VIDEO, "ScreenWidth", 1024);
            IngameScreenHeight     = new IntSetting(iniFile, VIDEO, "ScreenHeight", 768);
            ClientTheme            = new StringSetting(iniFile, MULTIPLAYER, "Theme", string.Empty);
            DetailLevel            = new IntSetting(iniFile, OPTIONS, "DetailLevel", 2);
            Renderer               = new StringSetting(iniFile, "Compatibility", "Renderer", string.Empty);
            WindowedMode           = new BoolSetting(iniFile, VIDEO, WINDOWED_MODE_KEY, false);
            BorderlessWindowedMode = new BoolSetting(iniFile, VIDEO, "NoWindowFrame", false);

            ClientResolutionX        = new IntSetting(iniFile, VIDEO, "ClientResolutionX", Screen.PrimaryScreen.Bounds.Width);
            ClientResolutionY        = new IntSetting(iniFile, VIDEO, "ClientResolutionY", Screen.PrimaryScreen.Bounds.Height);
            BorderlessWindowedClient = new BoolSetting(iniFile, VIDEO, "BorderlessWindowedClient", true);

            ScoreVolume       = new DoubleSetting(iniFile, AUDIO, "ScoreVolume", 0.7);
            SoundVolume       = new DoubleSetting(iniFile, AUDIO, "SoundVolume", 0.7);
            VoiceVolume       = new DoubleSetting(iniFile, AUDIO, "VoiceVolume", 0.7);
            IsScoreShuffle    = new BoolSetting(iniFile, AUDIO, "IsScoreShuffle", true);
            ClientVolume      = new DoubleSetting(iniFile, AUDIO, "ClientVolume", 1.0);
            PlayMainMenuMusic = new BoolSetting(iniFile, AUDIO, "PlayMainMenuMusic", true);
            StopMusicOnMenu   = new BoolSetting(iniFile, AUDIO, "StopMusicOnMenu", true);
            MessageSound      = new BoolSetting(iniFile, AUDIO, "ChatMessageSound", true);

            ScrollRate          = new IntSetting(iniFile, OPTIONS, "ScrollRate", 3);
            TargetLines         = new BoolSetting(iniFile, OPTIONS, "UnitActionLines", true);
            ScrollCoasting      = new IntSetting(iniFile, OPTIONS, "ScrollMethod", 0);
            Tooltips            = new BoolSetting(iniFile, OPTIONS, "ToolTips", true);
            ShowHiddenObjects   = new BoolSetting(iniFile, OPTIONS, "ShowHidden", true);
            MoveToUndeploy      = new BoolSetting(iniFile, OPTIONS, "MoveToUndeploy", true);
            TextBackgroundColor = new IntSetting(iniFile, OPTIONS, "TextBackgroundColor", 0);
            DragDistance        = new IntSetting(iniFile, OPTIONS, "DragDistance", 4);
            DoubleTapInterval   = new IntSetting(iniFile, OPTIONS, "DoubleTapInterval", 30);
            Win8CompatMode      = new StringSetting(iniFile, OPTIONS, "Win8Compat", "No");

            PlayerName = new StringSetting(iniFile, MULTIPLAYER, "Handle", string.Empty);

            ChatColor    = new IntSetting(iniFile, MULTIPLAYER, "ChatColor", -1);
            LANChatColor = new IntSetting(iniFile, MULTIPLAYER, "LANChatColor", -1);
            PingUnofficialCnCNetTunnels = new BoolSetting(iniFile, MULTIPLAYER, "PingCustomTunnels", true);
            WritePathToRegistry         = new BoolSetting(iniFile, OPTIONS, "WriteInstallationPathToRegistry", true);
            PlaySoundOnGameHosted       = new BoolSetting(iniFile, MULTIPLAYER, "PlaySoundOnGameHosted", true);
            SkipConnectDialog           = new BoolSetting(iniFile, MULTIPLAYER, "SkipConnectDialog", false);
            PersistentMode                  = new BoolSetting(iniFile, MULTIPLAYER, "PersistentMode", false);
            AutomaticCnCNetLogin            = new BoolSetting(iniFile, MULTIPLAYER, "AutomaticCnCNetLogin", false);
            DiscordIntegration              = new BoolSetting(iniFile, MULTIPLAYER, "DiscordIntegration", true);
            AllowGameInvitesFromFriendsOnly = new BoolSetting(iniFile, MULTIPLAYER, "AllowGameInvitesFromFriendsOnly", false);
            NotifyOnUserListChange          = new BoolSetting(iniFile, MULTIPLAYER, "NotifyOnUserListChange", true);
            EnableMapSharing                = new BoolSetting(iniFile, MULTIPLAYER, "EnableMapSharing", true);
            AlwaysDisplayTunnelList         = new BoolSetting(iniFile, MULTIPLAYER, "AlwaysDisplayTunnelList", false);

            CheckForUpdates = new BoolSetting(iniFile, OPTIONS, "CheckforUpdates", true);

            PrivacyPolicyAccepted  = new BoolSetting(iniFile, OPTIONS, "PrivacyPolicyAccepted", false);
            IsFirstRun             = new BoolSetting(iniFile, OPTIONS, "IsFirstRun", true);
            CustomComponentsDenied = new BoolSetting(iniFile, OPTIONS, "CustomComponentsDenied", false);
            Difficulty             = new IntSetting(iniFile, OPTIONS, "Difficulty", 1);
            ScrollDelay            = new IntSetting(iniFile, OPTIONS, "ScrollDelay", 4);
            GameSpeed                     = new IntSetting(iniFile, OPTIONS, "GameSpeed", 1);
            PreloadMapPreviews            = new BoolSetting(iniFile, VIDEO, "PreloadMapPreviews", false);
            ForceLowestDetailLevel        = new BoolSetting(iniFile, VIDEO, "ForceLowestDetailLevel", false);
            MinimizeWindowsOnGameStart    = new BoolSetting(iniFile, OPTIONS, "MinimizeWindowsOnGameStart", true);
            AutoRemoveUnderscoresFromName = new BoolSetting(iniFile, OPTIONS, "AutoRemoveUnderscoresFromName", true);
        }
        private List <Setting> getSettings()
        {
            _propertyDict = new Dictionary <Setting, System.Reflection.PropertyInfo>();

            string[] ignored = { "Type", "AllowedInteractionModes" };

            var detailsSettings = new List <Setting>();

            Type t     = _command.Control.GetType();
            var  props = t.GetProperties().Where(p => !ignored.Contains(p.Name));

            int     i = 0;
            Setting s = null;
            string  name;

            foreach (var p in props)
            {
                Type targetType = p.PropertyType;
                name = p.Name;

                switch (name)
                {
                case "Invert":
                case "Blend":
                    s = new BoolSetting(i++, name + ":");
                    break;

                case "SoftTakeOver":
                    s = new BoolSetting(i++, "Soft Takeover:");
                    break;

                case "AutoRepeat":
                    s = new BoolSetting(i++, "Auto Repeat:");
                    break;

                case "RotaryAcceleration":
                    s = new IntSetting(i++, "Rotary Acceleration:", 0, 100);
                    break;

                case "RotarySensitivity":
                    s = new IntSetting(i++, "Rotary Sensitivity:", 0, 300);
                    break;

                case "Mode":
                    s = new EnumSetting <MidiEncoderMode>(i++, name + ":");
                    break;

                case "MidiRangeMin":
                    s = new IntSetting(i++, "MIDI Range Min:", 0, 127);
                    break;

                case "MidiRangeMax":
                    s = new IntSetting(i++, "MIDI Range Max:", 0, 127);
                    break;

                case "Resolution":
                    s = new EnumSetting <MappingResolution>(i++, name + ":");
                    break;

                default:
                    s = null;
                    break;
                }

                if (s != null)
                {
                    object rawValue = p.GetValue(_command.Control, null);

                    s.TryParse(rawValue.ToString());
                    s.AcceptChanges();
                    detailsSettings.Add(s);
                    _propertyDict.Add(s, p);
                    s.PropertyChanged += s_PropertyChanged;
                }
                else
                {
                    // Datatype not supported
                }
            }
            return(detailsSettings);
        }