public void ProcessMessage(ParsedMessage message) { IReceiveMessage instance = (IReceiveMessage)Activator.CreateInstance(this.Type); instance.ProcessMessage(message, this._client); }
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(); } }
public bool CheckMessage(ParsedMessage message) { return this._checkMessageDelegate(message, this._client); }