コード例 #1
0
        public override VisualTransaction[] GetTransactions(IPSession session)
        {
            List <VisualTransaction> transactions = new List <VisualTransaction>();

            session.ResetState();

            PacketStream stream1 = session.GetNextStreamDirection();
            PacketStream stream2 = session.GetNextStreamDirection();

            List <IPPacket> packets = new List <IPPacket>(stream1.Packets.Count + stream2.Packets.Count);

            packets.AddRange(stream1.Packets);
            packets.AddRange(stream2.Packets);
            packets.Sort();

            VisualTransaction transaction = null;
            MemoryStream      previewData = new MemoryStream();
            int transferred = 0;

            foreach (IPPacket packet in packets)
            {
                if (transaction == null || (transaction != null && packet.Direction != transaction.Direction))
                {
                    if (transaction != null)
                    {
                        transaction.AddHeaderField("Size", transferred);

                        byte[] bytes = previewData.ToArray();
                        transaction.SetBodyFromPreviewData(bytes, bytes.Length);
                    }

                    transaction = new VisualTransaction(packet.Index, packet.Direction, packet.Timestamp);
                    transaction.AddHeaderField("Direction", packet.Direction);
                    transaction.HeaderRowsPerCol = 1;
                    transactions.Add(transaction);
                    previewData.SetLength(0);
                    transferred = 0;
                }

                transaction.EndTime = packet.Timestamp;

                previewData.Write(packet.Bytes, 0, packet.Bytes.Length);

                transferred += packet.Bytes.Length;
            }

            if (transaction != null)
            {
                transaction.AddHeaderField("Size", transferred);

                byte[] bytes = previewData.ToArray();
                transaction.SetBodyFromTruncatedPreviewData(bytes, transferred - bytes.Length);
            }

            return(transactions.ToArray());
        }
コード例 #2
0
        public override VisualTransaction[] GetTransactions(IPSession session)
        {
            List <VisualTransaction> transactions = new List <VisualTransaction>(session.Events.Count);

            foreach (TCPEvent ev in session.Events)
            {
                VisualTransaction transaction = new VisualTransaction(0, ev.Timestamp);
                transaction.HeadlineText = ev.ToString();
                transactions.Add(transaction);
            }

            return(transactions.ToArray());
        }
コード例 #3
0
ファイル: VisualTransaction.cs プロジェクト: wyrover/ospy
        public int CompareTo(Object obj)
        {
            VisualTransaction otherTransaction = obj as VisualTransaction;

            int result = StartTime.CompareTo(otherTransaction.StartTime);

            if (result != 0)
            {
                return(result);
            }
            else
            {
                return(index.CompareTo(otherTransaction.index));
            }
        }
コード例 #4
0
ファイル: VisualSession.cs プロジェクト: SayHalou/ospy
        public override VisualTransaction[] GetTransactions(IPSession session)
        {
            List<VisualTransaction> transactions = new List<VisualTransaction>();

            session.ResetState();

            PacketStream stream1 = session.GetNextStreamDirection();
            PacketStream stream2 = session.GetNextStreamDirection();

            List<IPPacket> packets = new List<IPPacket>(stream1.Packets.Count + stream2.Packets.Count);
            packets.AddRange(stream1.Packets);
            packets.AddRange(stream2.Packets);
            packets.Sort();

            VisualTransaction transaction = null;
            MemoryStream previewData = new MemoryStream();
            int transferred = 0;

            foreach (IPPacket packet in packets)
            {
                if (transaction == null || (transaction != null && packet.Direction != transaction.Direction))
                {
                    if (transaction != null)
                    {
                        transaction.AddHeaderField("Size", transferred);

                        byte[] bytes = previewData.ToArray();
                        transaction.SetBodyFromPreviewData(bytes, bytes.Length);
                    }

                    transaction = new VisualTransaction(packet.Index, packet.Direction, packet.Timestamp);
                    transaction.AddHeaderField("Direction", packet.Direction);
                    transaction.HeaderRowsPerCol = 1;
                    transactions.Add(transaction);
                    previewData.SetLength(0);
                    transferred = 0;
                }

                transaction.EndTime = packet.Timestamp;

                previewData.Write(packet.Bytes, 0, packet.Bytes.Length);

                transferred += packet.Bytes.Length;
            }

            if (transaction != null)
            {
                transaction.AddHeaderField("Size", transferred);

                byte[] bytes = previewData.ToArray();
                transaction.SetBodyFromTruncatedPreviewData(bytes, transferred - bytes.Length);
            }

            return transactions.ToArray();
        }
コード例 #5
0
ファイル: VisualSession.cs プロジェクト: SayHalou/ospy
        public override VisualTransaction[] GetTransactions(IPSession session)
        {
            List<VisualTransaction> transactions = new List<VisualTransaction>(session.Events.Count);

            foreach (TCPEvent ev in session.Events)
            {
                VisualTransaction transaction = new VisualTransaction(0, ev.Timestamp);
                transaction.HeadlineText = ev.ToString();
                transactions.Add(transaction);
            }

            return transactions.ToArray();
        }
コード例 #6
0
ファイル: ConversationsForm.cs プロジェクト: SayHalou/ospy
 private void multiStreamView_TransactionDoubleClick(VisualTransaction transaction)
 {
     propertyGrid.SelectedObject = transaction;
     splitContainer.Panel2Collapsed = false;
 }
コード例 #7
0
ファイル: MultiSessionView.cs プロジェクト: wyrover/ospy
        public void UpdateLayout()
        {
            int x = ColumnsStartPos;

            ruler.Clear();

            // First off, create a flat list of all transactions in all sessions,
            // and make a lookup table for each transaction's column index
            List <VisualTransaction>            transactions          = new List <VisualTransaction>();
            Dictionary <VisualTransaction, int> transactionToColIndex = new Dictionary <VisualTransaction, int>();

            int colIndex = 0;

            foreach (VisualSession session in msv.Sessions)
            {
                foreach (VisualTransaction transaction in session.Transactions)
                {
                    transactions.Add(transaction);
                    transactionToColIndex.Add(transaction, colIndex);
                }

                colIndex++;
            }

            // Sort the transactions by StartTime
            transactions.Sort();

            int y = 0;

            // Now it's time to rock 'n roll!
            while (transactions.Count > 0)
            {
                // Find all transactions with the same time and the height of the highest one of them
                List <VisualTransaction> sameTime = new List <VisualTransaction>(1);
                DateTime curTime = transactions[0].StartTime;
                int      highest = 0;

                for (int i = 0; i < transactions.Count; i++)
                {
                    VisualTransaction curTransaction = transactions[i];

                    if (sameTime.Count > 0)
                    {
                        if (curTransaction.StartTime != curTime)
                        {
                            break;
                        }
                    }

                    sameTime.Add(curTransaction);
                    if (curTransaction.Height > highest)
                    {
                        highest = curTransaction.Height;
                    }
                }

                // Remove them from the list
                transactions.RemoveRange(0, sameTime.Count);

                Dictionary <int, int> columnOffsets = new Dictionary <int, int>();

                // Lay them out
                foreach (VisualTransaction transaction in sameTime)
                {
                    colIndex = transactionToColIndex[transaction];

                    transaction.Parent = this;
                    transaction.Left   = ColumnsStartPos + (colIndex * (msv.ColumnWidth + msv.ColumnSpacing));

                    int colY = 0;

                    if (columnOffsets.ContainsKey(colIndex))
                    {
                        colY = columnOffsets[colIndex] + 10;
                    }

                    transaction.Top = y + colY;

                    columnOffsets[colIndex] = colY + transaction.Height;
                }

                foreach (int offset in columnOffsets.Values)
                {
                    if (offset > highest)
                    {
                        highest = offset;
                    }
                }

                y += highest + 10;

                ruler.AddMark(sameTime[0].StartTime, highest + 10);
            }

            realWidth  = ruler.Width + (msv.Sessions.Length * (msv.ColumnWidth + msv.ColumnSpacing));
            realHeight = y;

            if (LayoutChanged != null)
            {
                LayoutChanged(this, new EventArgs());
            }
        }
コード例 #8
0
ファイル: ConversationsForm.cs プロジェクト: wyrover/ospy
 private void multiStreamView_TransactionDoubleClick(VisualTransaction transaction)
 {
     propertyGrid.SelectedObject    = transaction;
     splitContainer.Panel2Collapsed = false;
 }