public override void Save(string fileName, byte[] originalContent, IList <TFString> strings,
                                  ExportOptions options)
        {
            using (var fs = new FileStream(fileName, FileMode.Create))
            {
                fs.WriteValueS32(strings.Count, Endianness);

                foreach (var item in _strings)
                {
                    fs.WriteValueU16(item.ItemId, Endianness);
                    fs.WriteValueU16(item.Unknown, Endianness);
                    fs.WriteValueU8(item.Gender);
                    fs.WriteValueU8(item.Number);

                    var tfString = strings.FirstOrDefault(x => x.Offset == item.Data.Offset);

                    var str = tfString.Translation;

                    if (options.CharReplacement == 1)
                    {
                        str = Utils.ReplaceChars(str, options.CharReplacementList);
                    }

                    str = Spellforce2Project.WritingReplacements(str);

                    var length = (uint)str.GetLength(options.SelectedEncoding) / 2;
                    fs.WriteValueU32(length, Endianness);
                    fs.WriteString(str, options.SelectedEncoding);
                }
            }
        }
        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, uint length, string section)
        {
            var value = new TFString {
                FileId = Id, Offset = (int)s.Position, Visible = true, Section = section
            };

            var str = s.ReadString(length, false, Encoding);

            str = Spellforce2Project.ReadingReplacements(str);

            value.Original    = str;
            value.Translation = str;

            return(value);
        }