public override void Deserialize(BEReader reader) { TextSessionId = reader.ReadUInt64(); TextBufferVersion = reader.ReadUInt32(); Result = (TextResult)reader.ReadUInt16(); Text = reader.ReadUInt16PrefixedString(); }
public override void Deserialize(BEReader reader) { Timestamp = reader.ReadUInt64(); AngularVelocityX = reader.ReadInt32(); AngularVelocityY = reader.ReadInt32(); AngularVelocityZ = reader.ReadInt32(); }
void ISerializable.Deserialize(BEReader reader) { Id = reader.ReadUInt32(); Action = (TouchAction)reader.ReadUInt16(); PointX = reader.ReadUInt32(); PointY = reader.ReadUInt32(); }
public override void Deserialize(BEReader reader) { var message = reader.ReadToEnd(); var messageBody = message.Take(message.Length - 32).ToArray(); var signature = message.Skip(message.Length - 32).ToArray(); if (!signature.SequenceEqual(Crypto.CalculateMessageSignature(messageBody))) { InvalidSignature = true; return; } var initVectorSource = message.Take(16).ToArray(); var initVector = Crypto.CreateDerivedInitVector(initVectorSource); var messageBodyReader = new BEReader(messageBody); Header.Deserialize(messageBodyReader); var payload = messageBodyReader.ReadToEnd(); var payloadReader = new BEReader(payload); DeserializePayload(payloadReader); var decrypted = Crypto.DecryptWithoutPadding(Fragment, initVector); Fragment = decrypted.Take(Header.PayloadLength).ToArray(); }
public void TestToBytes() { byte[] data = new byte[] { 0xBE, 0xEF, 0xDE, 0xAD }; BEReader reader = new BEReader(data); Assert.Equal <byte[]>(data, reader.ToBytes()); }
public void Deserialize(BEReader reader) { Type = (MessageType)reader.ReadUInt16(); PayloadLength = reader.ReadUInt16(); ProtectedPayloadLength = reader.ReadUInt16(); Version = reader.ReadUInt16(); }
public override void Deserialize(BEReader reader) { TextSessionId = reader.ReadUInt64(); TextBufferVersion = reader.ReadUInt32(); Start = reader.ReadUInt32(); Length = reader.ReadUInt32(); }
public override void Deserialize(BEReader reader) { Timestamp = reader.ReadUInt64(); Pitch = reader.ReadInt32(); Roll = reader.ReadInt32(); Yaw = reader.ReadInt32(); }
public override void Deserialize(BEReader reader) { Configuration = new ConsoleConfiguration(); ((ISerializable)Configuration).Deserialize(reader); ActiveTitles = reader.ReadArray <ActiveTitle>(); }
protected override void DeserializePayload(BEReader reader) { Flags = reader.ReadUInt32(); DeviceType = (DeviceType)reader.ReadUInt16(); MinVersion = reader.ReadUInt16(); MaxVersion = reader.ReadUInt16(); }
public override void Deserialize(BEReader reader) { SurfaceType = (ActiveSurfaceType)reader.ReadUInt16(); StreamerConfiguration = new StreamerConfiguration(); StreamerConfiguration.Deserialize(reader); }
public override void Deserialize(BEReader reader) { TextSessionId = reader.ReadUInt32(); TextVersion = reader.ReadUInt32(); Flags = reader.ReadUInt32(); Result = (TextResult)reader.ReadUInt32(); }
public static RtpPacket CreateFromBuffer(BEReader br) { var packet = new RtpPacket(); packet.Deserialize(br); return(packet); }
public override void Deserialize(BEReader reader) { Timestamp = reader.ReadUInt64(); AccelerationX = reader.ReadInt32(); AccelerationY = reader.ReadInt32(); AccelerationZ = reader.ReadInt32(); }
void ISerializable.Deserialize(BEReader reader) { LiveTVProvider = reader.ReadUInt32(); MajorVersion = reader.ReadUInt32(); MinorVersion = reader.ReadUInt32(); BuildNumber = reader.ReadUInt32(); Locale = reader.ReadString(); }
public override void Deserialize(BEReader reader) { if (reader.ReadByte() == 1) { ConnectionInfo = new AuxiliaryStreamConnectionInfo(); ConnectionInfo.Deserialize(reader); } }
public MessageTransport(string addressOrHostname, CryptoContext crypto) { _addressOrHostname = addressOrHostname; _crypto = crypto; _client = _addressOrHostname != null ? new UdpClient(_addressOrHostname, 5050) : new UdpClient(AddressFamily.InterNetwork); if (_addressOrHostname == null) { _client.Client.Bind(new IPEndPoint(IPAddress.Any, 0)); } _cancellationTokenSource = _client.ConsumeReceived(receiveResult => { var reader = new BEReader(receiveResult.Buffer); var messageType = (MessageType)reader.ReadUInt16(); reader.Position = 0; var message = CreateFromMessageType(messageType); if (message == null) { // TODO: Tracing for this. return; } var cryptoMessage = message as ICryptoMessage; if (cryptoMessage != null) { cryptoMessage.Crypto = _crypto; } message.Origin = receiveResult.RemoteEndPoint; message.ClientReceivedTimestamp = DateTime.Now; message.Deserialize(reader); _receiveQueue.TryAdd(message); }); Task.Run(() => { while (!_receiveQueue.IsCompleted) { try { var message = _receiveQueue.Take(); MessageReceived?.Invoke(this, new MessageReceivedEventArgs <IMessage>(message)); } catch (Exception e) { Console.WriteLine(e.ToString()); Console.WriteLine("Calling MessageReceived failed!"); } } }); }
public override void Deserialize(BEReader reader) { Timestamp = reader.ReadUInt64(); RotationMatrixValue = reader.ReadInt32(); RotationW = reader.ReadInt32(); RotationX = reader.ReadInt32(); RotationY = reader.ReadInt32(); RotationZ = reader.ReadInt32(); }
public BEReaderTests() { byte[] data = new byte[] { 0x04, 0x00, 0x00, 0x00, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C }; _reader = new BEReader(data); }
public NanoRdpTransport(string address, int tcpPort, int udpPort) { _address = address; _tcpPort = tcpPort; _udpPort = udpPort; IPAddress hostAddr = IPAddress.Parse(address); _controlProtoEp = new IPEndPoint(hostAddr, _tcpPort); _streamingProtoEp = new IPEndPoint(hostAddr, _udpPort); _controlProtoClient = new TcpClient(AddressFamily.InterNetwork); _streamingProtoClient = new UdpClient(AddressFamily.InterNetwork); _controlProtoClient.Client.Bind(new IPEndPoint(IPAddress.Any, 0)); _streamingProtoClient.Client.Bind(new IPEndPoint(IPAddress.Any, 0)); _controlProtoClient.Connect(_controlProtoEp); _streamingProtoClient.Connect(_streamingProtoEp); _cancellationTokenSourceControl = _controlProtoClient.ConsumeReceived(receiveResult => { BEReader reader = new BEReader(receiveResult); RtpPacket packet = RtpPacket.CreateFromBuffer(reader); _receiveQueue.TryAdd(packet); }); _cancellationTokenSourceStreaming = _streamingProtoClient.ConsumeReceived(receiveResult => { // Lets NanoClient know when to end sending UDP handshake packets if (!udpDataActive) { udpDataActive = true; } BEReader reader = new BEReader(receiveResult.Buffer); RtpPacket packet = RtpPacket.CreateFromBuffer(reader); _receiveQueue.TryAdd(packet); }); Task.Run(() => { while (!_receiveQueue.IsCompleted) { try { var message = _receiveQueue.Take(); MessageReceived?.Invoke(this, new MessageReceivedEventArgs <RtpPacket>(message)); } catch (Exception e) { Console.WriteLine(e.ToString()); Console.WriteLine("Calling Nano MessageReceived failed!"); } } }); }
public void Deserialize(BEReader reader) { ServerTcpPort = reader.ReadUInt16(); ServerUdpPort = reader.ReadUInt16(); SessionId = new Guid(reader.ReadBytes(16)); RenderWidth = reader.ReadUInt16(); RenderHeight = reader.ReadUInt16(); MasterSessionKey = reader.ReadBytes(32); }
protected override void DeserializePayload(BEReader reader) { Flags = (DeviceFlags)reader.ReadUInt32(); DeviceType = (DeviceType)reader.ReadUInt16(); Name = reader.ReadString(); HardwareId = Guid.Parse(reader.ReadString()); LastError = reader.ReadUInt32(); Certificate = CryptoExtensions.DeserializeCertificateAsn(reader.ReadBlob()); }
public void Deserialize(BEReader reader) { CryptoKey = reader.ReadBlob(); ServerInitVector = reader.ReadBlob(); ClientInitVector = reader.ReadBlob(); SignHash = reader.ReadBlob(); Endpoints = reader.ReadArray <AuxiliaryStreamEndpoint>(); }
public override void Deserialize(BEReader reader) { TextSessionId = reader.ReadUInt64(); TextBufferVersion = reader.ReadUInt32(); TextOptions = (TextOption)reader.ReadUInt32(); InputScope = (TextInputScope)reader.ReadUInt32(); MaxTextLength = reader.ReadUInt32(); Locale = reader.ReadString(); Prompt = reader.ReadString(); }
public void Deserialize(BEReader br) { Header.Deserialize(br); Payload = CreateFromPayloadType(Header.PayloadType); byte[] buf = br.ReadToEnd(); BinaryReader payloadReader = BinaryExtensions.ReaderFromBytes(buf); Payload.Deserialize(payloadReader); }
public void Deserialize(BEReader br) { Header.Deserialize(br); Payload = CreateFromPayloadType(Header.PayloadType); byte[] buf = br.ReadToEnd(); LEReader payloadReader = new LEReader(buf); Payload.Deserialize(payloadReader); }
public override void Deserialize(BEReader reader) { TextSessionId = reader.ReadUInt32(); BaseVersion = reader.ReadUInt32(); SubmittedVersion = reader.ReadUInt32(); TotalTextBytelength = reader.ReadUInt32(); SelectionStart = reader.ReadInt32(); SelectionLength = reader.ReadInt32(); Flags = reader.ReadUInt16(); TextChunkByteStart = reader.ReadUInt32(); TextChunk = reader.ReadUInt16PrefixedString(); Delta = reader.ReadUInt16PrefixedArray <TextDelta>(); }
void ISerializable.Deserialize(BEReader reader) { TitleId = reader.ReadUInt32(); // This is weird: HasFocus = reader.ReadByte() == 128; TitleLocation = (ActiveTitleLocation)reader.ReadByte(); ProductId = new Guid(reader.ReadBytes(16)); SandboxId = new Guid(reader.ReadBytes(16)); AumId = reader.ReadString(); }
public void TestUInt16PrefixedBlob() { byte[] data = new byte[] { 0x00, 0x03, 0xDE, 0xAD, 0xBE }; BEReader reader = new BEReader(data); byte[] result = reader.ReadUInt16PrefixedBlob(); Assert.Equal <int>(3, result.Length); Assert.Equal <byte[]>(new byte[] { 0xDE, 0xAD, 0xBE }, result); }
void ISerializable.Deserialize(BEReader reader) { TitleId = reader.ReadUInt32(); ushort titleDisposition = reader.ReadUInt16(); HasFocus = (titleDisposition & 0x8000) == 0x8000; TitleLocation = (ActiveTitleLocation)(titleDisposition & 0x7FFF); ProductId = new Guid(reader.ReadBytes(16)); SandboxId = new Guid(reader.ReadBytes(16)); AumId = reader.ReadUInt16PrefixedString(); }