예제 #1
0
        private void ReadEntries(BinaryReader reader, ReadOnlySpan <TextTableField> fields)
        {
            Entries = new TextTableEntry[fields.Length];

            for (int i = 0; i < fields.Length; i++)
            {
                TextTableField field = fields[i];
                reader.BaseStream.Position
                    = (long)((ulong)Marshal.SizeOf <TextTableHeader>() + header.NameOffset + field.Offset * 2);

                string @string = reader.ReadWideString();
                Entries[i] = new TextTableEntry(header.Language, field.Id, @string);
            }
        }
예제 #2
0
        private void BuildLookup()
        {
            // final field will always have the max id
            lookup = new int[Entries[Entries.Length - 1].Id + 1];
            for (int i = 0; i < lookup.Length; i++)
            {
                lookup[i] = -1;
            }

            for (int i = 0; i < Entries.Length; i++)
            {
                TextTableEntry entry = Entries[i];
                lookup[entry.Id] = i;
            }
        }
예제 #3
0
        private void ReadEntries(BinaryReader reader, ReadOnlySpan <TextTableField> fields)
        {
            Entries = new TextTableEntry[fields.Length];

            // build string table
            reader.BaseStream.Position = Marshal.SizeOf <TextTableHeader>() + (long)header.StringTableOffset;
            using (var stringTable = new StringTable(reader.ReadBytes((int)header.StringTableLength * 2)))
            {
                for (int i = 0; i < fields.Length; i++)
                {
                    TextTableField field   = fields[i];
                    string         @string = stringTable.GetEntry(field.Offset * 2);
                    Entries[i] = new TextTableEntry(header.Language, field.Id, @string);
                }
            }
        }