public static void Main_(string[] args) { var options = new Option(); if (CommandLine.Parser.Default.ParseArguments(args, options)) { // Values are available here if (options.Verbose) { Console.WriteLine("Filename: {0}", options.Directory); } var batchCompiler = new BatchCompiler(); string templateString = DefaultTemplate.GenCodeTemplate; if (!string.IsNullOrEmpty(options.TemplateFilePath)) { Console.WriteLine(options.TemplateFilePath); templateString = System.IO.File.ReadAllText(options.TemplateFilePath); } //var results = batchCompiler.CompileTableMLAll(options.Directory, options.OutputDirectory, options.CodeFilePath, templateString, "AppSettings", ".tml", null, !string.IsNullOrEmpty(options.CodeFilePath)); Console.WriteLine("Done!"); // var compiler = new Compiler(); // var result = compiler.Compile(options.Directory); // Console.WriteLine(string.Format("Compile excel file: {0} , to {1}", options.Directory, result.TabFileRelativePath)); } }
/// <summary> /// /// </summary> /// <param name="force">Whether or not,check diff. false will be faster!</param> /// <param name="genCode">Generate static code?</param> public static void DoCompileSettings(bool force = true, string forceTemplate = null) { var sourcePath = SettingSourcePath;//AppEngine.GetConfig("SettingSourcePath"); if (string.IsNullOrEmpty(sourcePath)) { Log.Error("Need to KEngineConfig: SettingSourcePath"); return; } var compilePath = AppEngine.GetConfig("KEngine.Setting", "SettingCompiledPath"); if (string.IsNullOrEmpty(compilePath)) { Log.Error("Need to KEngineConfig: SettingCompiledPath"); return; } var bc = new BatchCompiler(); var settingCodeIgnorePattern = AppEngine.GetConfig("KEngine.Setting", "SettingCodeIgnorePattern", false); var results = bc.CompileTableMLAll(sourcePath, compilePath, SettingCodePath, forceTemplate ?? DefaultTemplate.GenCodeTemplate, "AppSettings", SettingExtension, settingCodeIgnorePattern, force); // CompileTabConfigs(sourcePath, compilePath, SettingCodePath, SettingExtension, force); var sb = new StringBuilder(); foreach (var r in results) { sb.AppendLine(string.Format("Excel {0} -> {1}", r.ExcelFile, r.TabFileRelativePath)); } Log.Info("TableML all Compile ok!\n{0}", sb.ToString()); // make unity compile AssetDatabase.Refresh(); }
public void TestBatchCompile() { var bc = new BatchCompiler(); var results = bc.CompileTableMLAll("TestSettings", "TestSettingsResult", "TestSettings.cs.gen", DefaultTemplate.GenCodeTemplate, "AppSettings", ".tml", null, true); Assert.AreEqual(4, results.Count); Assert.True(File.Exists("TestSettings.cs.gen")); }
/// <summary> /// /// </summary> /// <param name="force">Whether or not,check diff. false will be faster!</param> /// <param name="genCode">Generate static code?</param> public static void DoCompileSettings(bool force = true, string forceTemplate = null, bool canCustom = true) { if (canCustom && CustomCompileSettings != null) { CustomCompileSettings(); return; } var sourcePath = SettingSourcePath;//AppEngine.GetConfig("SettingSourcePath"); if (string.IsNullOrEmpty(sourcePath)) { Debug.LogError("Need to KEngineConfig: SettingSourcePath"); return; } var compilePath = "Assets/Main/BundleEditor/DataTable"; if (string.IsNullOrEmpty(compilePath)) { Debug.LogError("Need to KEngineConfig: SettingCompiledPath"); return; } var bc = new BatchCompiler(); //var settingCodeIgnorePattern = null; var template = force ? (forceTemplate ?? DefaultTemplate.GenCodeTemplate) : null; // var results = bc.CompileTableMLAll(sourcePath, compilePath, SettingCodePath, template, "AppSettings", SettingExtension, null, force); // CompileTabConfigs(sourcePath, compilePath, SettingCodePath, SettingExtension, force); var sb = new StringBuilder(); foreach (var r in results) { sb.AppendLine(string.Format("Excel {0} -> {1}", r.ExcelFile, r.TabFileRelativePath)); } Debug.LogFormat("TableML all Compile ok!\n{0}", sb.ToString()); // make unity compile AssetDatabase.Refresh(); }
public static void DoCompileSettings(bool force = true) { var bc = new BatchCompiler(); var sourcePath = "Product/DT_MySQLSource"; var compilePath = "Product/DT_MySQL"; var SettingCodePath = "Assets/AutoGenerate/DT_MySQL.cs"; var template = DTMySQLTemplate.GenCodeTemplate; // var SettingExtension = ".bytes"; var settingCodeIgnorePattern = "(I18N/.*)|(StringsTable.*)"; //var force = true; var results = bc.CompileTableMLAll(sourcePath, compilePath, SettingCodePath, template, "Ash", SettingExtension, settingCodeIgnorePattern, force); // CompileTabConfigs(sourcePath, compilePath, SettingCodePath, SettingExtension, force); var sb = new StringBuilder(); foreach (var r in results) { sb.AppendLine(string.Format("Excel {0} -> {1}", r.ExcelFile, r.TabFileRelativePath)); } UnityEngine.Debug.Log("TableML all Compile ok!\n" + sb.ToString()); // make unity compile AssetDatabase.Refresh(); }
/// <summary> /// /// </summary> /// <param name="force">Whether or not,check diff. false will be faster!</param> /// <param name="genCode">Generate static code?</param> public static void DoCompileSettings(bool force = true, string forceTemplate = null, bool canCustom = true) { if (canCustom && CustomCompileSettings != null) { CustomCompileSettings(); return; } var sourcePath = SettingSourcePath;//AppEngine.GetConfig("SettingSourcePath"); if (string.IsNullOrEmpty(sourcePath)) { Log.Error("Need to KEngineConfig: SettingSourcePath"); return; } var compilePath = AppEngine.GetConfig("KEngine.Setting", "SettingCompiledPath"); if (string.IsNullOrEmpty(compilePath)) { Log.Error("Need to KEngineConfig: SettingCompiledPath"); return; } var bc = new BatchCompiler(); var settingCodeIgnorePattern = AppEngine.GetConfig("KEngine.Setting", "SettingCodeIgnorePattern", false); var template = force ? (forceTemplate ?? DefaultTemplate.GenCodeTemplate) : null; // var results = bc.CompileTableMLAll(sourcePath, compilePath, SettingCodePath, template, "AppSettings", SettingExtension, settingCodeIgnorePattern, force); // CompileTabConfigs(sourcePath, compilePath, SettingCodePath, SettingExtension, force); var sb = new StringBuilder(); foreach (var r in results) { sb.AppendLine(string.Format("Excel {0} -> {1}", r.ExcelFile, r.TabFileRelativePath)); } Log.Info("TableML all Compile ok!\n{0}", sb.ToString()); // make unity compile AssetDatabase.Refresh(); }