public bool ExportTraFile(string savepath, TLKTextCollection texts, int[] compareIndex) { if (string.IsNullOrEmpty(savepath) || texts == null) { return(false); } var digits = texts.Last().Index.ToString().Length; int textCnt = texts.Count; int comCnt = compareIndex.Count(); var entryArr = new string[comCnt]; using (var ori = TLKFILE.Open(texts.FilePath, true)) { var encoding = texts.TextEncoding; for (int i = 0; i < comCnt; i++) { var result = string.Empty; if (compareIndex[i] < textCnt) { result = encoding.GetString(ori.GetEntryResourceName(compareIndex[i])).Replace("\0", ""); } if (string.IsNullOrEmpty(result)) { entryArr[i] = result; } else { entryArr[i] = " [" + result + "]"; } } } using (var ws = new StreamWriter(File.Create(savepath))) { var tempIndex = 0; for (int i = 0; i < comCnt; i++) { tempIndex = compareIndex[i]; if (tempIndex < textCnt) { ws.WriteLine(string.Format(@"@{0} = ~{1}~ {2}", tempIndex.ToString().PadRight(digits, ' '), texts[tempIndex].Text, entryArr[i])); } } } return(true); }