protected override BaseBlock ConvertToBaseBlock(bool reverseByteOrder, Action <Exception> ActionOnException) { List <byte> body = new List <byte>(); body.AddRange(BitConverter.GetBytes(((uint)MagicNumber).ReverseByteOrder(reverseByteOrder))); body.AddRange(BitConverter.GetBytes(MajorVersion.ReverseByteOrder(reverseByteOrder))); body.AddRange(BitConverter.GetBytes(MinorVersion.ReverseByteOrder(reverseByteOrder))); body.AddRange(BitConverter.GetBytes(SectionLength.ReverseByteOrder(reverseByteOrder))); body.AddRange(Options.ConvertToByte(reverseByteOrder, ActionOnException)); BaseBlock baseBlock = new BaseBlock(this.BlockType, body.ToArray(), reverseByteOrder, 0); return(baseBlock); }
public byte[] ConvertToByte() { List <byte> ret = new List <byte>(); bool reverseByteOrder = this.ReverseByteOrder; ret.AddRange(BitConverter.GetBytes((uint)MagicNumber)); ret.AddRange(BitConverter.GetBytes(MajorVersion.ReverseByteOrder(reverseByteOrder))); ret.AddRange(BitConverter.GetBytes(MinorVersion.ReverseByteOrder(reverseByteOrder))); ret.AddRange(BitConverter.GetBytes(TimezoneOffset.ReverseByteOrder(reverseByteOrder))); ret.AddRange(BitConverter.GetBytes(SignificantFigures.ReverseByteOrder(reverseByteOrder))); ret.AddRange(BitConverter.GetBytes(MaximumCaptureLength.ReverseByteOrder(reverseByteOrder))); ret.AddRange(BitConverter.GetBytes(((uint)LinkType).ReverseByteOrder(reverseByteOrder))); return(ret.ToArray()); }