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.Assembly = set.Parse(args)[0]; } catch (OptionException) { Console.WriteLine("Error parsing the command line."); ShowHelp(set); return false; } return true; }
public static int Main(string[] args) { var options = new Options(); if (!ParseCommandLineOptions(args, options)) return 1; if (!Directory.Exists(options.OutputDir)) Directory.CreateDirectory(options.OutputDir); try { var compiler = new Compiler(options.Assembly, options.OutputDir); compiler.Process(); compiler.Compile(options.Assembly); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); return 1; } return 0; }
static void Main(string[] args) { var options = new Options(); if (!ParseCommandLineOptions(args, options)) return; if (!Directory.Exists(options.OutputDir)) Directory.CreateDirectory(options.OutputDir); Assembly assembly; if (!ParseAssembly(options.Assembly, out assembly)) return; var compiler = new Compiler(options, assembly); compiler.Process(); if(!string.IsNullOrEmpty(options.MSBuildProjectPath)){ MSBuildUpdater.UpdateMSBuild(options.MSBuildProjectPath,compiler.GeneratedFiles); } }
[SetUp] public void Init() { Options options = new Options(); generator = new Generator(options); eventFired = false;
public Compiler(Options options, Assembly assembly) { this.options = options; this.assembly = assembly; this.GeneratedFiles = new List<string>(); }
public Generator(Options options) { this.options = options; }