Esempio n. 1
0
        public void WriteBinary(ESPWriter writer)
        {
            Header.Record.WriteBinary(writer);

            foreach (var kvp in TopGroup.tagToNameDictionary)
            {
                Group group = TopGroups.FirstOrDefault(g => (g as TopGroup).RecordType == kvp.Key);
                if (group != null)
                {
                    group.WriteBinary(writer, this);
                }
            }
        }
Esempio n. 2
0
        public virtual void WriteBinary(ESPWriter writer)
        {
            writer.Write(Utility.DesanitizeTag(Tag).ToCharArray());
            writer.Write((ushort)0);

            long dataPoint = writer.BaseStream.Position;

            WriteData(writer);
            long dataEnd = writer.BaseStream.Position;

            if ((dataEnd - dataPoint) <= ushort.MaxValue)
            {
                writer.BaseStream.Seek(dataPoint - 2, SeekOrigin.Begin);
                writer.Write((ushort)(dataEnd - dataPoint));

                writer.BaseStream.Seek(dataEnd, SeekOrigin.Begin);
            }
        }
Esempio n. 3
0
        public void WriteBinary(ESPWriter writer)
        {
            writer.Write(Utility.DesanitizeTag(Tag).ToCharArray());
            writer.Write((uint)0);
            writer.Write((uint)Flags);
            writer.Write(FormID);
            DateStamp.Now.WriteBinary(writer);
            writer.Write((ushort)0); //padding
            writer.Write(FormVersion);
            writer.Write((ushort)0); //padding

            long dataStart = writer.BaseStream.Position;

            if (Flags.HasFlag(RecordFlag.Compressed))
            {
                if (compressionCorrupted)
                {
                    writer.Write(corruptedBytes);
                }
                else
                {
                    using (MemoryStream stream = new MemoryStream())
                        using (ESPWriter subWriter = new ESPWriter(stream, writer.Plugin))
                        {
                            WriteData(subWriter);
                            stream.Position = 0;
                            writer.Write((uint)stream.Length);
                            writer.Write(Zlib.Compress(stream));
                        }
                }
            }
            else
            {
                WriteData(writer);
            }

            long dataEnd = writer.BaseStream.Position;

            writer.BaseStream.Seek(dataStart - 20, SeekOrigin.Begin);
            writer.Write((uint)(dataEnd - dataStart));
            writer.BaseStream.Seek(dataEnd, SeekOrigin.Begin);
        }
Esempio n. 4
0
        public void WriteBinary(ESPWriter writer, ElderScrollsPlugin master)
        {
            writer.Write(Utility.DesanitizeTag(Tag).ToCharArray());

            long sizePoint = writer.BaseStream.Position;

            writer.Write((uint)0);
            WriteTypeData(writer);
            writer.Write((uint)type);
            DateStamp.Now.WriteBinary(writer);
            writer.Write(new byte[6]);

            long dataStart = writer.BaseStream.Position;

            List <Group> groups = new List <Group>(Children);

            foreach (var view in ChildRecordViews)
            {
                var record = view.Record;
                record.WriteBinary(writer);
                Group recordGroup = groups.FirstOrDefault(g => g is ISubgroup && ((uint)(g as ISubgroup).GetRecordID()) == ((uint)record.FormID));

                if (recordGroup != null)
                {
                    groups.Remove(recordGroup);
                    recordGroup.WriteBinary(writer, master);
                }
            }

            foreach (var group in groups)
            {
                group.WriteBinary(writer, master);
            }

            long dataEnd = writer.BaseStream.Position;

            writer.BaseStream.Seek(sizePoint, SeekOrigin.Begin);
            writer.Write((uint)(dataEnd - dataStart + 24));
            writer.BaseStream.Seek(dataEnd, SeekOrigin.Begin);
        }
Esempio n. 5
0
 protected abstract void WriteData(ESPWriter writer);
Esempio n. 6
0
 public abstract void WriteData(ESPWriter writer);
Esempio n. 7
0
 public override void WriteTypeData(ESPWriter writer)
 {
     writer.Write(CoordY);
     writer.Write(CoordX);
 }
Esempio n. 8
0
 public override void WriteTypeData(ESPWriter writer)
 {
     writer.Write(RecordType.ToCharArray());
 }
Esempio n. 9
0
 public override void WriteTypeData(ESPWriter writer)
 {
     writer.Write(Worldspace);
 }
 public abstract void WriteBinary(ESPWriter writer);
Esempio n. 11
0
 public override void WriteTypeData(ESPWriter writer)
 {
     writer.Write(Index);
 }
Esempio n. 12
0
 public override void WriteTypeData(ESPWriter writer)
 {
     writer.Write(Cell);
 }
Esempio n. 13
0
 public override void WriteTypeData(ESPWriter writer)
 {
     writer.Write(Topic);
 }