static void Main(String[] args) { String startProject = null; for (int i = 0; i < args.Length; i++) { Util.CommandLine.Arg arg = Util.CommandLine.ParseArg(args[i]); switch (arg.Name) { case Util.CommandLine.AvailableArgs.ProjectPath: startProject = arg.Value; break; } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.DoEvents(); Application.Run(new MainForm(startProject)); }
static void Main(string[] args) { String projectPath = null, outputPath = null; bool displayHelp = false; string invalidArg = ""; for (int i = 0; i < args.Length; i++) { Util.CommandLine.Arg arg = Util.CommandLine.ParseArg(args[i]); //Note: If you add a new arg, please add the appropriate help text in DisplayHelp() switch (arg.Name) { case Util.CommandLine.AvailableArgs.INVALID: invalidArg = arg.Value; break; case Util.CommandLine.AvailableArgs.ProjectPath: projectPath = arg.Value; break; case Util.CommandLine.AvailableArgs.VerboseOutput: verbose = true; break; case Util.CommandLine.AvailableArgs.DisplayHelp: case Util.CommandLine.AvailableArgs.DisplayHelpShort: displayHelp = true; break; case Util.CommandLine.AvailableArgs.CleanOutputDirectory: cleanOutputDir = true; break; case Util.CommandLine.AvailableArgs.OutputTarget: outputPath = arg.Value; break; } } if (args.Length == 0 || displayHelp) { // If the help param was supplied, ignore other params DisplayHelp(); } else if (invalidArg.Length > 0) { DisplayInvalidArgMsg(invalidArg); } else if (projectPath != null && projectPath.Length > 0) { try { Build(projectPath, outputPath); } catch (Exception ex) { Console.Out.WriteLine("\nBUILD FAILED!\n" + ex.ToString()); Wait(); // Exit with a negative return code so that external apps like NAnt // can interpret the build as unsuccessful Environment.Exit(-99); } } else { // No valid params were supplied, so show the help DisplayHelp(); } }