Пример #1
0
        private int WriteString(Stream s, TFString str, ExportOptions options)
        {
            var result   = 0;
            var writeStr = str.Translation;

            if (str.Original.Equals(str.Translation))
            {
                writeStr = JJMacfieldProject.WritingReplacements(writeStr);
                s.WriteStringZ(writeStr, Encoding);
                result = writeStr.GetLength(Encoding);
            }
            else
            {
                if (options.CharReplacement != 0)
                {
                    writeStr = Utils.ReplaceChars(writeStr, options.CharReplacementList);
                }

                writeStr = JJMacfieldProject.WritingReplacements(writeStr);
                s.WriteStringZ(writeStr, options.SelectedEncoding);

                result = writeStr.GetLength(options.SelectedEncoding);
            }

            return(result);
        }
        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();
        }
Пример #3
0
        private TFString ReadString(Stream s)
        {
            var stringOffset = (int)s.Position;

            var value = new TFString {
                FileId = Id, Offset = stringOffset, Visible = false
            };

            var str = s.ReadStringZ(Encoding);

            if (!string.IsNullOrEmpty(str.TrimEnd('\0')))
            {
                str = JJMacfieldProject.ReadingReplacements(str);
            }

            value.Original    = str;
            value.Translation = str;
            value.Visible     = !string.IsNullOrWhiteSpace(str);

            return(value);
        }