Esempio n. 1
0
        private static void Run(CommandSet commandSet, FileInfo fullName)
        {
            try
            {
                if (!fullName.Exists)
                {
                    Console.WriteLine(fullName.Name + " not found.");
                    return;
                }
                var manager = new SettingManager();
                ExistFile = manager.ReadSetting(commandSet, fullName.FullName);
                commandSet.OnCommandSettingChanged += commandSet_OnCommandSettingChanged;
                commandSet.Invoke();
            }

            catch (AggregateException aggregateException)
            {
                foreach (CommandRunningException ex in aggregateException.InnerExceptions)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.ComandId);
                    Console.WriteLine(ex.Command + " " + ex.Arguments);
                }
            }
        }
Esempio 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);
            }
        }