public static Project GetProject(string projectPath) { if (projectPath.EndsWith("tf_yak0")) { return(Yakuza0Project.GetProject(projectPath)); } if (projectPath.EndsWith("tf_shm")) { return(ShenmueProject.GetProject(projectPath)); } if (projectPath.EndsWith("tf_sao_hf")) { return(SAOProject.GetProject(projectPath)); } if (projectPath.EndsWith("tf_srr")) { return(SRRProject.GetProject(projectPath)); } if (projectPath.EndsWith("tf_dsg")) { return(DisgaeaProject.GetProject(projectPath)); } if (projectPath.EndsWith("tf_btr")) { return(BattleRealmsProject.GetProject(projectPath)); } if (projectPath.EndsWith("tf_spf2")) { return(Spellforce2Project.GetProject(projectPath)); } if (projectPath.EndsWith("tf_jjm")) { return(JJMacfieldProject.GetProject(projectPath)); } if (projectPath.EndsWith("tf_nightcry")) { return(NightCryProject.GetProject(projectPath)); } throw new Exception(); }
private TFString ReadString(Stream s) { var value = new TFString { FileId = Id, Offset = (int)s.Position, Visible = false }; var str = s.ReadStringZ(Encoding); if (!string.IsNullOrEmpty(str.TrimEnd('\0'))) { str = BattleRealmsProject.ReadingReplacements(str); value.Original = str; value.Translation = str; value.Visible = true; } return(value); }
public override void Save(string fileName, byte[] originalContent, IList <TFString> strings, ExportOptions options) { using (var fs = new FileStream(fileName, FileMode.Create)) { fs.WriteValueS32(_header, Endianness); fs.WriteValueS32(strings.Count, Endianness); foreach (var item in _strings) { fs.WriteValueS32(item.Index, Endianness); fs.WriteValueU8(item.Unknown); var tfString = strings.FirstOrDefault(x => x.Offset == item.Data.Offset); var str = tfString.Translation; if (!string.IsNullOrEmpty(str)) { var length = str.GetLength(options.SelectedEncoding) / 2 + 1; fs.WriteValueS32(length, Endianness); if (options.CharReplacement == 1) { str = Utils.ReplaceChars(str, options.CharReplacementList); } str = BattleRealmsProject.WritingReplacements(str); fs.WriteStringZ(str, options.SelectedEncoding); } else { fs.WriteValueS32(1, Endianness); fs.WriteByte(0); fs.WriteByte(0); } } } }