예제 #1
0
        private void _messageParser_DataReceived(object sender, NetDataReceivedEventArgs e)
        {
            PlaylistRequestMessage requestMessage = null;

            try
            {
                requestMessage = Deserialize <PlaylistRequestMessage>(e.Data);
            }
            catch
            {
                requestMessage = null;
            }


            if (requestMessage != null)
            {
                PlaylistResponseMessage responseMessage = requestMessage as PlaylistResponseMessage;
                if (responseMessage != null)
                {
                    if (responseMessage.ResponseId != this.ServiceId && responseMessage.RequestId == this.ServiceId)
                    {
                        if (!HasReceived(responseMessage))
                        {
                            OnResponseReceived(responseMessage);
                        }
                    }
                }
                else
                {
                    if (requestMessage.Sender != this.ServiceId)
                    {
                        if (!HasReceived(requestMessage))
                        {
                            OnRequestReceived(requestMessage);
                        }
                    }
                }
            }
        }
예제 #2
0
 private void _receiveService_DataReceived(object sender, NetDataReceivedEventArgs e)
 {
     _messageParser.AddData(e.RemoteEndPoint, e.Data);
 }