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); } }
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); }
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); }
public override void WriteTypeData(ESPWriter writer) { writer.Write(CoordY); writer.Write(CoordX); }
public override void WriteTypeData(ESPWriter writer) { writer.Write(RecordType.ToCharArray()); }
public override void WriteTypeData(ESPWriter writer) { writer.Write(Worldspace); }
public override void WriteTypeData(ESPWriter writer) { writer.Write(Index); }
public override void WriteTypeData(ESPWriter writer) { writer.Write(Cell); }
public override void WriteTypeData(ESPWriter writer) { writer.Write(Topic); }