private void ProcessMsg(YMSGMsg msg) { switch (msg.Type) { case YMSGTypes.YAHOO_SERVICE_MESSAGE: var reciever = String.Empty; var sender = String.Empty; var message = String.Empty; foreach (var tvTuple in msg.TVs) { switch (tvTuple.Item1) { case YMSGTVTypes.ReceiverYahooID: reciever = tvTuple.Item2; break; case YMSGTVTypes.TransmiterYahooID1: case YMSGTVTypes.TransmiterYahooID2: case YMSGTVTypes.TransmiterYahooID3: sender = tvTuple.Item2; break; case YMSGTVTypes.YahooMsg: message = tvTuple.Item2; break; } } var exportObject = new SnooperExportedObjectYMSG(this.SnooperExport) { Message = message, Receiver = reciever, Sender = sender, TimeStamp = msg.Timestamp, }; exportObject.ExportSources.AddRange(msg.ExportSources); this.SnooperExport.AddExportObject(exportObject); break; } }
protected override void ProcessConversation() { // we need a stream to read from var stream = new PDUStreamBasedProvider(this.CurrentConversation, EfcPDUProviderType.Breaked); // now we can create a reader that will be reading from the stream we just created ////////////////////////////////// // reader will spawn messages, cycle through them do { var reader = new PDUStreamReader(stream, Encoding.ASCII) { ReadBigEndian = true }; this.OnBeforeProtocolParsing(); var msg = new YMSGMsg(reader); if (!msg.Valid) { // parsing went wrong, we have to report it this.SnooperExport.TimeStampFirst = msg.Timestamp; this.SnooperExport.AddExportReport(ExportReport.ReportLevel.Warn, this.Name, "parsing of YMSG message failed: " + msg.InvalidReason, msg.ExportSources); // skip processing, go to next message continue; } this.OnAfterProtocolParsing(); this.OnBeforeDataExporting(); this.ProcessMsg(msg); this.OnAfterDataExporting(); } while(stream.NewMessage()); }