public static int Encode(System.IO.Stream buffer, System.Net.NetworkInformation.PhysicalAddress destination, System.Net.NetworkInformation.PhysicalAddress source, Type type) { //destination DCP.EncodeOctets(buffer, destination.GetAddressBytes()); //source DCP.EncodeOctets(buffer, source.GetAddressBytes()); //type DCP.EncodeU16(buffer, (ushort)type); return(14); }
public static int EncodeGuid(System.IO.Stream buffer, Encodings encoding, Guid value) { int ret = 0; byte[] bytes = value.ToByteArray(); UInt32 Data1 = BitConverter.ToUInt32(bytes, 0); UInt16 Data2 = BitConverter.ToUInt16(bytes, 4); UInt16 Data3 = BitConverter.ToUInt16(bytes, 6); byte[] Data4 = new byte[8]; Array.Copy(bytes, 8, Data4, 0, 8); ret += EncodeU32(buffer, encoding, Data1); ret += EncodeU16(buffer, encoding, Data2); ret += EncodeU16(buffer, encoding, Data3); ret += DCP.EncodeOctets(buffer, Data4); return(ret); }