Example #1
0
        public static int Main(string[] args)
        {
            if (args[0] == "?")
            {
                writeUsage();
                return 0;
            }

            if (args.Length == 0)
            {
                writeUsage();
                return 1;
            }

            var doctor = new Doctor
            {
                BinaryPath = AppDomain.CurrentDomain.BaseDirectory,
                BootstrapperType = args[0],
                ConfigFile = string.Empty,
                OutputFile = string.Empty
            };

            for (int i = 1; i < args.Length; i++)
            {
                string argument = args[i];
                string[] parts = argument.Split('=');
                if (parts.Length != 2)
                {
                    writeUsage();
                    return 1;
                }

                parseArgument(parts, doctor);
            }

            Console.WriteLine();
            DoctorReport report = doctor.RunReport();
            if (report.Result == DoctorResult.Success)
            {
                Console.WriteLine("SUCCESS!");
            }
            else
            {
                Console.WriteLine("FAILURE!");
            }

            return report.Result == DoctorResult.Success ? 0 : 1;
        }
Example #2
0
        private static void parseArgument(string[] parts, Doctor doctor)
        {
            switch (parts[0])
            {
                case "ConfigFile":
                    doctor.ConfigFile = parts[1];
                    break;

                case "BinaryPath":
                    doctor.BinaryPath = parts[1];
                    break;

                case "OutputFile":
                    doctor.OutputFile = parts[1];
                    break;
            }
        }