public MachSection(Bits.Num Num) { AddressSize = Num; }
public MachLoadCommandSegment(Bits.Num Addressing) { AddressSize = Addressing; }
public void WriteAbsoluteOffsetAndDelayedData(byte[] Data, long Alignment, Bits.Num Num) { WriteOffsetAndDelayedData(Data, Alignment, 0, Num); }
public void WriteOffsetAndDelayedData(byte[] Data, long Alignment, long OffsetFrom, Bits.Num Num) { if ((Data == null) || (Data.Length == 0)) { SW.Write((UInt32)0); } else { OffsetFieldU32or64 Offset = WriteDeferredOffsetFrom(OffsetFrom, Num); CurrentPhase.PendingWrites.Enqueue(delegate(WritingContext Context) { long ModPosition = Position % Alignment; if (ModPosition != 0) { WriteZeros(Alignment - ModPosition); } CommitDeferredField(Offset); Write(Data); }); } }
/// <summary> /// Emits an offset field that needs to be committed once the true offset is known /// </summary> /// <param name="AlreadyCountedBytes">The number of bytes ago that the offset is relative to. Pass in 0 to be relative to the current output position.</param> /// <param name="Num">Number of bits this write will be.</param> /// <returns></returns> public OffsetFieldU32or64 WriteDeferredOffsetFrom(long BasePosition, Bits.Num Num) { return new OffsetFieldU32or64(this, BasePosition, Num); }
public void WriteUInt(UInt64 Value, Bits.Num Num) { if (Num == Bits.Num._64) Write(Value); else Write((UInt32)Value); }
/// <summary> /// Emits an offset field that needs to be committed once the true offset is known /// </summary> /// <param name="AlreadyCountedBytes">The number of bytes ago that the offset is relative to. Pass in 0 to be relative to the current output position.</param> /// <param name="Num">Number of bits this write will be.</param> /// <returns></returns> public OffsetFieldU32or64 WriteDeferredOffset(long AlreadyCountedBytes, Bits.Num Num) { return new OffsetFieldU32or64(this, Position - AlreadyCountedBytes, Num); }
public LengthFieldU32or64 WriteDeferredLength(long AlreadyCountedBytes, Bits.Num Num) { return new LengthFieldU32or64(this, Position - AlreadyCountedBytes, Num); }
public OffsetFieldU32or64(WritingContext Context, long BaseOffset, Bits.Num Address) : base(Context, BaseOffset, Address) { }
public DeferredFieldU32or64(WritingContext Context, long Base, Bits.Num Address) { AnchorPoint = Base; WritePoint = Context.Position; AddressSize = Address; Context.Position += Bits.Bytes(AddressSize); }
public UInt64 ReadUInt(Bits.Num Num) { if (Num == Bits.Num._64) return ReadUInt64(); else return ReadUInt32(); }