public ConnectionMessage(byte[] encoding) : this() { try { MemoryStream input = new MemoryStream(encoding, 0, encoding.Length, false); BinaryReader binaryReader = new BinaryReader(new BufferedStream(input)); MessagesEncodingUtil.ReadByte(binaryReader); } catch (Exception) { throw new BinaryEncodingException("Encode"); } }
public ByteArrayMessage(byte[] encoding) : this() { try { MemoryStream input = new MemoryStream(encoding, 0, encoding.Length, false); BinaryReader binaryReader = new BinaryReader(new BufferedStream(input)); MessagesEncodingUtil.ReadByte(binaryReader); int binaryArrayLength = MessagesEncodingUtil.ReadInt(binaryReader); ByteArray = MessagesEncodingUtil.ReadByteArray(binaryReader, binaryArrayLength); } catch (Exception) { throw new BinaryEncodingException("Encode"); } }
public PeerAddressMessage(byte[] encoding) : this() { try { MemoryStream memoryStream = new MemoryStream(encoding, 0, encoding.Length, false); BinaryReader binaryReader = new BinaryReader(new BufferedStream(memoryStream)); TypeOfMessage = (MessageType)MessagesEncodingUtil.ReadByte(binaryReader); IPEndPoint localEndPoint = ParseIpEndPoint(MessagesEncodingUtil.ReadString(binaryReader)); IPEndPoint publicEndPoint = ParseIpEndPoint(MessagesEncodingUtil.ReadString(binaryReader)); PeerAddress = new PeerAddress(localEndPoint, publicEndPoint); } catch (Exception) { throw new BinaryEncodingException("Encode"); } }