Ejemplo n.º 1
0
        /// <summary>
        /// End initialization
        /// </summary>
        protected override void OnBeforeInitialModuleScreenSetAsRoot()
        {
            var builder = new DefaultSettingsBuilder("Testing_Global_v3", "MCMv3 Testing Fluent Settings") !
                          .SetFormat("xml")
                          .SetFolderName(string.Empty)
                          .SetSubFolder(string.Empty)
                          .CreateGroup("Testing 1", groupBuilder => groupBuilder
                                       .AddBool("prop_1", "Check Box", new ProxyRef <bool>(() => _boolValue, o => _boolValue = o), boolBuilder => boolBuilder
                                                .SetHintText("Test")
                                                .SetRequireRestart(false)))
                          .CreateGroup("Testing 2", groupBuilder => groupBuilder
                                       .AddInteger("prop_2", "Integer", 0, 10, new ProxyRef <int>(() => _intValue, o => _intValue = o), integerBuilder => integerBuilder
                                                   .SetHintText("Testing"))
                                       .AddFloatingInteger("prop_3", "Floating Integer", 0, 10, new ProxyRef <float>(() => _floatValue, o => _floatValue = o), floatingBuilder => floatingBuilder
                                                           .SetRequireRestart(true)
                                                           .SetHintText("Test")))
                          .CreateGroup("Testing 3", groupBuilder => groupBuilder
                                       .AddText("prop_4", "Test", new ProxyRef <string>(() => _stringValue, o => _stringValue = o), null));

            var globalSettings = builder.BuildAsGlobal();

            globalSettings.Register();
            //globalSettings.Unregister();

            //var PerSaveSettings = builder.BuildAsPerSave();
            //PerSaveSettings.Register();
            //PerSaveSettings.Unregister();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// End initialization
        /// </summary>
        protected override void OnBeforeInitialModuleScreenSetAsRoot()
        {
#if DEBUG
            var builder = new DefaultSettingsBuilder("Testing_Global_v1", "Testing Fluent Settings")
                          .SetFormat("xml")
                          .SetFolderName("")
                          .SetSubFolder("")
                          .CreateGroup("Testing 1", groupBuilder => groupBuilder
                                       .AddBool("Check Box", new ProxyRef <bool>(() => _boolValue, o => _boolValue = o), boolBuilder => boolBuilder
                                                .SetHintText("Test")))
                          .CreateGroup("Testing 2", groupBuilder => groupBuilder
                                       .AddInteger("Integer", 0, 10, new ProxyRef <int>(() => _intValue, o => _intValue = o), integerBuilder => integerBuilder
                                                   .SetHintText("Testing"))
                                       .AddFloatingInteger("Floating Integer", 0, 10, new ProxyRef <float>(() => _floatValue, o => _floatValue = o), floatingBuilder => floatingBuilder
                                                           .SetRequireRestart(true)
                                                           .SetHintText("Test")))
                          .CreateGroup("Testing 3", groupBuilder => groupBuilder
                                       .AddText("Test", new ProxyRef <string>(() => _stringValue, o => _stringValue = o), null));

            var globalSettings = builder.BuildAsGlobal();
            globalSettings.Register();
            //globalSettings.Unregister();

            //var perCharacterSettings = builder.BuildAsPerCharacter();
            //perCharacterSettings.Register();
            //perCharacterSettings.Unregister();
#endif
        }
Ejemplo n.º 3
0
        public void SettingsUpdateV3To4_VersionBecomes4_TiffColorBlackWihteGetsBlackWhiteG4Fax()
        {
            const int oldSettingsVersion = 3;
            const int newSettingsVersion = 4;

            var ini         = new IniStorage(Encoding.UTF8);
            var builder     = new DefaultSettingsBuilder();
            var oldSettings = builder.CreateDefaultSettings("PDFCreator", ini, "English");

            oldSettings.ConversionProfiles[0].TiffSettings.Color = TiffColor.BlackWhiteG4Fax;
            var currentSettingsVersion = oldSettings.ApplicationProperties.SettingsVersion;

            oldSettings.ApplicationProperties.SettingsVersion = oldSettingsVersion;
            var iniFile = Path.Combine(_th.TmpTestFolder, "TestSettings.ini");

            oldSettings.SaveData(ini, iniFile);

            var settingsFromIni = File.ReadAllText(iniFile);

            settingsFromIni = settingsFromIni.Replace("BlackWhiteG4Fax", "BlackWhite");
            File.WriteAllText(iniFile, settingsFromIni);

            var upgrader = new SettingsUpgradeHelper(newSettingsVersion);
            var settings = new DefaultSettingsBuilder().CreateEmptySettings(null);

            settings.LoadData(ini, iniFile, upgrader.UpgradeSettings);

            Assert.AreEqual(newSettingsVersion, settings.ApplicationProperties.SettingsVersion, "Did not update SettingsVersion.");
            Assert.AreEqual(TiffColor.BlackWhiteG4Fax, settings.ConversionProfiles[0].TiffSettings.Color, "Did not update TiffColor BlackWhite to BlackWhiteG4Fax");
        }
Ejemplo n.º 4
0
        private PdfCreatorSettings CreateSettings()
        {
            var profileBuilder = new DefaultSettingsBuilder();
            var settings       = profileBuilder.CreateDefaultSettings("MySpecialPrinter", new IniStorage(), "Elbisch");

            return(settings);
        }
Ejemplo n.º 5
0
        private CsSettings()
        {
            var builder = new DefaultSettingsBuilder("CsSettings", $"CustomSpawn{Main.version}")
                          .SetFormat("xml")
                          .SetFolderName("CustomSpawn")
                          .SetSubFolder("")
                          .CreateGroup("Suond", groupBuilder => groupBuilder.SetGroupOrder(1)
                                       .AddBool("notification_sound", "Spawn Notification Sound",
                                                new ProxyRef <bool>(() => SpawnSoundEnabled, o => SpawnSoundEnabled = o), boolBuilder =>
                                                boolBuilder.SetHintText("Enable a notification sound when an important party spawn")))
                          .CreateGroup("Debug", groupBuilder => groupBuilder.SetGroupOrder(2)
                                       .AddBool("isDebugMode", "Enable Debug", new ProxyRef <bool>(() => IsDebugMode, o => IsDebugMode = o), boolBuilder =>
                                                boolBuilder.SetHintText("Enable the debug mode"))
                                       .AddBool("showAIDebug", "Show AI Debug", new ProxyRef <bool>(() => ShowAIDebug, o => ShowAIDebug = o), boolBuilder =>
                                                boolBuilder.SetHintText("Show AI debug messages"))
                                       .AddBool("showDeathTrackDebug", "Show Death Track Debug", new ProxyRef <bool>(() => ShowDeathTrackDebug, o => ShowDeathTrackDebug = o), boolBuilder =>
                                                boolBuilder.SetHintText("Show messages related to party destruction"))
                                       .AddBool("isAllSpawnMode", "Is All Spawn Mode", new ProxyRef <bool>(() => IsAllSpawnMode, o => IsAllSpawnMode = o), boolBuilder =>
                                                boolBuilder.SetHintText("Enable the spawning of all party in one night"))
                                       .AddBool("spawnAtOneHideout", "Spawn At One Hideout", new ProxyRef <bool>(() => SpawnAtOneHideout, o => SpawnAtOneHideout = o), boolBuilder =>
                                                boolBuilder.SetHintText("Spawn player at one hideout"))
                                       .AddBool("modifyPartySpeeds", "Modify Party Speeds", new ProxyRef <bool>(() => ModifyPartySpeeds, o => ModifyPartySpeeds = o), boolBuilder =>
                                                boolBuilder.SetHintText("Modify the party speeds"))
                                       .AddBool("isRemovalMode", "Is Removal Mode", new ProxyRef <bool>(() => IsRemovalMode, o => IsRemovalMode = o), boolBuilder =>
                                                boolBuilder.SetHintText("Enable the removal mode"))
                                       .AddInteger("updatePartyRedundantDataPerHour", "Update Party Redundant Data Per Hour", 1, 5, new ProxyRef <int>(() => UpdatePartyRedundantDataPerHour, o => UpdatePartyRedundantDataPerHour = o), boolBuilder =>
                                                   boolBuilder.SetHintText("Do Something"))
                                       .AddInteger("sameErrorShowUntil", "Same Error Show Until", 1, 5, new ProxyRef <int>(() => SameErrorShowUntil, o => SameErrorShowUntil = o), boolBuilder =>
                                                   boolBuilder.SetHintText("The same error will be shown in the log if it exceeds this number in one play time"))
                                       );

            var globalSettings = builder.BuildAsGlobal();

            globalSettings.Register();
        }
        protected override PdfCreatorSettings CreateDefaultSettings(string primaryPrinter, string defaultLanguage)
        {
            var defaultSettings = (PdfCreatorSettings)DefaultSettingsBuilder.CreateDefaultSettings(primaryPrinter, defaultLanguage);

            return(DefaultUserSettingsExist()
                ? LoadDefaultUserSettings(defaultSettings)
                : defaultSettings);
        }
Ejemplo n.º 7
0
        protected override PdfCreatorSettings CreateDefaultSettings(string primaryPrinter, IStorage storage, string defaultLanguage)
        {
            var profileBuilder  = new DefaultSettingsBuilder();
            var defaultSettings = profileBuilder.CreateDefaultSettings(primaryPrinter, storage, defaultLanguage);

            return(DefaultUserSettingsExist()
                ? LoadDefaultUserSettings(defaultSettings, profileBuilder, storage)
                : defaultSettings);
        }
Ejemplo n.º 8
0
        /// <summary>
        ///     Functions checks, if a default profile exists and adds one.
        /// </summary>
        private void CheckAndAddMissingDefaultProfile(PdfCreatorSettings settings, DefaultSettingsBuilder settingsBuilder)
        {
            var defaultProfile = settings.GetProfileByGuid(ProfileGuids.DEFAULT_PROFILE_GUID);

            if (defaultProfile == null)
            {
                defaultProfile = settingsBuilder.CreateDefaultProfile();
                settings.ConversionProfiles.Add(defaultProfile);
            }
            else
            {
                defaultProfile.Properties.Deletable = false;
            }
        }
Ejemplo n.º 9
0
        private void RestoreDefaultSettingsExecute(object obj)
        {
            var title              = Translation.RestoreDefaultSettingsTitle;
            var message            = Translation.RestoreDefaultSettingsMessage;
            var messageInteraction = new MessageInteraction(message, title, MessageOptions.YesNo, MessageIcon.Question);

            _request.Raise(messageInteraction, interaction =>
            {
                if (messageInteraction.Response == MessageResponse.Yes)
                {
                    var profileBuilder  = new DefaultSettingsBuilder();
                    var defaultSettings = profileBuilder.CreateDefaultSettings(SettingsProvider.Settings);
                    ApplySettingsProcedure(defaultSettings);
                }
            });
        }
Ejemplo n.º 10
0
        public Conversion.Settings.PdfCreatorSettings LoadIniSettings(string iniFile)
        {
            if (string.IsNullOrWhiteSpace(iniFile))
            {
                return(null);
            }

            var iniStorage = _dataStorageFactory.BuildIniStorage();

            var settingsUpgrader = new SettingsUpgradeHelper();

            var settings = new DefaultSettingsBuilder().CreateEmptySettings(iniStorage);

            settings.LoadData(iniStorage, iniFile, settingsUpgrader.UpgradeSettings);

            return(settings);
        }
Ejemplo n.º 11
0
        public PdfCreatorSettings LoadPdfCreatorSettings()
        {
            MoveSettingsIfRequired();
            var regStorage = BuildStorage();

            var profileBuilder = new DefaultSettingsBuilder();
            var settings       = profileBuilder.CreateEmptySettings(regStorage);

            var settingsUpgrader = new SettingsUpgradeHelper(SettingsVersion);

            if (UserSettingsExist())
            {
                settings.LoadData(regStorage, "", settingsUpgrader.UpgradeSettings);
            }

            if (!_translationHelper.HasTranslation(settings.ApplicationSettings.Language))
            {
                var language = _translationHelper.FindBestLanguage(CultureInfo.CurrentCulture);
                settings.ApplicationSettings.Language = language.Iso2;
            }

            if (!CheckValidSettings(settings))
            {
                var defaultSettings = profileBuilder.CreateDefaultSettings(FindPrimaryPrinter(), regStorage, settings.ApplicationSettings.Language);

                if (DefaultUserSettingsExist())
                {
                    settings = LoadDefaultUserSettings(defaultSettings, profileBuilder, regStorage);
                }
                else
                {
                    settings = defaultSettings;
                }
            }

            CheckAndAddMissingDefaultProfile(settings, profileBuilder);
            CheckPrinterMappings(settings);
            CheckTitleReplacement(settings);

            _translationHelper.TranslateProfileList(settings.ConversionProfiles);

            LogProfiles(settings);

            return(settings);
        }
        private PdfCreatorSettings LoadDefaultUserSettings(PdfCreatorSettings defaultSettings)
        {
            var defaultUserStorage = new RegistryStorage(RegistryHive.Users,
                                                         @".DEFAULT\" + InstallationPathProvider.SettingsRegistryPath);

            var data = Data.CreateDataStorage();

            // Store default settings and then load the machine defaults from HKEY_USERS\.DEFAULT to give them prefrence
            defaultSettings.StoreValues(data, "");
            defaultUserStorage.ReadData("", data);

            // And then load the combined settings with default user overriding our defaults
            var settings = (PdfCreatorSettings)DefaultSettingsBuilder.CreateEmptySettings();

            settings.ReadValues(data);

            return(settings);
        }
Ejemplo n.º 13
0
        public void AllWhitelistedClasses_AreRegistered()
        {
            var bootstrapper = new PDFCreatorPlusBootstrapper();
            var container    = BuildPrismContainer(bootstrapper);

            var settingsProvider = container.GetInstance <ISettingsProvider>();
            var builder          = new DefaultSettingsBuilder();
            var settings         = builder.CreateDefaultSettings("PDFCreator", new IniStorage(), "en");

            settingsProvider.UpdateSettings(settings);

            var whitelisted = (from assembly in AppDomain.CurrentDomain.GetAssemblies()
                               from type in assembly.GetTypes()
                               where !type.IsAbstract && typeof(IWhitelisted).IsAssignableFrom(type)
                               select type).ToList();

            foreach (var type in whitelisted)
            {
                Assert.DoesNotThrow(() => container.GetInstance(type), $"Could not create type '{type}'");
            }

            CollectionAssert.IsNotEmpty(whitelisted);
        }
Ejemplo n.º 14
0
 protected override PdfCreatorSettings CreateDefaultSettings(string primaryPrinter, string defaultLanguage)
 {
     return((PdfCreatorSettings)DefaultSettingsBuilder.CreateDefaultSettings(primaryPrinter, defaultLanguage));
 }
Ejemplo n.º 15
0
        public void RegisterSettings()
        {
            /*
             * var builder = new DefaultSettingsBuilder("Test_v1", "Test Mod")
             *  .SetFormat("json")
             *  .SetFolderName("Test Mod");
             *
             * builder.CreateGroup("Test Group Toggle", groupBuilder => groupBuilder
             *  .SetIsMainToggle(true)
             *  .AddFloatingInteger("float_id", "Float Display Name", 0f, 20f,
             *      new ProxyRef<float>(() => _testFloat, (value) => _testFloat = value),
             *      builder => builder.SetHintText("Float Hint")));
             *
             * _settings = builder.BuildAsGlobal();
             * _settings.Register();
             * }
             */


            int order   = 0;
            var builder = new DefaultSettingsBuilder(InstanceID, SubModule.ModName)
                          .SetFormat("xml")
                          .SetFolderName(SubModule.ModuleFolderName);


            // Training Perk Overrides Group
            builder.CreateGroup($"{Strings.TrainingPerkGroup}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .SetIsMainToggle(true)
                                .AddBool(nameof(EnableTrainingPerkOverrides),
                                         Strings.TrainingPerkGroup,
                                         new PropertyRef(typeof(Settings).GetProperty(
                                                             nameof(EnableTrainingPerkOverrides)), this),
                                         builder => builder
                                         .SetRequireRestart(false)
                                         .SetOrder(order++)
                                         .SetHintText(Strings.EnableTrainingPerkOverridesHint))
                                );

            // Training Perk xp amounts
            builder.CreateGroup($"{Strings.TrainingPerkGroup}/{Strings.TrainingPerkXpGain}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .AddInteger(nameof(RaiseTheMeekXpAmount),
                                            Strings.RaiseTheMeekXpAmountDisplay, 0, 100,
                                            new PropertyRef(typeof(Settings).GetProperty(
                                                                nameof(RaiseTheMeekXpAmount)), this),
                                            builder => builder
                                            .SetRequireRestart(false)
                                            .SetOrder(order++)
                                            .SetHintText(Strings.RaiseTheMeekXpAmountHint))
                                .AddInteger(nameof(CombatTipsXpAmount),
                                            Strings.CombatTipsXpAmountDisplay, 0, 100,
                                            new PropertyRef(typeof(Settings).GetProperty(
                                                                nameof(CombatTipsXpAmount)), this),
                                            builder => builder
                                            .SetRequireRestart(false)
                                            .SetOrder(order++)
                                            .SetHintText(Strings.CombatTipsXpAmountHint))
                                );

            // Training Perk tier limits
            builder.CreateGroup($"{Strings.TrainingPerkGroup}/{Strings.TierLimitsSettingsGroup}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .AddInteger(nameof(RaiseTheMeekMaxTierTrained),
                                            Strings.RaiseTheMeekMaxTierTrainedDisplay, 0, 20,
                                            new PropertyRef(typeof(Settings).GetProperty(
                                                                nameof(RaiseTheMeekMaxTierTrained)), this),
                                            intBuilder => intBuilder
                                            .SetRequireRestart(false)
                                            .SetOrder(order++)
                                            .SetHintText(Strings.RaiseTheMeekMaxTierTrainedHint))
                                .AddInteger(nameof(ComatTipsMaxTierTrained),
                                            Strings.CombatTipsMaxTierTrainedDisplay, 0, 20,
                                            new PropertyRef(typeof(Settings).GetProperty(
                                                                nameof(ComatTipsMaxTierTrained)), this),
                                            intBuilder => intBuilder
                                            .SetRequireRestart(false)
                                            .SetOrder(order++)
                                            .SetHintText(Strings.CombatTipsMaxTierTrainedHint))
                                );

            // Training Perk xp multipliers
            builder.CreateGroup($"{Strings.TrainingPerkGroup}" +
                                $"/{Strings.XpMultipliersSettingsGroup}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .AddFloatingInteger(nameof(PlayerPartyTrainingXpMultiplier),
                                                    Strings.PlayerPartyTrainingMultDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(PlayerPartyTrainingXpMultiplier)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.PlayerPartyTrainingMultHint)
                                                    .AddValueFormat("#0%"))
                                .AddFloatingInteger(nameof(PlayerClanPartyTrainingXpMultiplier),
                                                    Strings.PlayerClanPartyTrainingMultDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(PlayerClanPartyTrainingXpMultiplier)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.PlayerClanPartyTrainingMultHint)
                                                    .AddValueFormat("#0%"))
                                .AddFloatingInteger(nameof(NonPlayerClanPartyTrainingXpMultiplier),
                                                    Strings.NonPlayerClanPartyTrainingMultDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(NonPlayerClanPartyTrainingXpMultiplier)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.NonPlayerClanPartyTrainingMultHint)
                                                    .AddValueFormat("#0%"))
                                );

            // Training Perk General
            builder.CreateGroup($"{Strings.TrainingPerkGroup}" +
                                $"/{Strings.GeneralSettingsGroup}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .AddFloatingInteger(nameof(LevelDifferenceFactor),
                                                    Strings.LevelDifferenceFactorDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(LevelDifferenceFactor)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.LevelDifferenceFactorHint))
                                .AddFloatingInteger(nameof(LeadershipSkillFactor),
                                                    Strings.LeadershipSkillFactorDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(LeadershipSkillFactor)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.LeadershipSkillFactorHint))
                                .AddFloatingInteger(nameof(TrainingXpPerLeadershipXp),
                                                    Strings.TrainingXpPerLeadershipXpDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(TrainingXpPerLeadershipXp)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.TrainingXpPerLeadershipXpHint))
                                .AddBool(nameof(WoundedReceiveTraining),
                                         Strings.WoundedReceiveTrainingDisplay,
                                         new PropertyRef(typeof(Settings).GetProperty(
                                                             nameof(WoundedReceiveTraining)), this),
                                         builder => builder
                                         .SetRequireRestart(false)
                                         .SetOrder(order++)
                                         .SetHintText(Strings.WoundedReceiveTrainingHint))
                                .AddBool(nameof(UpgradeableReceiveTraining),
                                         Strings.UpgradeableReceiveTrainingDisplay,
                                         new PropertyRef(typeof(Settings).GetProperty(
                                                             nameof(UpgradeableReceiveTraining)), this),
                                         builder => builder
                                         .SetRequireRestart(false)
                                         .SetOrder(order++)
                                         .SetHintText(Strings.UpgradeableReceiveTrainingHint))
                                );

            // Base Training Settings
            builder.CreateGroup($"{Strings.BaseTrainingSettingsGroup}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .SetIsMainToggle(true)
                                .AddBool(nameof(EnableBaseTraining),
                                         Strings.BaseTrainingSettingsGroup,
                                         new PropertyRef(typeof(Settings).GetProperty(
                                                             nameof(EnableBaseTraining)), this),
                                         builder => builder
                                         .SetRequireRestart(false)
                                         .SetOrder(order++)
                                         .SetHintText(Strings.EnableBaseTrainingHint))
                                );

            builder.CreateGroup($"{Strings.BaseTrainingSettingsGroup}" +
                                $"/{Strings.GeneralSettingsGroup}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .AddInteger(nameof(BaseTrainingXpAmount),
                                            Strings.BaseTrainingXpAmountDisplay, 0, 100,
                                            new PropertyRef(typeof(Settings).GetProperty(
                                                                nameof(BaseTrainingXpAmount)), this),
                                            builder => builder
                                            .SetRequireRestart(false)
                                            .SetOrder(order++)
                                            .SetHintText(Strings.BaseTrainingXpAmountHint))
                                .AddInteger(nameof(BaseTrainingMaxTierTrained),
                                            Strings.BaseTrainingTierDisplay, 0, 20,
                                            new PropertyRef(typeof(Settings).GetProperty(
                                                                nameof(BaseTrainingMaxTierTrained)), this),
                                            builder => builder
                                            .SetRequireRestart(false)
                                            .SetOrder(order++)
                                            .SetHintText(Strings.BaseTrainingTierHint))
                                );


            // Garrison Training Overrides
            builder.CreateGroup($"{Strings.GarrisonGroup}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .SetIsMainToggle(true)
                                .AddBool(nameof(EnableGarrisonTraining),
                                         Strings.GarrisonGroup,
                                         new PropertyRef(typeof(Settings).GetProperty(
                                                             nameof(EnableGarrisonTraining)), this),
                                         builder => builder
                                         .SetRequireRestart(false)
                                         .SetOrder(order++)
                                         .SetHintText(Strings.EnableGarrisonTrainingOverrideHint))
                                );

            builder.CreateGroup($"{Strings.GarrisonGroup}/" +
                                $"{Strings.GeneralSettingsGroup}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .AddInteger(nameof(LevelOneTrainingFieldXpAmount),
                                            Strings.LevelOneTrainingFieldXpAmountDisplay, 0, 100,
                                            new PropertyRef(typeof(Settings).GetProperty(
                                                                nameof(LevelOneTrainingFieldXpAmount)), this),
                                            builder => builder
                                            .SetRequireRestart(false)
                                            .SetOrder(order++)
                                            .SetHintText(Strings.LevelOneTrainingFieldXpAmountHint))
                                .AddInteger(nameof(GarrisonTrainingMaxTierTrained),
                                            Strings.GarrisonMaxTierTrainedDisplay, 0, 20,
                                            new PropertyRef(typeof(Settings).GetProperty(
                                                                nameof(GarrisonTrainingMaxTierTrained)), this),
                                            builder => builder
                                            .SetRequireRestart(false)
                                            .SetOrder(order++)
                                            .SetHintText(Strings.GarrisionMaxTierTrainedHint))
                                .AddFloatingInteger(nameof(PlayerClanGarrisonTrainingXpMultiplier),
                                                    Strings.PlayerClanGarrisonTrainingMultDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(PlayerClanGarrisonTrainingXpMultiplier)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.PlayerClanGarrisonTrainingMultHint)
                                                    .AddValueFormat("#0%"))
                                .AddFloatingInteger(nameof(NonPlayerClanGarrisonTrainingXpMultiplier),
                                                    Strings.NonPlayerClanGarrisonTrainingMultDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(NonPlayerClanGarrisonTrainingXpMultiplier)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.NonPlayerClanGarrisonTrainingMultHint)
                                                    .AddValueFormat("#0%"))
                                );

            // Financial Solutions Settings
            builder.CreateGroup($"{Strings.FinancialSolutionsSettingGroup}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .SetIsMainToggle(true)
                                .AddBool(nameof(EnableFinancialSolutions),
                                         Strings.FinancialSolutionsSettingGroup,
                                         new PropertyRef(typeof(Settings).GetProperty(
                                                             nameof(EnableFinancialSolutions)), this),
                                         builder => builder
                                         .SetRequireRestart(false)
                                         .SetOrder(order++)
                                         .SetHintText(Strings.EnableFinancialSolutionsHint))
                                );

            builder.CreateGroup($"{Strings.FinancialSolutionsSettingGroup}" +
                                $"/{Strings.PlayerSubgroup}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .AddFloatingInteger(nameof(PlayerTownTaxIncomeMultiplier),
                                                    Strings.PlayerTownTaxIncomeMultiplierDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(PlayerTownTaxIncomeMultiplier)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.PlayerTownTaxIncomeMultiplierHint)
                                                    .AddValueFormat("#0%"))
                                .AddFloatingInteger(nameof(PlayerVillageTaxIncomeMultiplier),
                                                    Strings.PlayerVillageTaxIncomeMultiplierDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(PlayerVillageTaxIncomeMultiplier)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.PlayerVillageTaxIncomeMultiplierHint)
                                                    .AddValueFormat("#0%"))
                                .AddFloatingInteger(nameof(PlayerClanPartyWageMultiplier),
                                                    Strings.PlayerClanPartyWageMultiplierDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(PlayerClanPartyWageMultiplier)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.PlayerClanPartyWageMultiplierHint)
                                                    .AddValueFormat("#0%"))
                                );

            builder.CreateGroup($"{Strings.FinancialSolutionsSettingGroup}" +
                                $"/{Strings.AISubgroup}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .AddFloatingInteger(nameof(NonPlayerTownTaxIncomeMultiplier),
                                                    Strings.NonPlayerTownTaxIncomeMultiplierDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(NonPlayerTownTaxIncomeMultiplier)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.NonPlayerTownTaxIncomeMultiplierHint)
                                                    .AddValueFormat("#0%"))
                                .AddFloatingInteger(nameof(NonPlayerVillageTaxIncomeMultiplier),
                                                    Strings.NonPlayerVillageTaxIncomeMultiplierDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(NonPlayerVillageTaxIncomeMultiplier)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.NonPlayerVillageTaxIncomeMultiplierHint)
                                                    .AddValueFormat("#0%"))
                                .AddFloatingInteger(nameof(NonPlayerClanPartyWageMultiplier),
                                                    Strings.NonPlayerClanPartyWageMultiplierDisplay, 0f, 20f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(NonPlayerClanPartyWageMultiplier)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.NonPlayerClanPartyWageMultiplierHint)
                                                    .AddValueFormat("#0%"))
                                );

            builder.CreateGroup($"{Strings.FinancialSolutionsSettingGroup}" +
                                $"/{Strings.GeneralSettingsGroup}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .AddFloatingInteger(nameof(TroopUpgradeCostMultiplier),
                                                    Strings.TroopUpgradeCostMultiplierDisplay, 0f, 50f,
                                                    new PropertyRef(typeof(Settings).GetProperty(
                                                                        nameof(TroopUpgradeCostMultiplier)), this),
                                                    builder => builder
                                                    .SetRequireRestart(false)
                                                    .SetOrder(order++)
                                                    .SetHintText(Strings.TroopUpgradeCostMultiplierHint)
                                                    .AddValueFormat("#0%"))
                                );

            // Debug stuff
            builder.CreateGroup($"{Strings.DebugSettingGroup}",
                                groupBuilder => groupBuilder
                                .SetGroupOrder(order++)
                                .AddBool(nameof(DebugMode),
                                         Strings.EnableDebugModeDisplay,
                                         new PropertyRef(typeof(Settings).GetProperty(
                                                             nameof(DebugMode)), this),
                                         builder => builder
                                         .SetRequireRestart(false)
                                         .SetOrder(order++)
                                         .SetHintText(Strings.EnableDebugModeHint))
                                );

            // Build and register the settings
            _settings = builder.BuildAsGlobal();
            _settings.Register();
        }
Ejemplo n.º 16
0
        protected override PdfCreatorSettings CreateDefaultSettings(string primaryPrinter, IStorage storage, string defaultLanguage)
        {
            var profileBuilder = new DefaultSettingsBuilder();

            return(profileBuilder.CreateDefaultSettings(primaryPrinter, storage, defaultLanguage));
        }