Exemplo n.º 1
0
 public void ProcessMessage(ParsedMessage message)
 {
     IReceiveMessage instance = (IReceiveMessage)Activator.CreateInstance(this.Type);
     instance.ProcessMessage(message, this._client);
 }
Exemplo n.º 2
0
        private void ReadStream()
        {
            try
            {
                while (this.TcpClient != null && this.TcpClient.Connected &&
                       this.Reader != null && !this.Reader.EndOfStream)
                {
                    string line = this.Reader.ReadLine();
                    if (String.IsNullOrEmpty(line)) continue;

                    foreach (Type writerType in this._outputWriters)
                    {
                        IWriter instance = (IWriter)Activator.CreateInstance(writerType);
                        instance.ProcessReadMessage(line, this);
                    }

                    ParsedMessage message = new ParsedMessage(this, line);

                    foreach (RegisteredMessage messageType in this._registeredMessages)
                    {
                        if (messageType.CheckMessage(message))
                        {
                            messageType.ProcessMessage(message);
                        }
                    }
                }
            }
            catch (IOException ex)
            {
                Console.WriteLine("Received IOException: " + ex.Message);
            }
            finally
            {
                this.TriggerOnDisconnect();
            }
        }
Exemplo n.º 3
0
 public bool CheckMessage(ParsedMessage message)
 {
     return this._checkMessageDelegate(message, this._client);
 }