public void RaiseEventFake(OSCPacket packet) { OSCPacketReceivedEventArgs args = new OSCPacketReceivedEventArgs(); args.packet = packet; OnOSCPacketReceivedEvent(args); }
/// <summary> /// Event raised when a packet is received /// </summary> private void OnOSCPacketReceivedEvent(OSCPacketReceivedEventArgs e) { OSCPacketReceivedEventHandler handler = OSCPacketReceivedEvent; if (handler != null) { handler(this, e); } }
/// <summary> /// Event consumer for udp message received. Raises OSCPacketReceivedEvent. /// </summary> public void udpClient_MessageReceived(object sender, DatagramSocketMessageReceivedEventArgs e) { DataReader reader = e.GetDataReader(); if (reader.UnconsumedBufferLength > 0) { byte[] bytes = new byte[reader.UnconsumedBufferLength]; reader.ReadBytes(bytes); OSCPacketReceivedEventArgs args = new OSCPacketReceivedEventArgs(); args.packet = OSCPacket.Unpack(bytes); OnOSCPacketReceivedEvent(args); Debug.WriteLine(args.packet.ToString()); } }