public void DisplayText(NetworkEvent ne)
        {
            this.m_Image = null;
            DateTime time = new DateTime(ne.timeIndex);
            this.infoLabel.Text = "";
            this.appendText("Sender: " + ne.source);
            this.appendText("Time: " + time.ToLongDateString() + " " + time.ToLongTimeString());
            if (ne is NetworkChunkEvent) {
                NetworkChunkEvent nce = ne as NetworkChunkEvent;
                this.appendText("Category: Chunk");
                this.appendText("Message Sequence: " + nce.chunk.MessageSequence);
                this.appendText("Chunk Sequence: " + nce.chunk.ChunkSequence);
                this.appendText("First Chunk Sequence of Message: " + nce.chunk.FirstChunkSequenceOfMessage);
                this.appendText("Number of Chunks: " + nce.chunk.NumberOfChunksInMessage);
            } else if (ne is NetworkMessageEvent) {
                NetworkMessageEvent nme = ne as NetworkMessageEvent;
                this.appendText("Category: Message");
                this.displayMessageEventRecursive(nme.message);
            } else if (ne is NetworkNACKMessageEvent) {

            } else {
                //Unknown
                this.infoLabel.Text = "Unknown Type";
            }
            this.doubleBufferPanel.Invalidate();
        }
Exemplo n.º 2
0
        // Get the Next event from the archive and advance the File pointer
        public NetworkEvent GetNextEvent()
        {
            NetworkEvent e = null;

            if (mode == ArchiveMode.ReadingMode)
            {
                // Read the previous offset and current length
                long tempPrevOffset = (long)ReadLong(archive);
                long tempLength     = (long)ReadLong(archive);

                // Read the object from the file
                byte[] byteArray = new byte[tempLength];
                archive.Read(byteArray, 0, (int)tempLength);

                // Deserialize the ArchiveEvent
                try {
                    BinaryFormatter binaryFormatter = new BinaryFormatter();
                    MemoryStream    memoryStream    = new MemoryStream(byteArray, 0, (int)tempLength);
                    e = (NetworkEvent)binaryFormatter.Deserialize(memoryStream);
                }
                catch (System.Runtime.Serialization.SerializationException) {
                    return(null);
                }
            }

            return(e);
        }
Exemplo n.º 3
0
        // Gets the next event but does not advance the File pointer
        public NetworkEvent PeekNextEvent()
        {
            NetworkEvent e = GetNextEvent();

            PrevEvent();
            return(e);
        }
Exemplo n.º 4
0
        // Add an event to the currently opened archive
        public void AppendEvent( NetworkEvent e )
        {
            if( mode == ArchiveMode.WritingMode ) {
                // Save the current file offset
                long tempPrevOffset = this.PrevEventOffset;
                this.PrevEventOffset = archive.Position;

                // Serialize the Object
                MemoryStream memoryStream = new MemoryStream();
                BinaryFormatter binaryFormatter = new BinaryFormatter();
                binaryFormatter.Serialize(memoryStream, e);

                // Write to a byte array
                byte[] byteArray = new byte[memoryStream.Length];
                memoryStream.Position = 0;
                memoryStream.Read(byteArray, 0, (int) memoryStream.Length);

                // Write to the file
                WriteLong( archive, (ulong)tempPrevOffset );                // Previous Event File Offset
                WriteLong( archive, (ulong)memoryStream.Length );           // Current Event Length
                archive.Write( byteArray, 0, (int)memoryStream.Length );    // Current Event Data
            }
        }
Exemplo n.º 5
0
        // Add an event to the currently opened archive
        public void AppendEvent(NetworkEvent e)
        {
            if (mode == ArchiveMode.WritingMode)
            {
                // Save the current file offset
                long tempPrevOffset = this.PrevEventOffset;
                this.PrevEventOffset = archive.Position;

                // Serialize the Object
                MemoryStream    memoryStream    = new MemoryStream();
                BinaryFormatter binaryFormatter = new BinaryFormatter();
                binaryFormatter.Serialize(memoryStream, e);

                // Write to a byte array
                byte[] byteArray = new byte[memoryStream.Length];
                memoryStream.Position = 0;
                memoryStream.Read(byteArray, 0, (int)memoryStream.Length);

                // Write to the file
                WriteLong(archive, (ulong)tempPrevOffset);                  // Previous Event File Offset
                WriteLong(archive, (ulong)memoryStream.Length);             // Current Event Length
                archive.Write(byteArray, 0, (int)memoryStream.Length);      // Current Event Data
            }
        }
Exemplo n.º 6
0
 public void HandleNetworkEventReceived(object sender, NetworkEvent e)
 {
     this.tdf.AppendText(e.ToString() + " " + e.source);
 }