示例#1
0
        public static void Main(string[] args)
        {
            commands["migrate"]  = new Migrate();
            commands["filter"]   = new Filter();
            commands["query"]    = new Query();
            commands["register"] = new Register();
            commands["open"]     = new Open();
            commands["import"]   = new Import();
            commands["export"]   = new Export();
            commands["alter"]    = new Alter();
            commands["project"]  = new Project();

            if (args.Length == 0)
            {
                Usage();
                return;
            }
            List <string> taskArgs = new List <string>(args);

            taskArgs.RemoveAt(0);             // Remove the command string.

            // Remove debug flag which is only used by the
            // FactorySupport to determine console logging
            // for bootstrap loading of assemblies. Other
            // debug logging gets controlled by app.config for
            // log4net.
            taskArgs.Remove("-d");
            taskArgs.Remove("--debug");

            Command tempCommand;

            if (commands.TryGetValue(args[0], out tempCommand))
            {
                tempCommand.Run(taskArgs.ToArray());
            }
            else
            {
                Usage();
                return;
            }
        }
示例#2
0
        public static void Main(string[] args)
        {
            commands["migrate"]  = new Migrate();
            commands["filter"]   = new Filter();
            commands["query"]    = new Query();
            commands["register"] = new Register();
            commands["open"]     = new Open();
            commands["import"]   = new Import();
            commands["project"]  = new Project();

            if (args.Length == 0)
            {
                Console.WriteLine("tzdata Usage:");
                Console.WriteLine();
                foreach (var kvp in commands)
                {
                    Command command = kvp.Value;
                    foreach (var line in command.Usage())
                    {
                        Console.WriteLine("  " + line);
                    }
                }
                return;
            }
            List <string> taskArgs = new List <string>(args);

            taskArgs.RemoveAt(0);             // Remove the command string.

            // Remove debug flag which is only used by the
            // FactorySupport to determine console logging
            // for bootstrap loading of assemblies. Other
            // debug logging gets controlled by app.config for
            // log4net.
            taskArgs.Remove("-d");
            taskArgs.Remove("--debug");

            commands[args[0]].Run(taskArgs.ToArray());
        }