public static void Write(this byte[] buffer, ref int offset, IEnumerable <byte> value) { if (buffer == null) { throw new ArgumentNullException("buffer"); } if (value == null) { throw new ArgumentNullException("value"); } foreach (byte num in value) { ByteArrayExtensions.Write(buffer, offset++, num); } }
protected static uint Sum16Bits(byte[] buffer, int offset, int length) { if (buffer == null) { throw new ArgumentNullException("buffer"); } int num1 = offset + length; uint num2 = 0U; while (offset < num1 - 1) { num2 += (uint)ByteArrayExtensions.ReadUShort(buffer, ref offset, Endianity.Big); } if (offset < num1) { num2 += (uint)(ushort)((uint)buffer[offset] << 8); } return(num2); }
public static int Find(this byte[] array, int offset, int count, byte[] other, int otherOffset, int otherCount) { if (array == null) { throw new ArgumentNullException("array"); } if (otherCount > count) { return(array.Length); } for (int index = offset + count - otherCount; offset < index; ++offset) { if (ByteArrayExtensions.SequenceEqual(array, offset, other, otherOffset, otherCount)) { return(offset); } } return(array.Length); }
public static void WriteCarriageReturnLinefeed(this byte[] buffer, ref int offset) { ByteArrayExtensions.Write(buffer, ref offset, (byte)13); ByteArrayExtensions.Write(buffer, ref offset, (byte)10); }
public static void Write(this byte[] buffer, int offset, IpV6Address value, Endianity endianity) { ByteArrayExtensions.Write(buffer, offset, value.ToValue(), endianity); }
public static byte[] ReadBytes(this byte[] buffer, int offset, int length) { byte[] destination = new byte[length]; ByteArrayExtensions.BlockCopy(buffer, offset, destination, 0, length); return(destination); }
internal IpV6Address ReadIpV6Address(int offset, Endianity endianity) { return(ByteArrayExtensions.ReadIpV6Address(this.Buffer, this.StartOffset + offset, endianity)); }
protected MacAddress ReadMacAddress(int offset, Endianity endianity) { return(ByteArrayExtensions.ReadMacAddress(this.Buffer, this.StartOffset + offset, endianity)); }
public static ushort ReadUShort(this byte[] buffer, int offset, Endianity endianity) { return((ushort)ByteArrayExtensions.ReadShort(buffer, offset, endianity)); }
internal void Write(byte[] buffer, ref int offset) { ByteArrayExtensions.BlockCopy(this.Buffer, this.StartOffset, buffer, offset, this.Length); offset += this.Length; }
public static void Write(this byte[] buffer, ref int offset, byte value) { ByteArrayExtensions.Write(buffer, offset, value); ++offset; }
public static IpV6Address ReadIpV6Address(this byte[] buffer, int offset, Endianity endianity) { return(new IpV6Address(ByteArrayExtensions.ReadUInt128(buffer, offset, endianity))); }
public static IpV4TimeOfDay ReadIpV4TimeOfDay(this byte[] buffer, ref int offset, Endianity endianity) { return(new IpV4TimeOfDay(ByteArrayExtensions.ReadUInt(buffer, ref offset, endianity))); }
public static MacAddress ReadMacAddress(this byte[] buffer, ref int offset, Endianity endianity) { return(new MacAddress(ByteArrayExtensions.ReadUInt48(buffer, ref offset, endianity))); }
public static ulong ReadULong(this byte[] buffer, int offset, Endianity endianity) { return((ulong)ByteArrayExtensions.ReadLong(buffer, offset, endianity)); }
public static uint ReadUInt(this byte[] buffer, int offset, Endianity endianity) { return((uint)ByteArrayExtensions.ReadInt(buffer, offset, endianity)); }
public static void WriteDecimal(this byte[] buffer, ref int offset, uint value) { ByteArrayExtensions.Write(buffer, ref offset, value.ToString((IFormatProvider)CultureInfo.InvariantCulture), Encoding.ASCII); }
internal ushort ReadUShort(int offset, Endianity endianity) { return(ByteArrayExtensions.ReadUShort(this.Buffer, this.StartOffset + offset, endianity)); }
internal ulong ReadULong(int offset, Endianity endianity) { return(ByteArrayExtensions.ReadULong(this.Buffer, this.StartOffset + offset, endianity)); }
internal byte[] ReadBytes(int offset, int length) { return(ByteArrayExtensions.ReadBytes(this.Buffer, this.StartOffset + offset, length)); }
public static byte[] ReadBytes(this byte[] buffer, ref int offset, int length) { byte[] numArray = ByteArrayExtensions.ReadBytes(buffer, offset, length); offset += length; return(numArray); }
internal UInt48 ReadUInt48(int offset, Endianity endianity) { return(ByteArrayExtensions.ReadUInt48(this.Buffer, this.StartOffset + offset, endianity)); }
public static void Write(this byte[] buffer, ref int offset, UInt48 value, Endianity endianity) { ByteArrayExtensions.Write(buffer, offset, value, endianity); offset += 6; }
internal BigInteger ReadUnsignedBigInteger(int offset, int length, Endianity endianity) { return(ByteArrayExtensions.ReadUnsignedBigInteger(this.Buffer, this.StartOffset + offset, length, endianity)); }
public static void Write(this byte[] buffer, int offset, ulong value, Endianity endianity) { ByteArrayExtensions.Write(buffer, offset, (long)value, endianity); }
protected IpV4TimeOfDay ReadIpV4TimeOfDay(int offset, Endianity endianity) { return(ByteArrayExtensions.ReadIpV4TimeOfDay(this.Buffer, this.StartOffset + offset, endianity)); }
public static void Write(this byte[] buffer, int offset, DataSegment value) { ByteArrayExtensions.Write(buffer, ref offset, value); }
public static void Write(this byte[] buffer, ref int offset, IpV4TimeOfDay value, Endianity endianity) { ByteArrayExtensions.Write(buffer, ref offset, value.MillisecondsSinceMidnightUniversalTime, endianity); }
public void CopyTo(byte[] array, int arrayIndex) { ByteArrayExtensions.BlockCopy(this.Buffer, 0, array, arrayIndex, this.Length); }