public override void Write(ByteBuilder bb) { _offset = bb.Position; bb.AddShortBE((ushort)Refs.Length); bb.AddShortBE(0); for (int i = 0; i < Refs.Length; i++) { Refs[i].Write(bb); } }
public override void Write(ByteBuilder bb) { bb.AddShortBE(0x1234); bb.AddShortBE(0); bb.AddShortBE(funcList); bb.AddShortBE((ushort)Selectors.Length); for (int i = 0; i < Selectors.Length; i++) { Selectors[i].Write(bb); } if (Type == SectionType.Class) { foreach (ushort vs in varselectors) { bb.AddShortBE(vs); } } bb.AddShortBE((ushort)FuncNames.Length); foreach (ushort val in FuncNames) { bb.AddShortBE(val); } bb.AddShortBE(0); foreach (RefToElement r in FuncCode) { r.Write(bb); } }
public override void Write(ByteBuilder bb) { Address = (ushort)bb.Position; bb.AddByte(Type); foreach (object arg in Arguments) { switch (arg) { case byte b: bb.AddByte(b); break; case ushort s: bb.AddShortBE(s); break; case RefToElement r: r.Write(bb); break; case LinkToExport l: l.Write(bb); break; default: throw new NotImplementedException(); } } }
public override void Write(ByteBuilder bb) { foreach (var r in Refs) { bb.AddShortBE(r); } }
public override void Write(ByteBuilder bb) { bb.AddShortBE((ushort)Exports.Length); foreach (ExportRef exp in Exports) { if (exp != null) { exp.Write(bb); } else { bb.AddShortBE(0); } bb.AddShortBE(0); } }
public byte[] GetBytes() { ByteBuilder bb = new ByteBuilder(); foreach (Section sec in Sections) { bb.AddShortBE((ushort)sec.Type); int sizePos = bb.Position; bb.AddShortBE(0); sec.Write(bb); int endPos = bb.Position; bb.SetShortBE(sizePos, (ushort)(endPos - sizePos + 2)); } foreach (Section sec in Sections) { sec.WriteOffsets(bb); } bb.AddShortBE(0); return(bb.GetArray()); }
public override void Write(ByteBuilder bb) { IsWrited = true; Address = (ushort)bb.Position; switch (Size) { case 1: bb.AddByte(0); break; case 2: bb.AddShortBE(0); break; default: throw new NotImplementedException(); } }
private void SaveV3(List <MessageRecord> messages, ByteBuilder bb) { bb.AddIntBE(header); int endOffset = bb.Position; bb.AddShortBE(0); bb.AddShortBE((ushort)messages.Count); object[] extra = new object[messages.Count]; for (int i = 0; i < messages.Count; i++) { extra[i] = messages[i].WriteHeader(bb); } for (int i = 0; i < messages.Count; i++) { messages[i].WriteText(bb, extra[i], GameEncoding); } bb.SetShortBE(endOffset, (ushort)(bb.Position - endOffset)); }
public override object WriteHeader(ByteBuilder bb) { bb.AddByte(Noun); bb.AddByte(Verb); bb.AddByte(Cond); bb.AddByte(Seq); bb.AddByte(Talker); var offsetPos = bb.Position; bb.AddShortBE(0); // Text offset bb.AddThreeBytesBE(Unknown); return(offsetPos); }
protected override void WriteExt(ByteBuilder bb) { bb.WritePicAbsCoord(ref _coord); var sizePos = bb.Position; bb.AddShortBE(0); // Потом вернемся, чтобы записать размер данных bb.AddShortBE(Width); bb.AddShortBE(Height); bb.AddShortBE(0); bb.AddByte(_transpCol); bb.AddByte(0); WriteImageData(bb); var endPos = bb.Position; var size = endPos - sizePos - 2; if (size > 0xffff) { throw new FormatException("Too big image data"); } bb.SetShortBE(sizePos, (ushort)size); }
public override void Write(ByteBuilder bb) { foreach (object v in Vars) { switch (v) { case ushort s: bb.AddShortBE(s); break; case RefToElement r: r.Write(bb); break; } } }
public void Write(ByteBuilder bb) { bb.AddShortBE(_scrNumb); bb.AddShortBE(_expNumb); }
public override void Write(ByteBuilder bb) { Address = (ushort)bb.Position; bb.AddShortBE(Value); }