private static EXTSST CreateEXTSST(SST sst, int sstOffset)
        {
            EXTSST extSST = new EXTSST();
            extSST.NumStrings = 8;

            int counter = 0;
            int totalLength = sstOffset + 0x0C;
            int relativeLength = 0x0C;
            foreach (string text in sst.StringList)
            {
                int stringLength = Record.GetStringDataLength(text);
                if (relativeLength + stringLength > Record.MaxContentLength + 4)
                {
                    totalLength += 4;
                    relativeLength = 4;
                }
                if (counter == 0)
                {
                    StringOffset stringOffset = new StringOffset();
                    stringOffset.AbsolutePosition = (uint)totalLength;
                    stringOffset.RelativePosition = (ushort)relativeLength;
                    extSST.Offsets.Add(stringOffset);
                }
                counter++;
                if (counter == extSST.NumStrings)
                {
                    counter = 0;
                }
                totalLength += stringLength;
                relativeLength += stringLength;
            }

            return extSST;
        }
Exemplo n.º 2
0
 static StringOffset ReadStringOffset(BinaryReader reader)
 {
     StringOffset stringOffset = new StringOffset();
     stringOffset.AbsolutePosition = reader.ReadUInt32();
     stringOffset.RelativePosition = reader.ReadUInt16();
     stringOffset.NotUsed = reader.ReadUInt16();
     return stringOffset;
 }
Exemplo n.º 3
0
 static void WriteStringOffset(BinaryWriter writer, StringOffset stringoffset)
 {
     writer.Write(stringoffset.AbsolutePosition);
     writer.Write(stringoffset.RelativePosition);
     writer.Write(stringoffset.NotUsed);
 }