Пример #1
0
		public MachSection(Bits.Num Num)
		{
			AddressSize = Num;
		}
Пример #2
0
		public MachLoadCommandSegment(Bits.Num Addressing)
		{
			AddressSize = Addressing;
		}
Пример #3
0
		public void WriteAbsoluteOffsetAndDelayedData(byte[] Data, long Alignment, Bits.Num Num)
		{
			WriteOffsetAndDelayedData(Data, Alignment, 0, Num);
		}
Пример #4
0
		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);
				});
			}
		}
Пример #5
0
		/// <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);
		}
Пример #6
0
		public void WriteUInt(UInt64 Value, Bits.Num Num)
		{
			if (Num == Bits.Num._64)
				Write(Value);
			else
				Write((UInt32)Value);
		}
Пример #7
0
		/// <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);
		}
Пример #8
0
		public LengthFieldU32or64 WriteDeferredLength(long AlreadyCountedBytes, Bits.Num Num)
		{
			return new LengthFieldU32or64(this, Position - AlreadyCountedBytes, Num);
		}
Пример #9
0
		public OffsetFieldU32or64(WritingContext Context, long BaseOffset, Bits.Num Address)
			: base(Context, BaseOffset, Address)
		{
		}
Пример #10
0
		public DeferredFieldU32or64(WritingContext Context, long Base, Bits.Num Address)
		{
			AnchorPoint = Base;
			WritePoint = Context.Position;

			AddressSize = Address;
			Context.Position += Bits.Bytes(AddressSize);
		}
Пример #11
0
		public UInt64 ReadUInt(Bits.Num Num)
		{
			if (Num == Bits.Num._64)
				return ReadUInt64();
			else
				return ReadUInt32();
		}