Пример #1
0
        void LoadOptions()
        {
            try
            {
                RollHP                     = CoreSettings.LoadBoolValue("RollHP", false);
                UseCore                    = CoreSettings.LoadBoolValue("UseCore", true);
                UseAPG                     = CoreSettings.LoadBoolValue("UseAPG", true);
                UseChronicles              = CoreSettings.LoadBoolValue("UseChronicles", true);
                UseModules                 = CoreSettings.LoadBoolValue("UseModules", true);
                UseUltimateMagic           = CoreSettings.LoadBoolValue("UseUltimateMagic", true);
                UseUltimateCombat          = CoreSettings.LoadBoolValue("UseUltimateCombat", true);
                UseOther                   = CoreSettings.LoadBoolValue("UseOther", true);
                ConfirmCharacterDelete     = CoreSettings.LoadBoolValue("ConfirmCharacterDelete", false);
                ConfirmInitiativeRoll      = CoreSettings.LoadBoolValue("ConfirmInitiativeRoll", false);
                ConfirmClose               = CoreSettings.LoadBoolValue("ConfirmClose", false);
                ShowAllDamageDice          = CoreSettings.LoadBoolValue("ShowAllDamageDice", false);
                PlayerMiniMode             = CoreSettings.LoadBoolValue("PlayerMiniMode", false);
                MonsterMiniMode            = CoreSettings.LoadBoolValue("MonsterMiniMode", false);
                MainWindowWidth            = CoreSettings.LoadIntValue("MainWindowWidth", -1);
                MainWindowHeight           = CoreSettings.LoadIntValue("MainWindowHeight", -1);
                MainWindowLeft             = CoreSettings.LoadIntValue("MainWindowLeft", int.MinValue);
                MainWindowTop              = CoreSettings.LoadIntValue("MainWindowTop", int.MinValue);
                SelectedTab                = CoreSettings.LoadIntValue("SelectedTab", 0);
                AlternateInitRoll          = CoreSettings.LoadStringValue("AlternateInitRoll", "3d6");
                AlternateInit3d6           = CoreSettings.LoadBoolValue("AlternateInit3d6", false);
                InitiativeShowPlayers      = CoreSettings.LoadBoolValue("InitiativeShowPlayers", true);
                InitiativeShowMonsters     = CoreSettings.LoadBoolValue("InitiativeShowMonsters", true);
                InitiativeHideMonsterNames = CoreSettings.LoadBoolValue("InitiativeHideMonsterNames", false);
                InitiativeHidePlayerNames  = CoreSettings.LoadBoolValue("InitiativeHidePlayerNames", false);
                InitiativeShowConditions   = CoreSettings.LoadBoolValue("InitiativeShowConditions", false);
                InitiativeConditionsSize   = CoreSettings.LoadIntValue("InitiativeConditionsSize", 2);
                InitiativeAlwaysOnTop      = CoreSettings.LoadBoolValue("InitiativeAlwaysOnTop", false);
                InitiativeScale            = CoreSettings.LoadDoubleValue("InitiativeScale", 1.0);
                InitiativeFlip             = CoreSettings.LoadBoolValue("InitiativeFlip", false);
                RunCombatViewService       = CoreSettings.LoadBoolValue("RunCombatViewService", false);
                ShowHiddenInitValue        = CoreSettings.LoadBoolValue("ShowHiddenInitValue", false);
                AddMonstersHidden          = CoreSettings.LoadBoolValue("AddMonstersHidden", false);
                StatsOpenByDefault         = CoreSettings.LoadBoolValue("StatsOpenByDefault", false);
                CheckForUpdates            = CoreSettings.LoadBoolValue("CheckForUpdates", true);
                DefaultHPMode              = (Character.HPMode)CoreSettings.LoadIntValue("DefaultHPMode", 0);
                MonsterDBFilter            = (MonsterSetFilter)CoreSettings.LoadIntValue("MonsterDBFilter", (int)MonsterSetFilter.Monsters);
                MonsterTabFilter           = (MonsterSetFilter)CoreSettings.LoadIntValue("MonsterTabFilter", (int)MonsterSetFilter.Monsters);
                ColorScheme                = CoreSettings.LoadIntValue("ColorScheme", 0);
                DarkScheme                 = CoreSettings.LoadBoolValue("DarkScheme", false);
                RulesSystem                = (RulesSystem)CoreSettings.LoadIntValue("RulesSystem", 0);
                RunLocalService            = CoreSettings.LoadBoolValue("RunLocalService", false);
                RunWebService              = CoreSettings.LoadBoolValue("RunWebService", true);
                LocalServicePort           = (ushort)CoreSettings.LoadIntValue("LocalServicePort", LocalCombatManagerService.DefaultPort);
                LocalServicePasscode       = CoreSettings.LoadStringValue("LocalServicePasscode", "");

                optionsLoaded = true;
            }
            catch (System.Security.SecurityException ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
Пример #2
0
        public void SaveOptions(SettingsSaveSection section)
        {
            if (optionsLoaded)
            {
                try
                {
                    RegistryKey key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\\CombatManager", RegistryKeyPermissionCheck.Default);


                    if (section == SettingsSaveSection.All)
                    {
                        CoreSettings.SaveBoolValue("RollHP", RollHP);
                        CoreSettings.SaveBoolValue("ConfirmCharacterDelete", ConfirmCharacterDelete);
                        CoreSettings.SaveBoolValue("ConfirmInitiativeRoll", ConfirmInitiativeRoll);
                        CoreSettings.SaveBoolValue("ConfirmClose", ConfirmClose);
                        CoreSettings.SaveBoolValue("ShowAllDamageDice", ShowAllDamageDice);
                        CoreSettings.SaveBoolValue("AlternateInit3d6", AlternateInit3d6);
                        CoreSettings.SaveStringValue("AlternateInitRoll", AlternateInitRoll);
                        CoreSettings.SaveBoolValue("RunCombatViewService", RunCombatViewService);
                        CoreSettings.SaveBoolValue("ShowHiddenInitValue", ShowHiddenInitValue);
                        CoreSettings.SaveBoolValue("AddMonstersHidden", AddMonstersHidden);
                        CoreSettings.SaveBoolValue("StatsOpenByDefault", StatsOpenByDefault);
                        CoreSettings.SaveBoolValue("CheckForUpdates", CheckForUpdates);
                        CoreSettings.SaveIntValue("ColorScheme", ColorScheme);
                        CoreSettings.SaveIntValue("DefaultHPMode", (int)DefaultHPMode);
                    }

                    if (section == SettingsSaveSection.System || section == SettingsSaveSection.All)
                    {
                        CoreSettings.SaveIntValue("RulesSystem", (int)RulesSystem);
                    }

                    if (section == SettingsSaveSection.WindowState || section == SettingsSaveSection.All)
                    {
                        CoreSettings.SaveBoolValue("PlayerMiniMode", PlayerMiniMode);
                        CoreSettings.SaveBoolValue("MonsterMiniMode", MonsterMiniMode);
                        CoreSettings.SaveIntValue("MainWindowWidth", MainWindowWidth);
                        CoreSettings.SaveIntValue("MainWindowHeight", MainWindowHeight);
                        CoreSettings.SaveIntValue("MainWindowLeft", MainWindowLeft);
                        CoreSettings.SaveIntValue("MainWindowTop", MainWindowTop);
                        CoreSettings.SaveIntValue("SelectedTab", SelectedTab);
                    }

                    if (section == SettingsSaveSection.Sources || section == SettingsSaveSection.All)
                    {
                        CoreSettings.SaveBoolValue("UseCore", UseCore);
                        CoreSettings.SaveBoolValue("UseAPG", UseAPG);
                        CoreSettings.SaveBoolValue("UseChronicles", UseChronicles);
                        CoreSettings.SaveBoolValue("UseModules", UseModules);
                        CoreSettings.SaveBoolValue("UseUltimateMagic", UseUltimateMagic);
                        CoreSettings.SaveBoolValue("UseUltimateCombat", UseUltimateCombat);
                        CoreSettings.SaveBoolValue("UseOther", UseOther);
                    }

                    if (section == SettingsSaveSection.All || section == SettingsSaveSection.Initiative)
                    {
                        CoreSettings.SaveBoolValue("InitiativeShowPlayers", InitiativeShowPlayers);
                        CoreSettings.SaveBoolValue("InitiativeShowMonsters", InitiativeShowMonsters);
                        CoreSettings.SaveBoolValue("InitiativeHideMonsterNames", InitiativeHideMonsterNames);
                        CoreSettings.SaveBoolValue("InitiativeHidePlayerNames", InitiativeHidePlayerNames);
                        CoreSettings.SaveBoolValue("InitiativeShowConditions", InitiativeShowConditions);
                        CoreSettings.SaveIntValue("InitiativeConditionsSize", InitiativeConditionsSize);
                        CoreSettings.SaveBoolValue("InitiativeAlwaysOnTop", InitiativeAlwaysOnTop);
                        CoreSettings.SaveDoubleValue("InitiativeScale", InitiativeScale);
                        CoreSettings.SaveBoolValue("InitiativeFlip", InitiativeFlip);
                    }
                    if (section == SettingsSaveSection.All || section == SettingsSaveSection.LocalService)
                    {
                        CoreSettings.SaveBoolValue("RunLocalService", RunLocalService);
                        CoreSettings.SaveBoolValue("RunWebService", RunWebService);
                        CoreSettings.SaveIntValue("LocalServicePort", LocalServicePort);
                        CoreSettings.SaveStringValue("LocalServicePasscode", LocalServicePasscode);
                    }
                    if (section == SettingsSaveSection.All || section == SettingsSaveSection.Filters)
                    {
                        CoreSettings.SaveIntValue("MonsterDBFilter", (int)MonsterDBFilter);
                        CoreSettings.SaveIntValue("MonsterTabFilter", (int)MonsterTabFilter);
                    }
                    if (section == SettingsSaveSection.All || section == SettingsSaveSection.Timer)
                    {
                        CoreSettings.LoadBoolValue("UseTurnClock", UseTurnClock);
                        CoreSettings.LoadBoolValue("CountdownToNextTurn", CountdownToNextTurn);
                        CoreSettings.LoadBoolValue("MoveAutomaticallyOnTurnTimer", MoveAutomaticallyOnTurnTimer);
                        CoreSettings.LoadIntValue("TurnTimeSeconds", TurnTimeSeconds);
                        CoreSettings.LoadIntValue("WarningTimeSeconds", WarningTimeSeconds);
                        CoreSettings.LoadBoolValue("PlayWarningSound", PlayWarningSound);
                        CoreSettings.LoadStringValue("WarningSound", WarningSound);
                        CoreSettings.LoadBoolValue("PlayTurnEndSound", PlayTurnEndSound);
                        CoreSettings.LoadStringValue("TurnEndSound", TurnEndSound);
                        CoreSettings.LoadBoolValue("ShowClockForMonsters", ShowClockForMonsters);
                    }
                }

                catch (System.Security.SecurityException ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.ToString());
                }
                catch (System.IO.IOException ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.ToString());
                }
            }
        }