コード例 #1
0
        private static int Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage: Watts.exe <\"Path/To/Config.json\">");
                return(1);
            }

            var watts = new WebApiToTypeScript.WebApiToTypeScript
            {
                ConfigFilePath = args[0]
            };

            watts.Execute();

            return(0);
        }
コード例 #2
0
        private static int Main(string[] args)
        {
            var watts = new WebApiToTypeScript.WebApiToTypeScript();

            if (args.Length == 0)
            {
                var path = Path.Combine(Environment.CurrentDirectory, "watts.config.json");
                if (File.Exists(path))
                {
                    watts.ConfigFilePath = path;
                }
            }
            else if (args.Length > 0 && File.Exists(args[0]))
            {
                watts.ConfigFilePath = args[0];

                Parser.Default.ParseArguments <CommandLineConfig>(args)
                .WithParsed(cfg => watts.CommandLineConfig = cfg)
                .WithNotParsed((a) => Console.WriteLine("Command line configuration parse failed"));
            }

            int status = 0;

            if (watts.ConfigFilePath == null)
            {
                Console.WriteLine("Usage: Watts.exe <\"Path/To/Config.json\">");
                status = -1;
            }
            else
            {
                status = watts.Execute() ? 0 : -1;
            }

            if (Debugger.IsAttached)
            {
                Console.Write("Press any key to continue . . . ");
                Console.ReadKey();
            }

            return(0);
        }
コード例 #3
0
        private static int Main(string[] args)
        {
            var watts = new WebApiToTypeScript.WebApiToTypeScript();

            if (args.Length == 0)
            {
                var path = Path.Combine(Environment.CurrentDirectory, "watts.config.json");
                if (File.Exists(path))
                {
                    watts.ConfigFilePath = path;
                }
            }
            else if (args.Length > 0 && File.Exists(args[0]))
            {
                watts.ConfigFilePath = args[0];
            }

            int status = 0;

            if (watts.ConfigFilePath == null)
            {
                Console.WriteLine("Usage: Watts.exe <\"Path/To/Config.json\">");
                status = -1;
            }
            else
            {
                status = watts.Execute() ? 0 : -1;
            }

            if (Debugger.IsAttached)
            {
                Console.Write("Press any key to continue . . . ");
                Console.ReadKey();
            }

            return(0);
        }