public static void SaveSciptLines(string filePath, string[] fileContents) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < fileContents.Length; i++) { sb.Append(fileContents[i]); sb.Append("\r\n"); } FileUitl.SaveUTF8TextFile(filePath, sb.ToString()); }
void SaveMapFile(string path, bool merge) { if (merge && !MergeLines())//合并 { Debug.Log("没有变动无需保存"); state = OptStatus.None; return; } StringBuilder sb = new StringBuilder(); sb.Append("id"); sb.Append(","); sb.Append("path"); sb.Append(","); sb.Append("line"); sb.Append(","); sb.Append("zh_cn"); sb.Append(","); sb.Append("zh_tw"); sb.Append("\n"); List <ScriptLineVo> lines = scriptMapLines; List <string> texts = new List <string>(); for (int i = 0; i < lines.Count; i++) { ScriptLineVo line = lines[i]; sb.Append(line.id); sb.Append(","); sb.Append(line.path); sb.Append(","); sb.Append(line.lineNum); sb.Append(","); line.orgText[0] = FindChineseTool.replaceWord(line.orgText[0], ",", DOT); sb.Append(line.orgText[0]); sb.Append(","); if (line.zh_tw == null) { sb.Append(LangguageTools.To_zh_tc(line.orgText[0])); } else { sb.Append(line.zh_tw); } sb.Append("\n"); } if (File.Exists(path)) { File.Delete(path); } FileUitl.SaveUTF8TextFile(path, sb.ToString()); Debug.Log("保存成功!"); if (merge) { state = OptStatus.None; } }