public static void SaveConfig() { IniConfUtil.Set("toolkit", "Name", Name); IniConfUtil.Set("toolkit", "Services", String.Join(";", Services)); IniConfUtil.Set("toolkit", "Logdir", Logdir); IniConfUtil.Set("toolkit", "Auto", Auto ? "1" : ""); FileIOUtil.CreateFile(BatFilePath, Bat); }
void GenerateCode() { config = ConfigAssets.LoadCodeGeneratorConfig(); string templateDir = Application.dataPath + "/itfantasy/Editor/umvc/CodeGenerator/CodeTemplate"; List <FileInfo> fileInfos = FileIOUtil.GetFileInfos(templateDir); foreach (FileInfo fileInfo in fileInfos) { string fileName = fileInfo.Name; if (fileName.Contains(".meta")) { continue; } if (onlyView) { if (fileName != "TemplateView.cs.txt") { continue; } } fileName = fileName.Replace(".txt", ""); string saveName = fileName.Replace("Template", name); string content = FileIOUtil.ReadFile(fileInfo.FullName); string saveContent = content.Replace("##NAME##", name); saveContent = saveContent.Replace("##HASVIEW##", hasView ? "" : "//"); if (hasView && fileName == "TemplateView.cs") { GenerateViewCode(ref saveContent); } string savePath = "/" + config.codeSavePath + "/" + name + "Window/" + saveName; if (!onlyView) { if (FileIOUtil.FileExists(Application.dataPath + savePath)) { Debug.LogError("The target files have existed! However, if you want to recreate them, delete please!"); return; } } FileIOUtil.CreateFile(Application.dataPath + savePath, saveContent); Debug.Log("[GenerateCode]:: " + savePath); } AssetDatabase.Refresh(); }