/// <summary>
        /// The entry point of the program, where the program control starts and ends.
        /// </summary>
        /// <param name="args">CLI arguments</param>
        public static void Main(string[] args)
        {
            string inputFilePath  = CliArgumentsReader.GetOptionValue(args, InputFileOptions);
            string outputFilePath = CliArgumentsReader.GetOptionValue(args, OutputFileOptions);
            string namelistName   = CliArgumentsReader.GetOptionValue(args, NameOptions);
            bool   isLocked       = CliArgumentsReader.HasOption(args, IsLockedOptions);

            IShipNamesBuilder      shipNamesBuilder      = new ShipNamesBuilder();
            IShipClassNamesBuilder shipClassNamesBuilder = new ShipClassNamesBuilder();
            IFleetNamesBuilder     fleetnamesBuilder     = new FleetNamesBuilder();
            IArmyNamesBuilder      armyNamesBuilder      = new ArmyNamesBuilder();
            IPlanetNamesBuilder    planetNamesBuilder    = new PlanetNamesBuilder();
            ICharacterNamesBuilder characterNamesBuilder = new CharacterNamesBuilder();

            IFileContentBuilder fileContentBuilder = new FileContentBuilder(
                shipNamesBuilder,
                shipClassNamesBuilder,
                fleetnamesBuilder,
                armyNamesBuilder,
                planetNamesBuilder,
                characterNamesBuilder);

            IRepository <NameList> nameListRepository = new XmlRepository <NameList>(inputFilePath);
            INameListGenerator     nameListGenerator  = new NameListGenerator(fileContentBuilder, nameListRepository);

            nameListGenerator.Generate(outputFilePath, namelistName, isLocked);
        }
Ejemplo n.º 2
0
        static StreamProvider DetermineProviderFromArgs(string[] args)
        {
            if (CliArgumentsReader.HasOption(args, YouTubeProcessorOptions))
            {
                return(StreamProvider.YouTube);
            }

            if (CliArgumentsReader.HasOption(args, TwitchProcessorOptions))
            {
                return(StreamProvider.Twitch);
            }

            if (CliArgumentsReader.HasOption(args, SeeNowProcessorOptions))
            {
                return(StreamProvider.SeeNow);
            }

            if (CliArgumentsReader.HasOption(args, TvSportHdProcessorOptions))
            {
                return(StreamProvider.TvSportHd);
            }

            if (CliArgumentsReader.HasOption(args, AntenaPlayProccessorOptions))
            {
                return(StreamProvider.AntenaPlay);
            }

            if (CliArgumentsReader.HasOption(args, OkLiveProcessorOptions))
            {
                return(StreamProvider.OkLive);
            }

            return(StreamProvider.Other);
        }
Ejemplo n.º 3
0
        static string GetArgumentIfExists(string[] args, string[] argumentOptions, string fallbackValue)
        {
            if (CliArgumentsReader.HasOption(args, argumentOptions))
            {
                return(CliArgumentsReader.GetOptionValue(args, argumentOptions));
            }

            return(fallbackValue);
        }
Ejemplo n.º 4
0
        static ApplicationSettings GetSettings(string[] args)
        {
            ApplicationSettings settings = new ApplicationSettings();

            settings.Username        = CliArgumentsReader.GetOptionValue(args, UsernameOptions);
            settings.SharedSecretKey = CliArgumentsReader.GetOptionValue(args, SecretKeyOptions);

            if (CliArgumentsReader.HasOption(args, PlatformOptions))
            {
                settings.Platform = CliArgumentsReader.GetOptionValue(args, PlatformOptions);
            }
            else
            {
                settings.Platform = GetPlatformFromDepsFile();

                if (string.IsNullOrWhiteSpace(settings.Platform))
                {
                    settings.Platform = FileHandler.ReadValue(LauncherInfo.PlaformFilePath, "linux-x64");
                }
            }

            return(settings);
        }
 public OutputSettings(string[] args)
 {
     ModOutputDirectory        = CliArgumentsReader.GetOptionValue(args, OutputDirectoryPathOptions);
     AreVerboseCommentsEnabled = CliArgumentsReader.HasOption(args, VerboseCommentsOptions);
     LandedTitlesFileName      = CliArgumentsReader.TryGetOptionValue(args, LandedTitlesFileNameOptions);
 }
Ejemplo n.º 6
0
        static GeneratorSettings LoadSettings(string[] args)
        {
            GeneratorSettings settings = new GeneratorSettings();

            if (CliArgumentsReader.HasOption(args, SeedOptions))
            {
                settings.Seed = int.Parse(CliArgumentsReader.GetOptionValue(args, SeedOptions));
            }

            settings.GameDirectoryPath = CliArgumentsReader.GetOptionValue(args, ImperatorDirectoryPathOptions);
            settings.ModName           = CliArgumentsReader.GetOptionValue(args, ModNameOptions);

            if (CliArgumentsReader.HasOption(args, CapitalPopulationOptions))
            {
                settings.CapitalPopulation = int.Parse(CliArgumentsReader.GetOptionValue(args, CapitalPopulationOptions));
            }

            if (CliArgumentsReader.HasOption(args, CityPopulationMinOptions))
            {
                settings.CityPopulationMin = int.Parse(CliArgumentsReader.GetOptionValue(args, CityPopulationMinOptions));
            }

            if (CliArgumentsReader.HasOption(args, CityPopulationMaxOptions))
            {
                settings.CityPopulationMax = int.Parse(CliArgumentsReader.GetOptionValue(args, CityPopulationMaxOptions));
            }

            if (CliArgumentsReader.HasOption(args, CityCivilisationLevelMinOptions))
            {
                settings.CityCivilisationLevelMin = int.Parse(CliArgumentsReader.GetOptionValue(args, CityCivilisationLevelMinOptions));
            }

            if (CliArgumentsReader.HasOption(args, CityCivilisationLevelMaxOptions))
            {
                settings.CityCivilisationLevelMax = int.Parse(CliArgumentsReader.GetOptionValue(args, CityCivilisationLevelMaxOptions));
            }

            if (CliArgumentsReader.HasOption(args, CityBarbarianLevelMinOptions))
            {
                settings.CityBarbarianLevelMin = int.Parse(CliArgumentsReader.GetOptionValue(args, CityBarbarianLevelMinOptions));
            }

            if (CliArgumentsReader.HasOption(args, CityBarbarianLevelMaxOptions))
            {
                settings.CityBarbarianLevelMax = int.Parse(CliArgumentsReader.GetOptionValue(args, CityBarbarianLevelMaxOptions));
            }

            if (CliArgumentsReader.HasOption(args, CountryCentralisationLevelMinOptions))
            {
                settings.CountryCentralisationLevelMin = int.Parse(CliArgumentsReader.GetOptionValue(args, CountryCentralisationLevelMinOptions));
            }

            if (CliArgumentsReader.HasOption(args, CountryCentralisationLevelMaxOptions))
            {
                settings.CountryCentralisationLevelMax = int.Parse(CliArgumentsReader.GetOptionValue(args, CountryCentralisationLevelMaxOptions));
            }

            if (CliArgumentsReader.HasOption(args, RandomCountriesCountOptions))
            {
                settings.RandomCountriesCount = int.Parse(CliArgumentsReader.GetOptionValue(args, RandomCountriesCountOptions));
            }

            return(settings);
        }
Ejemplo n.º 7
0
        public void HasOption_CalledWithOneVariant_OptionExists_ReturnsTrue()
        {
            string[] args = { "--test", "--bla", "--bla2" };

            Assert.IsTrue(CliArgumentsReader.HasOption(args, "--test"));
        }
Ejemplo n.º 8
0
        public void HasOption_OptionDoesNotExist_ReturnsFalse()
        {
            string[] args = { "--test", "--bla", "--bla2" };

            Assert.IsFalse(CliArgumentsReader.HasOption(args, "--hori"));
        }