private void OnProcessData(byte[] buffer, int offset, int count) { this.Reader.WriteData(buffer, offset, count); var lineData = new LineData(null, string.Empty, null); while (lineData != null) // ignoring empty lines { lineData = this.Reader.ReadLine(); if (lineData != null) { if (lineData.Line.Length > 0) { var lineEvent = new RawLineReceivedEventArgs(lineData); var handleRawLine = ((Action <RawLineReceivedEventArgs>) this.HandleRawLine); handleRawLine.BeginInvoke(lineEvent, handleRawLine.EndInvoke, null); } if (lineData.Line.Length == 0) { Debug.Assert(false); // Temp breakpoint } } } }
private void OnRawLineReceived(RawLineReceivedEventArgs line) { EventHandler <RawLineReceivedEventArgs> handler = this.RawLineReceived; if (handler != null) { handler(this, line); } }
private void HandleRawLine(RawLineReceivedEventArgs lineEvent) { try { string line = lineEvent.RawLine.Line; var rawLineId = lineEvent.RawLine.Id; Logger.WriteLine("Received: {0}, with {1}", TraceEventType.Information, line, rawLineId); this.OnRawLineReceived(lineEvent); if (lineEvent.PreventProcessing) { return; } ParsedLineEventArgs parsedLine; string afterId = line; int secoundSpace = this.FindFirstSeparatingSpace(afterId); if (secoundSpace == -1) { throw new RawLineFormatException("The Raw line doesn't contain a secound separation space"); } string command = afterId.Substring(0, secoundSpace); string parameter = afterId.Substring(secoundSpace + 1); command = UnEscapeString(command); parameter = UnEscapeString(parameter); parsedLine = new ParsedLineEventArgs( rawLineId, command, new StringParameter(parameter), lineEvent.RawLine.RawData); this.HandleParsedLineReceived(parsedLine); } catch (RawLineFormatException e) { Logger.WriteLine("Received Invalid Line... Disconnecting: {0}", TraceEventType.Error, e); this.HandleDisconnect(); } catch (Exception e) { this.HandleUnknownException(e); } }
private void OnRawLineReceived(RawLineReceivedEventArgs line) { EventHandler<RawLineReceivedEventArgs> handler = this.RawLineReceived; if (handler != null) { handler(this, line); } }
private void OnProcessData(byte[] buffer, int offset, int count) { this.Reader.WriteData(buffer, offset, count); var lineData = new LineData(null, string.Empty, null); while (lineData != null) // ignoring empty lines { lineData = this.Reader.ReadLine(); if (lineData != null) { if (lineData.Line.Length > 0) { var lineEvent = new RawLineReceivedEventArgs(lineData); var handleRawLine = ((Action<RawLineReceivedEventArgs>)this.HandleRawLine); handleRawLine.BeginInvoke(lineEvent, handleRawLine.EndInvoke, null); } if (lineData.Line.Length == 0) { Debug.Assert(false); // Temp breakpoint } } } }