Пример #1
0
        public static TSR_Tag Load(TSR_Reader tsrReader, ref int enc_pos)
        {
            TSR_Tag tag = new TSR_Tag();

            tag.Index = tsrReader.ReadUInt16();
            tag.Name  = tsrReader.DecodeString(ref enc_pos);

            return(tag);
        }
Пример #2
0
        public static TSR_Function Load(TSR_Reader tsrReader, int offset)
        {
            tsrReader.Position = offset;
            TSR_Function function = new TSR_Function()
            {
                Tags = new List <TSR_Tag>(), Sentences = new List <TSR_Sentence>()
            };

            int enc_pos = 4;

            function.Header = tsrReader.ReadInt32();
            function.Name   = tsrReader.DecodeString(ref enc_pos);
            function.Unk    = tsrReader.ReadUInt16();

            //Tags
            int tagCount = tsrReader.ReadUInt16();

            for (int i = 0; i < tagCount; i++)
            {
                function.Tags.Add(TSR_Tag.Load(tsrReader, ref enc_pos));
            }

            //Sentence
            int sentenceCount = tsrReader.ReadUInt16();

            for (int i = 0; i < sentenceCount; i++)
            {
                function.Sentences.Add(TSR_Sentence.Load(tsrReader, ref enc_pos));
            }

            //Lines
            function.Lines = new List <object>();

            for (int i = 0; i < function.Sentences.Count; i++)
            {
                var tag = function.GetTag(i);

                if (tag != null)
                {
                    function.Lines.Add(tag);
                }

                function.Lines.Add(function.Sentences[i]);
            }

            return(function);
        }