private void btnCompileAll_Click(object sender, EventArgs e) { //编译整个目录 var startPath = Environment.CurrentDirectory; Console.WriteLine("当前目录:{0}", startPath); var srcDirectory = tbFileDir.Text; var batchCompiler = new BatchCompiler(); string templateString = DefaultTemplate.GenSingleClassCodeTemplate; var results = batchCompiler.CompileTableMLAllInSingleFile(srcDirectory, GenTmlPath, GenCodePath, templateString, "AppSettings", ".k", null, !string.IsNullOrEmpty(GenCodePath)); ShowCompileResult(results.Count); }
/// <summary> /// 编译整个目录的excel,每个表生成一个cs文件 /// </summary> public static void CompileAll() { var startPath = Environment.CurrentDirectory; Console.WriteLine("当前目录:{0}", startPath); //源excel文件路径 //var srcDirectory = "settingsrc"; var srcDirectory = "settingsrc"; //输出tml文件路径 var OutputDirectory = "setting"; //生成的代码路径 var CodeFilePath = "GenCode\\"; string settingCodeIgnorePattern = "(I18N/.*)|(StringsTable.*)|(tool/*)|(log/*)|(server/*)|(client/*)"; var batchCompiler = new BatchCompiler(); string templateString = DefaultTemplate.GenSingleClassCodeTemplate; var results = batchCompiler.CompileTableMLAllInSingleFile(srcDirectory, OutputDirectory, CodeFilePath, templateString, "AppSettings", ".tml", settingCodeIgnorePattern, true); Console.WriteLine("Done!"); }