static void Main(string[] args) { if (args.Length < 1) { WriteUsage(); } else { string format; string solution; Hashtable parameters = new Hashtable(); Hashtable uriMap = new Hashtable(); Driver.ParseArgs(args, out format, out solution, parameters, uriMap); if (format == null) { Console.Error.WriteLine("no output format specified"); } else { if (solution == null) { solution = Driver.FindSolution(Environment.CurrentDirectory); } SolutionWriter writer = null; switch (format) { case "nant": writer = new NAntWriter(); break; case "nmake": writer = new NMakeWriter(); break; } if (writer == null) { Console.Error.WriteLine("{0} is an unsupported format.", format); } else { Driver.WriteSolution(writer, Console.Out, solution, parameters, uriMap); } } } }
/// <summary> /// Creates the <see cref="SolutionWriter" /> for the specified format. /// </summary> /// <returns> /// The <see cref="SolutionWriter" /> for the specified format, or /// <see langword="null" /> if an unknown format was specified. /// </returns> private SolutionWriter CreateSolutionWriter(string format) { SolutionWriter writer = null; switch (format) { case "nant": writer = new NAntWriter(); break; case "nmake": writer = new NMakeWriter(); break; } return(writer); }