示例#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
 void AddSwitchHandler(string @switch)
 {
     parser.AddSwitchHandler(@switch, () => itemsInvoked.Add(@switch));
 }