Пример #1
0
        void ParseArguments(Memory memory, IList <string> arguments)
        {
            if (arguments.Count == 0)
            {
                return;
            }
            var argumentParser = new ArgumentParser();

            argumentParser.AddSwitchHandler("d", () => memory.GetItem <Settings>().DryRun            = true);
            argumentParser.AddArgumentHandler("i", value => memory.GetItem <Settings>().InputFolder  = value);
            argumentParser.AddArgumentHandler("o", value => memory.GetItem <Settings>().OutputFolder = value);
            argumentParser.AddArgumentHandler("s", value => selectedFile = value);
            argumentParser.AddArgumentHandler("x", value => memory.GetItem <FileExclusions>().AddRange(value.Split(';')));
            argumentParser.AddArgumentHandler("t", value => memory.GetItem <Settings>().TagList = value);

            argumentParser.Parse(arguments);
            if (memory.GetItem <Settings>().InputFolder == null)
            {
                throw new FormatException("Missing input folder");
            }
            if (memory.GetItem <Settings>().OutputFolder == null)
            {
                throw new FormatException("Missing output folder");
            }
        }
Пример #2
0
            public void SetUp(string[] commandLineArguments)
            {
                var argumentParser = new ArgumentParser();

                argumentParser.AddArgumentHandler("c", value => new SuiteConfiguration(memory).LoadXml(new FileSystemModel().GetPageContent(value)));
                argumentParser.Parse(commandLineArguments);
            }
Пример #3
0
 void AddArgumentHandler(string @switch)
 {
     parser.AddArgumentHandler(@switch, argument => itemsInvoked.Add(@switch + "," + argument));
 }