Exemple #1
0
        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 ICQMsg(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 ICQ 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());
        }
Exemple #2
0
        protected override void ProcessConversation()
        {
            Console.WriteLine(@"SnooperMinecraft.ProcessConversation() called");

            // we need a stream to read from
            var stream = new PDUStreamBasedProvider(this.CurrentConversation, EfcPDUProviderType.SingleMessage);
            // now we can create a reader that will be reading from the stream we just created
            var reader = new BinaryReader(stream, Encoding.ASCII);

            // reader will spawn messages, cycle through them
            do
            {
                this.OnBeforeProtocolParsing();

                // parse protocol
                // this is self parsing message, it just needs a reader to get data from
                var message = new MinecraftMsg(reader);
                if (!message.Valid) // is not chat message
                {
                    continue;
                }

                // parsing done
                this.OnAfterProtocolParsing();

                // start processing
                this.OnBeforeDataExporting();

                var exportedObject = new SnooperExportedMinecraftMessage(this.SnooperExport)
                {
                    TimeStamp = message.Timestamp,
                    Message   = message.MessageContent,
                    Sender    = message.Sender,
                    Receiver  = message.Receiver,
                    Text      = message.Text,
                    Type      = message.MessageType
                };

                // export
                exportedObject.ExportSources.Add(this.CurrentConversation);
                this.SnooperExport.AddExportObject(exportedObject);

                this.OnAfterDataExporting();

                //finalize processing of current message, moving to next one
                // IMPORTANT !!! this has to be called after each message successfully processed
                // so correct connections between exported data and exported reports can be kept
                //base.ProcessingDone();
            } while (stream.NewMessage());
        }