public Generator(Options options) { this.options = options; sb = new StringBuilder(); currentIndent = new Stack<uint>(); isStartOfLine = false; }
static void Main(string[] args) { var options = new Options(); if (!ParseCommandLineOptions(args, options)) return; foreach (var assemblyFile in options.Assemblies) { Assembly assembly; if (!ParseAssembly(assemblyFile, out assembly)) continue; var compiler = new Compiler(options, assembly); compiler.Process(); } }
public Compiler(Options options, Assembly assembly) { this.options = options; this.assembly = assembly; }
static bool ParseCommandLineOptions(String[] args, Options options) { var set = new OptionSet() { // Compiler options { "ns|namespace=", v => options.OutputNamespace = v }, { "o|outdir=", v => options.OutputDir = v }, { "debug", v => options.OutputDebug = true }, // Misc. options { "v|verbose", v => { options.Verbose = true; } }, { "h|?|help", v => options.ShowHelpText = v != null }, }; if (args.Length == 0 || options.ShowHelpText) { ShowHelp(set); return false; } try { options.Assemblies = set.Parse(args); } catch (OptionException) { Console.WriteLine("Error parsing the command line."); ShowHelp(set); return false; } return true; }