Ejemplo n.º 1
0
 /// <summary>
 /// Write the header of this chunk.
 /// Always call the base method first.
 /// </summary>
 protected override void WriteHeader(ResWriter writer)
 {
     headerStartPosition = writer.Position;
     base.WriteHeader(writer);
     writer.WriteInt32(id);
     writer.WriteFixedLenghtUnicodeString(name, 128);
     typeStringsMark = writer.MarkInt32();
     writer.WriteInt32(typeStrings.Count);
     keyStringsMark = writer.MarkInt32();
     writer.WriteInt32(KeyStrings.Count);
 }
Ejemplo n.º 2
0
            /// <summary>
            /// Write the data of this chunk.
            /// </summary>
            protected override void WriteData(ResWriter writer)
            {
                // Create offset marks
                var offsetMarks = new List <Mark.Int32>();

                foreach (var entry in parent.Entries)
                {
                    var mark = writer.MarkInt32();
                    offsetMarks.Add(mark);
                    EntryInstance instance;
                    if (!entry.TryGetInstance(this, out instance))
                    {
                        mark.Value = NO_ENTRY;
                    }
                }

                // Write entries, update offset marks while we go.
                var startPosition = writer.Position;

                for (var i = 0; i < parent.EntryCount; i++)
                {
                    var           entry = parent.GetEntry(i);
                    EntryInstance instance;
                    if (!entry.TryGetInstance(this, out instance))
                    {
                        continue;
                    }

                    // Update mark
                    offsetMarks[i].Value = writer.Position - startPosition;
                    instance.Write(writer);
                }
            }
Ejemplo n.º 3
0
            /// <summary>
            /// Write the header of this chunk.
            /// Always call the base method first.
            /// </summary>
            protected override void WriteHeader(ResWriter writer)
            {
                var startPosition = writer.Position;

                base.WriteHeader(writer);
                writer.WriteByte(parent.Id);
                writer.WriteByte(0);                       // res0
                writer.WriteUInt16(0);                     // res1
                writer.WriteInt32(parent.EntryCount);      // entryCount
                var entriesStartMark = writer.MarkInt32(); // entriesStart

                configuration.Write(writer);

                // Patch entriesStart
                entriesStartMark.Value = (writer.Position - startPosition) + (parent.EntryCount * 4);
            }