Exemplo n.º 1
0
 /// <summary>
 /// </summary>
 /// <param name="setting"></param>
 /// <param name="commands"></param>
 public CommandSet(ExecuteSetting setting, IList<ICommand> commands)
 {
     if (setting == null) throw new ArgumentNullException("setting");
     if (commands == null) throw new ArgumentNullException("commands");
     _executeSettings.Add(DefaultExecuteSetting, setting);
     _commands = new CommandCollection(commands);
     ;
     _commnadIds = new List<string>();
 }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            Console.Clear();
            Console.WriteLine("LB_Release 1.0");
            Console.WriteLine();
            string file = null;
            var list = new List<string>();
            foreach (var arg in args)
            {
                if (arg.StartsWith("/") || arg.StartsWith("-"))
                {
                    list.Add(arg.Substring(1).ToLower());
                    continue;
                }
                if (file == null)
                {
                    file = arg;
                    continue;
                }
                Console.WriteLine("Error Argument " + file + " please use /h to show help.");
                return;
            }
            if (list.Contains(new ShowHelpArgumentHandler().Key))
            {
                new ShowHelpArgumentHandler().Handle(null, null, null);
                return;
            }
            if (file == null && list.Count == 0)
            {
                Console.WriteLine("Please input setting file, or use /h to show help.");
                return;
            }

            _fileInfo = new FileInfo(file);
            var executeSetting = new ExecuteSetting(Environment.CurrentDirectory);
            executeSetting.ForWidnow();
            var commandSet = new CommandSet(executeSetting);
            var factory = new ArgumentFactory();
            var invoked = factory.Handle(list, commandSet, _fileInfo.FullName);

            if (invoked)
            {
                Run(commandSet, _fileInfo);
            }
        }
Exemplo n.º 3
0
 public CommandSet(ExecuteSetting setting)
     : this(setting, new List<ICommand>())
 {
 }
Exemplo n.º 4
0
 private ExecuteSetting(ExecuteSetting parent)
 {
     Parent = parent;
     Top = parent.Top ?? parent;
 }
Exemplo n.º 5
0
 public object Clone()
 {
     var result = new ExecuteSetting(this)
     {
         WorkDirectory = WorkDirectory,
         ResultFolder = ResultFolder,
         Setting = Setting
     };
     foreach (var item in _variable.Keys)
     {
         result.SetVariable(item, _variable[item]);
     }
     return result;
 }