protected override void GenerateCodes() { Log((object)"Generating..."); var recordpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../Jenny.properties"); LogError("recordpath " + recordpath); var text = File.ReadAllText(recordpath); var preference = new Preferences(recordpath, recordpath); DesperateDevs.CodeGeneration.CodeGenerator.CodeGenerator codeGenerator = CodeGeneratorUtil.CodeGeneratorFromPreferences(preference); codeGenerator.OnProgress += (GeneratorProgress)((title, info, progress) => { Log("progress " + (progress)); }); CodeGenFile[] codeGenFileArray1 = new CodeGenFile[0]; CodeGenFile[] codeGenFileArray2; try { codeGenFileArray2 = codeGenerator.Generate(); } catch (Exception ex) { codeGenFileArray1 = new CodeGenFile[0]; codeGenFileArray2 = new CodeGenFile[0]; //LogError("Error" + ex.Message + ex.StackTrace); } Log((object)("Done Generated " + (object)((IEnumerable <CodeGenFile>)codeGenFileArray2) .Select <CodeGenFile, string>(( Func <CodeGenFile, string>)(file => file.fileName)).Distinct <string>() .Count <string>() + " files (" + (object)(( IEnumerable <CodeGenFile>)codeGenFileArray1) .Select <CodeGenFile, string>( (Func <CodeGenFile, string>)(file => file.fileContent.ToUnixLineEndings())) .Sum <string>( (Func <string, int>)(content => content.Split(new char[1] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Length)) + " sloc, " + (object)((IEnumerable <CodeGenFile>)codeGenFileArray2) .Select <CodeGenFile, string>( (Func <CodeGenFile, string>)(file => file.fileContent.ToUnixLineEndings())) .Sum <string>( ( Func <string, int>)(content => content.Split('\n').Length)) + " loc)")); }
protected override void GenerateCodes() { Log((object)"Generating..."); var recordpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, JennyPropertyPath); LogError("recordpath " + recordpath); var text = File.ReadAllText(recordpath); var preference = new Preferences(recordpath, recordpath); ICodeGenerationPlugin[] instances = CodeGeneratorUtil.LoadFromPlugins(preference); CodeGeneratorConfig andConfigure = preference.CreateAndConfigure <CodeGeneratorConfig>(); AssemblyResolver assemblyResolver = new AssemblyResolver(false, andConfigure.searchPaths); foreach (string plugin in andConfigure.plugins) { Log("load plugin " + plugin); assemblyResolver.Load(plugin); } DesperateDevs.CodeGeneration.CodeGenerator.CodeGenerator codeGenerator = CodeGeneratorFromPreferences(preference); codeGenerator.OnProgress += (GeneratorProgress)((title, info, progress) => { Log("progress " + (progress)); }); CodeGenFile[] codeGenFileArray1 = new CodeGenFile[0]; CodeGenFile[] codeGenFileArray2; try { codeGenFileArray2 = codeGenerator.Generate(); } catch (Exception ex) { codeGenFileArray1 = new CodeGenFile[0]; codeGenFileArray2 = new CodeGenFile[0]; LogError("Error" + ex.Message + ex.StackTrace); } UpdateOutputProjectFile(); LogGenInfo(codeGenFileArray2, codeGenFileArray1); }