diff --git a/Programs/GridProxy/GridProxy.cs b/Programs/GridProxy/GridProxy.cs index 16d000ce..b782f47b 100644 --- a/Programs/GridProxy/GridProxy.cs +++ b/Programs/GridProxy/GridProxy.cs @@ -198,7 +198,7 @@ namespace GridProxy InitializeCaps(); } - object keepAliveLock = new Object(); + object keepAliveLock = new object(); // Start: begin accepting clients public void Start() @@ -209,9 +209,10 @@ namespace GridProxy (new Thread(new ThreadStart(KeepAlive))).Start(); RunSimProxy(); + Thread runLoginProxy = new Thread(new ThreadStart(RunLoginProxy)); runLoginProxy.IsBackground = true; - runLoginProxy.Name = "LoginProxy"; + runLoginProxy.Name = "Login Proxy"; runLoginProxy.Start(); IPEndPoint endPoint = (IPEndPoint)loginServer.LocalEndPoint; @@ -778,7 +779,7 @@ namespace GridProxy } } - if (cap != null && !requestFailed) + if (cap != null && !requestFailed && !capReq.Response.ToString().Equals("undef")) { foreach (CapsDelegate d in cap.GetDelegates()) { @@ -786,9 +787,14 @@ namespace GridProxy { if (d(capReq, CapsStage.Response)) { break; } } - catch (Exception e) + catch (InvalidCastException ex) { - OpenMetaverse.Logger.Log("Error firing delegate", Helpers.LogLevel.Error, e); + OpenMetaverse.Logger.Log("Invalid Cast thrown trying to cast OSD to OSDMap: \n'" + capReq.Response.AsString() + "' Length="+capReq.RawResponse.Length.ToString() + "\n", + Helpers.LogLevel.Error, ex); + } + catch (Exception ex) + { + OpenMetaverse.Logger.Log("Error firing delegate", Helpers.LogLevel.Error, ex); } } @@ -1034,7 +1040,8 @@ namespace GridProxy { foreach (XmlRpcRequestDelegate d in loginRequestDelegates) { - try { d(request); } + try { d(this, new XmlRpcRequestEventArgs(request)); } + //try { d(request); } catch (Exception e) { OpenMetaverse.Logger.Log("Exception in login request delegate" + e, Helpers.LogLevel.Error, e); } } } @@ -1212,6 +1219,7 @@ namespace GridProxy { foreach (SimProxy simProxy in simProxies.Values) simProxy.Reset(); + KnownCaps.Clear(); } @@ -2111,7 +2119,7 @@ namespace GridProxy } // XmlRpcRequestDelegate: specifies a delegate to be called for XML-RPC requests - public delegate void XmlRpcRequestDelegate(XmlRpcRequest request); + public delegate void XmlRpcRequestDelegate(object sender, XmlRpcRequestEventArgs e); // XmlRpcResponseDelegate: specifies a delegate to be called for XML-RPC responses public delegate void XmlRpcResponseDelegate(XmlRpcResponse response); @@ -2138,6 +2146,16 @@ namespace GridProxy Request, Response } + + public class XmlRpcRequestEventArgs : EventArgs + { + public XmlRpcRequest m_Request; + + public XmlRpcRequestEventArgs(XmlRpcRequest request) + { + this.m_Request = request; + } + } } diff --git a/Programs/GridProxy/GridProxyLoader.cs b/Programs/GridProxy/GridProxyLoader.cs index c303559f..be18f1a9 100644 --- a/Programs/GridProxy/GridProxyLoader.cs +++ b/Programs/GridProxy/GridProxyLoader.cs @@ -152,12 +152,12 @@ namespace GridProxy } // LoginRequest: dump a login request to the console - private void LoginRequest(XmlRpcRequest request) + private void LoginRequest(object sender, XmlRpcRequestEventArgs e) { if (logLogin) { Console.WriteLine("==> Login Request"); - Console.WriteLine(request); + Console.WriteLine(e.m_Request); } } diff --git a/Programs/WinGridProxy/AboutBox1.Designer.cs b/Programs/WinGridProxy/AboutBox1.Designer.cs index fb83e9ae..d3a825b9 100644 --- a/Programs/WinGridProxy/AboutBox1.Designer.cs +++ b/Programs/WinGridProxy/AboutBox1.Designer.cs @@ -155,13 +155,14 @@ // richTextBox1 // this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; - this.richTextBox1.Enabled = false; this.richTextBox1.Location = new System.Drawing.Point(140, 153); this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.ReadOnly = true; this.richTextBox1.Size = new System.Drawing.Size(274, 79); this.richTextBox1.TabIndex = 25; this.richTextBox1.Text = "Written by Jim Radford \n\nIcons Courtesy of http://www.famfamfam" + ".com/lab/icons/silk/\n\nHexbox Control \nhttp://sourceforge.net/projects/hexbox/"; + this.richTextBox1.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.richTextBoxDecodedRequest_LinkClicked); // // AboutBox1 // diff --git a/Programs/WinGridProxy/AboutBox1.cs b/Programs/WinGridProxy/AboutBox1.cs index 64e57d73..8b4a44e3 100644 --- a/Programs/WinGridProxy/AboutBox1.cs +++ b/Programs/WinGridProxy/AboutBox1.cs @@ -99,5 +99,10 @@ namespace WinGridProxy } } #endregion + + private void richTextBoxDecodedRequest_LinkClicked(object sender, LinkClickedEventArgs e) + { + System.Diagnostics.Process.Start(e.LinkText); + } } } diff --git a/Programs/WinGridProxy/FormWinGridProxy.Designer.cs b/Programs/WinGridProxy/FormWinGridProxy.Designer.cs index b9df2451..dab57b21 100644 --- a/Programs/WinGridProxy/FormWinGridProxy.Designer.cs +++ b/Programs/WinGridProxy/FormWinGridProxy.Designer.cs @@ -30,19 +30,27 @@ { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormWinGridProxy)); - System.Windows.Forms.ListViewGroup listViewGroup9 = new System.Windows.Forms.ListViewGroup("Login", System.Windows.Forms.HorizontalAlignment.Left); - System.Windows.Forms.ListViewGroup listViewGroup10 = new System.Windows.Forms.ListViewGroup("Packets", System.Windows.Forms.HorizontalAlignment.Left); - System.Windows.Forms.ListViewGroup listViewGroup11 = new System.Windows.Forms.ListViewGroup("Capabilities", System.Windows.Forms.HorizontalAlignment.Left); - System.Windows.Forms.ListViewGroup listViewGroup12 = new System.Windows.Forms.ListViewGroup("EventQueue Messages", System.Windows.Forms.HorizontalAlignment.Left); + System.Windows.Forms.ListViewGroup listViewGroup1 = new System.Windows.Forms.ListViewGroup("Login", System.Windows.Forms.HorizontalAlignment.Left); + System.Windows.Forms.ListViewGroup listViewGroup2 = new System.Windows.Forms.ListViewGroup("Packets", System.Windows.Forms.HorizontalAlignment.Left); + System.Windows.Forms.ListViewGroup listViewGroup3 = new System.Windows.Forms.ListViewGroup("Capabilities", System.Windows.Forms.HorizontalAlignment.Left); + System.Windows.Forms.ListViewGroup listViewGroup4 = new System.Windows.Forms.ListViewGroup("EventQueue Messages", System.Windows.Forms.HorizontalAlignment.Left); this.panelMainWindow = new System.Windows.Forms.Panel(); this.splitContainerSessionsTabs = new System.Windows.Forms.SplitContainer(); + this.panelActionProgress = new System.Windows.Forms.Panel(); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.listViewSessions = new WinGridProxy.ListViewNoFlicker(); + this.columnHeaderCounter = new System.Windows.Forms.ColumnHeader(); + this.columnHeaderProtocol = new System.Windows.Forms.ColumnHeader(); + this.columnHeaderType = new System.Windows.Forms.ColumnHeader(); + this.columnHeaderSize = new System.Windows.Forms.ColumnHeader(); + this.columnHeaderUrl = new System.Windows.Forms.ColumnHeader(); + this.columnHeaderContentType = new System.Windows.Forms.ColumnHeader(); this.contextMenuStripSessions = new System.Windows.Forms.ContextMenuStrip(this.components); this.toolStripMenuSessionsRemove = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStripRemove = new System.Windows.Forms.ContextMenuStrip(this.components); this.toolStripMenuItemRemoveAll = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemRemoveSelected = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemRemoveUnselected = new System.Windows.Forms.ToolStripMenuItem(); - this.removeToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); this.selectToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStripSelect = new System.Windows.Forms.ContextMenuStrip(this.components); this.allToolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem(); @@ -50,6 +58,7 @@ this.noneToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparatorSelectPacketProto = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItemSelectPacketName = new System.Windows.Forms.ToolStripMenuItem(); + this.selectToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparatorFilterPacketByName = new System.Windows.Forms.ToolStripSeparator(); this.enableDisableFilterByNameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator(); @@ -85,17 +94,21 @@ this.label5 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.tabPageFilters = new System.Windows.Forms.TabPage(); + this.splitContainerFilters = new System.Windows.Forms.SplitContainer(); + this.checkBoxCheckAllPackets = new System.Windows.Forms.CheckBox(); + this.grpUDPFilters = new System.Windows.Forms.GroupBox(); + this.listViewPacketFilters = new WinGridProxy.ListViewNoFlicker(); + this.columnHeaderPacketName = new System.Windows.Forms.ColumnHeader(); + this.checkBoxCheckAllMessages = new System.Windows.Forms.CheckBox(); + this.grpCapsFilters = new System.Windows.Forms.GroupBox(); + this.listViewMessageFilters = new WinGridProxy.ListViewNoFlicker(); + this.columnHeaderName = new System.Windows.Forms.ColumnHeader(); this.toolStripFilters = new System.Windows.Forms.ToolStrip(); this.loadFilterSelectionsToolStripMenuItem = new System.Windows.Forms.ToolStripButton(); this.saveFilterSelectionsToolStripMenuItem = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSplitButton1 = new System.Windows.Forms.ToolStripSplitButton(); this.autoAddNewDiscoveredMessagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.splitContainerFilters = new System.Windows.Forms.SplitContainer(); - this.checkBoxCheckAllPackets = new System.Windows.Forms.CheckBox(); - this.grpUDPFilters = new System.Windows.Forms.GroupBox(); - this.checkBoxCheckAllMessages = new System.Windows.Forms.CheckBox(); - this.grpCapsFilters = new System.Windows.Forms.GroupBox(); this.tabPageInspect = new System.Windows.Forms.TabPage(); this.splitContainerInspectorTab = new System.Windows.Forms.SplitContainer(); this.tabControlInspectorRequest = new System.Windows.Forms.TabControl(); @@ -125,9 +138,10 @@ this.labelHexBoxResponseStatus = new System.Windows.Forms.Label(); this.hexBoxResponse = new Be.Windows.Forms.HexBox(); this.tabPageInject = new System.Windows.Forms.TabPage(); - this.buttonInjectPacket = new System.Windows.Forms.Button(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.toolStripButtonInject = new System.Windows.Forms.ToolStripButton(); this.richTextBoxInject = new System.Windows.Forms.RichTextBox(); - this.selectToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.removeToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripLabelHexEditorRequest = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripMenu = new System.Windows.Forms.ToolStrip(); @@ -159,6 +173,8 @@ this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); this.findToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripDropDownButton4 = new System.Windows.Forms.ToolStripDropDownButton(); + this.documentationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutWinGridProxyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.timer1 = new System.Windows.Forms.Timer(this.components); @@ -205,6 +221,9 @@ this.autoColorizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.colorDialog1 = new System.Windows.Forms.ColorDialog(); this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripLowerStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripLogin = new System.Windows.Forms.ToolStrip(); this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); this.comboBoxListenAddress = new System.Windows.Forms.ToolStripComboBox(); @@ -213,22 +232,16 @@ this.toolStripLabel3 = new System.Windows.Forms.ToolStripLabel(); this.comboBoxLoginURL = new System.Windows.Forms.ToolStripComboBox(); this.buttonStartProxy = new System.Windows.Forms.ToolStripButton(); + this.toolStripQuickLaunch = new System.Windows.Forms.ToolStrip(); + this.toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox(); + this.buttonLaunchViewer = new System.Windows.Forms.ToolStripButton(); this.saveFileDialog3 = new System.Windows.Forms.SaveFileDialog(); - this.listViewSessions = new WinGridProxy.ListViewNoFlicker(); - this.columnHeaderCounter = new System.Windows.Forms.ColumnHeader(); - this.columnHeaderProtocol = new System.Windows.Forms.ColumnHeader(); - this.columnHeaderType = new System.Windows.Forms.ColumnHeader(); - this.columnHeaderSize = new System.Windows.Forms.ColumnHeader(); - this.columnHeaderUrl = new System.Windows.Forms.ColumnHeader(); - this.columnHeaderContentType = new System.Windows.Forms.ColumnHeader(); - this.listViewPacketFilters = new WinGridProxy.ListViewNoFlicker(); - this.columnHeaderPacketName = new System.Windows.Forms.ColumnHeader(); - this.listViewMessageFilters = new WinGridProxy.ListViewNoFlicker(); - this.columnHeaderName = new System.Windows.Forms.ColumnHeader(); + this.timerCleanupCache = new System.Windows.Forms.Timer(this.components); this.panelMainWindow.SuspendLayout(); this.splitContainerSessionsTabs.Panel1.SuspendLayout(); this.splitContainerSessionsTabs.Panel2.SuspendLayout(); this.splitContainerSessionsTabs.SuspendLayout(); + this.panelActionProgress.SuspendLayout(); this.contextMenuStripSessions.SuspendLayout(); this.contextMenuStripRemove.SuspendLayout(); this.contextMenuStripSelect.SuspendLayout(); @@ -239,12 +252,12 @@ this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); this.tabPageFilters.SuspendLayout(); - this.toolStripFilters.SuspendLayout(); this.splitContainerFilters.Panel1.SuspendLayout(); this.splitContainerFilters.Panel2.SuspendLayout(); this.splitContainerFilters.SuspendLayout(); this.grpUDPFilters.SuspendLayout(); this.grpCapsFilters.SuspendLayout(); + this.toolStripFilters.SuspendLayout(); this.tabPageInspect.SuspendLayout(); this.splitContainerInspectorTab.Panel1.SuspendLayout(); this.splitContainerInspectorTab.Panel2.SuspendLayout(); @@ -262,13 +275,17 @@ this.tabPageResponseJson.SuspendLayout(); this.tabPageHexViewResponse.SuspendLayout(); this.tabPageInject.SuspendLayout(); + this.toolStrip1.SuspendLayout(); this.toolStripMenu.SuspendLayout(); this.contextMenuStripCopy.SuspendLayout(); this.contextMenuStripFilterOptions.SuspendLayout(); + this.toolStripContainer1.BottomToolStripPanel.SuspendLayout(); this.toolStripContainer1.ContentPanel.SuspendLayout(); this.toolStripContainer1.TopToolStripPanel.SuspendLayout(); this.toolStripContainer1.SuspendLayout(); + this.statusStrip1.SuspendLayout(); this.toolStripLogin.SuspendLayout(); + this.toolStripQuickLaunch.SuspendLayout(); this.SuspendLayout(); // // panelMainWindow @@ -277,7 +294,7 @@ this.panelMainWindow.Dock = System.Windows.Forms.DockStyle.Fill; this.panelMainWindow.Location = new System.Drawing.Point(0, 0); this.panelMainWindow.Name = "panelMainWindow"; - this.panelMainWindow.Size = new System.Drawing.Size(1111, 494); + this.panelMainWindow.Size = new System.Drawing.Size(1111, 467); this.panelMainWindow.TabIndex = 1; // // splitContainerSessionsTabs @@ -289,16 +306,102 @@ // // splitContainerSessionsTabs.Panel1 // + this.splitContainerSessionsTabs.Panel1.Controls.Add(this.panelActionProgress); this.splitContainerSessionsTabs.Panel1.Controls.Add(this.listViewSessions); // // splitContainerSessionsTabs.Panel2 // this.splitContainerSessionsTabs.Panel2.Controls.Add(this.tabControlMain); - this.splitContainerSessionsTabs.Size = new System.Drawing.Size(1111, 494); + this.splitContainerSessionsTabs.Size = new System.Drawing.Size(1111, 467); this.splitContainerSessionsTabs.SplitterDistance = 479; this.splitContainerSessionsTabs.SplitterWidth = 5; this.splitContainerSessionsTabs.TabIndex = 0; // + // panelActionProgress + // + this.panelActionProgress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panelActionProgress.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panelActionProgress.Controls.Add(this.progressBar1); + this.panelActionProgress.Location = new System.Drawing.Point(117, 224); + this.panelActionProgress.Name = "panelActionProgress"; + this.panelActionProgress.Size = new System.Drawing.Size(244, 18); + this.panelActionProgress.TabIndex = 4; + this.panelActionProgress.Visible = false; + // + // progressBar1 + // + this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.progressBar1.Location = new System.Drawing.Point(0, 0); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(242, 16); + this.progressBar1.TabIndex = 0; + // + // listViewSessions + // + this.listViewSessions.Activation = System.Windows.Forms.ItemActivation.OneClick; + this.listViewSessions.AllowColumnReorder = true; + this.listViewSessions.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.listViewSessions.CheckBoxes = true; + this.listViewSessions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderCounter, + this.columnHeaderProtocol, + this.columnHeaderType, + this.columnHeaderSize, + this.columnHeaderUrl, + this.columnHeaderContentType}); + this.listViewSessions.ContextMenuStrip = this.contextMenuStripSessions; + this.listViewSessions.Dock = System.Windows.Forms.DockStyle.Fill; + this.listViewSessions.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listViewSessions.FullRowSelect = true; + this.listViewSessions.GridLines = true; + this.listViewSessions.Location = new System.Drawing.Point(0, 0); + this.listViewSessions.Name = "listViewSessions"; + this.listViewSessions.ShowItemToolTips = true; + this.listViewSessions.Size = new System.Drawing.Size(479, 467); + this.listViewSessions.SmallImageList = this.imageList1; + this.listViewSessions.TabIndex = 0; + this.listViewSessions.UseCompatibleStateImageBehavior = false; + this.listViewSessions.View = System.Windows.Forms.View.Details; + this.listViewSessions.VirtualMode = true; + this.listViewSessions.Scrolling += new System.EventHandler(this.listViewSessions_Scrolling); + this.listViewSessions.VirtualItemsSelectionRangeChanged += new System.Windows.Forms.ListViewVirtualItemsSelectionRangeChangedEventHandler(this.listViewSessions_VirtualItemsSelectionRangeChanged); + this.listViewSessions.SelectedIndexChanged += new System.EventHandler(this.listViewSessions_SelectedIndexChanged); + this.listViewSessions.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewSessions_ColumnClick); + this.listViewSessions.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.listViewSessions_RetrieveVirtualItem); + this.listViewSessions.CacheVirtualItems += new System.Windows.Forms.CacheVirtualItemsEventHandler(this.listViewSessions_CacheVirtualItems); + // + // columnHeaderCounter + // + this.columnHeaderCounter.Text = "#"; + this.columnHeaderCounter.Width = 50; + // + // columnHeaderProtocol + // + this.columnHeaderProtocol.Text = "Protocol"; + // + // columnHeaderType + // + this.columnHeaderType.Text = "Name"; + this.columnHeaderType.Width = 151; + // + // columnHeaderSize + // + this.columnHeaderSize.Text = "Bytes"; + this.columnHeaderSize.Width = 42; + // + // columnHeaderUrl + // + this.columnHeaderUrl.Text = "Host"; + this.columnHeaderUrl.Width = 150; + // + // columnHeaderContentType + // + this.columnHeaderContentType.Text = "Content Type"; + this.columnHeaderContentType.Width = 250; + // // contextMenuStripSessions // this.contextMenuStripSessions.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -353,13 +456,6 @@ this.toolStripMenuItemRemoveUnselected.Text = "Unselected"; this.toolStripMenuItemRemoveUnselected.Click += new System.EventHandler(this.sessionRemoveUnselected_Click); // - // removeToolStripMenuItem2 - // - this.removeToolStripMenuItem2.DropDown = this.contextMenuStripRemove; - this.removeToolStripMenuItem2.Name = "removeToolStripMenuItem2"; - this.removeToolStripMenuItem2.Size = new System.Drawing.Size(152, 22); - this.removeToolStripMenuItem2.Text = "Remove"; - // // selectToolStripMenuItem2 // this.selectToolStripMenuItem2.DropDown = this.contextMenuStripSelect; @@ -413,6 +509,13 @@ this.toolStripMenuItemSelectPacketName.Text = "All (Packet Type)"; this.toolStripMenuItemSelectPacketName.Click += new System.EventHandler(this.sessionSelectAllPacketType_Click); // + // selectToolStripMenuItem1 + // + this.selectToolStripMenuItem1.DropDown = this.contextMenuStripSelect; + this.selectToolStripMenuItem1.Name = "selectToolStripMenuItem1"; + this.selectToolStripMenuItem1.Size = new System.Drawing.Size(137, 22); + this.selectToolStripMenuItem1.Text = "Select"; + // // toolStripSeparatorFilterPacketByName // this.toolStripSeparatorFilterPacketByName.Name = "toolStripSeparatorFilterPacketByName"; @@ -451,7 +554,7 @@ this.toolStripSeparator17, this.unmarkToolStripMenuItem}); this.contextMenuStripMark.Name = "contextMenuStripMarkDropdown"; - this.contextMenuStripMark.OwnerItem = this.markToolStripMenuItem1; + this.contextMenuStripMark.OwnerItem = this.markToolStripMenuItem2; this.contextMenuStripMark.Size = new System.Drawing.Size(117, 142); // // redToolStripMenuItem2 @@ -505,7 +608,7 @@ // this.markToolStripMenuItem1.DropDown = this.contextMenuStripMark; this.markToolStripMenuItem1.Name = "markToolStripMenuItem1"; - this.markToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); + this.markToolStripMenuItem1.Size = new System.Drawing.Size(137, 22); this.markToolStripMenuItem1.Text = "Mark"; // // toolStripSeparator16 @@ -542,7 +645,7 @@ this.tabControlMain.Name = "tabControlMain"; this.tabControlMain.Padding = new System.Drawing.Point(10, 6); this.tabControlMain.SelectedIndex = 0; - this.tabControlMain.Size = new System.Drawing.Size(627, 494); + this.tabControlMain.Size = new System.Drawing.Size(627, 467); this.tabControlMain.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; this.tabControlMain.TabIndex = 0; // @@ -554,7 +657,7 @@ this.tabPageSummary.Location = new System.Drawing.Point(4, 30); this.tabPageSummary.Name = "tabPageSummary"; this.tabPageSummary.Padding = new System.Windows.Forms.Padding(3); - this.tabPageSummary.Size = new System.Drawing.Size(619, 460); + this.tabPageSummary.Size = new System.Drawing.Size(619, 433); this.tabPageSummary.TabIndex = 0; this.tabPageSummary.Text = "Summary"; this.tabPageSummary.UseVisualStyleBackColor = true; @@ -571,7 +674,7 @@ this.richTextBoxDebugLog.Name = "richTextBoxDebugLog"; this.richTextBoxDebugLog.ReadOnly = true; this.richTextBoxDebugLog.ShowSelectionMargin = true; - this.richTextBoxDebugLog.Size = new System.Drawing.Size(606, 352); + this.richTextBoxDebugLog.Size = new System.Drawing.Size(606, 324); this.richTextBoxDebugLog.TabIndex = 3; this.richTextBoxDebugLog.Text = ""; this.richTextBoxDebugLog.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.richTextBoxDecodedRequest_LinkClicked); @@ -600,7 +703,7 @@ this.groupBox2.Controls.Add(this.label8); this.groupBox2.Location = new System.Drawing.Point(6, 3); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(221, 80); + this.groupBox2.Size = new System.Drawing.Size(280, 80); this.groupBox2.TabIndex = 3; this.groupBox2.TabStop = false; this.groupBox2.Text = "UDP Packets"; @@ -608,7 +711,7 @@ // labelPacketsTotal // this.labelPacketsTotal.AutoSize = true; - this.labelPacketsTotal.Location = new System.Drawing.Point(81, 58); + this.labelPacketsTotal.Location = new System.Drawing.Point(94, 58); this.labelPacketsTotal.Name = "labelPacketsTotal"; this.labelPacketsTotal.Size = new System.Drawing.Size(64, 15); this.labelPacketsTotal.TabIndex = 8; @@ -617,7 +720,7 @@ // label1PacketsOut // this.label1PacketsOut.AutoSize = true; - this.label1PacketsOut.Location = new System.Drawing.Point(81, 37); + this.label1PacketsOut.Location = new System.Drawing.Point(94, 37); this.label1PacketsOut.Name = "label1PacketsOut"; this.label1PacketsOut.Size = new System.Drawing.Size(64, 15); this.label1PacketsOut.TabIndex = 7; @@ -626,7 +729,7 @@ // labelPacketsIn // this.labelPacketsIn.AutoSize = true; - this.labelPacketsIn.Location = new System.Drawing.Point(81, 16); + this.labelPacketsIn.Location = new System.Drawing.Point(94, 16); this.labelPacketsIn.Name = "labelPacketsIn"; this.labelPacketsIn.Size = new System.Drawing.Size(64, 15); this.labelPacketsIn.TabIndex = 6; @@ -668,9 +771,9 @@ this.groupBox1.Controls.Add(this.label6); this.groupBox1.Controls.Add(this.label5); this.groupBox1.Controls.Add(this.label7); - this.groupBox1.Location = new System.Drawing.Point(382, 3); + this.groupBox1.Location = new System.Drawing.Point(323, 3); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(221, 80); + this.groupBox1.Size = new System.Drawing.Size(280, 80); this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; this.groupBox1.Text = "Caps Messages"; @@ -731,16 +834,158 @@ // // tabPageFilters // - this.tabPageFilters.Controls.Add(this.toolStripFilters); this.tabPageFilters.Controls.Add(this.splitContainerFilters); + this.tabPageFilters.Controls.Add(this.toolStripFilters); this.tabPageFilters.Location = new System.Drawing.Point(4, 30); this.tabPageFilters.Name = "tabPageFilters"; this.tabPageFilters.Padding = new System.Windows.Forms.Padding(3); - this.tabPageFilters.Size = new System.Drawing.Size(619, 460); + this.tabPageFilters.Size = new System.Drawing.Size(619, 433); this.tabPageFilters.TabIndex = 1; this.tabPageFilters.Text = "Filters"; this.tabPageFilters.UseVisualStyleBackColor = true; // + // splitContainerFilters + // + this.splitContainerFilters.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainerFilters.Location = new System.Drawing.Point(3, 28); + this.splitContainerFilters.Name = "splitContainerFilters"; + // + // splitContainerFilters.Panel1 + // + this.splitContainerFilters.Panel1.Controls.Add(this.checkBoxCheckAllPackets); + this.splitContainerFilters.Panel1.Controls.Add(this.grpUDPFilters); + // + // splitContainerFilters.Panel2 + // + this.splitContainerFilters.Panel2.Controls.Add(this.checkBoxCheckAllMessages); + this.splitContainerFilters.Panel2.Controls.Add(this.grpCapsFilters); + this.splitContainerFilters.Size = new System.Drawing.Size(613, 402); + this.splitContainerFilters.SplitterDistance = 303; + this.splitContainerFilters.SplitterWidth = 5; + this.splitContainerFilters.TabIndex = 0; + // + // checkBoxCheckAllPackets + // + this.checkBoxCheckAllPackets.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.checkBoxCheckAllPackets.AutoSize = true; + this.checkBoxCheckAllPackets.Checked = true; + this.checkBoxCheckAllPackets.CheckState = System.Windows.Forms.CheckState.Indeterminate; + this.checkBoxCheckAllPackets.Location = new System.Drawing.Point(3, 378); + this.checkBoxCheckAllPackets.Name = "checkBoxCheckAllPackets"; + this.checkBoxCheckAllPackets.Size = new System.Drawing.Size(128, 19); + this.checkBoxCheckAllPackets.TabIndex = 1; + this.checkBoxCheckAllPackets.Text = "Check/Uncheck All"; + this.checkBoxCheckAllPackets.UseVisualStyleBackColor = true; + this.checkBoxCheckAllPackets.CheckedChanged += new System.EventHandler(this.checkBoxCheckAllPackets_CheckedChanged); + // + // grpUDPFilters + // + this.grpUDPFilters.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.grpUDPFilters.Controls.Add(this.listViewPacketFilters); + this.grpUDPFilters.Enabled = false; + this.grpUDPFilters.Location = new System.Drawing.Point(3, 3); + this.grpUDPFilters.Name = "grpUDPFilters"; + this.grpUDPFilters.Size = new System.Drawing.Size(297, 369); + this.grpUDPFilters.TabIndex = 0; + this.grpUDPFilters.TabStop = false; + this.grpUDPFilters.Text = "UDP Packets && Login"; + // + // listViewPacketFilters + // + this.listViewPacketFilters.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listViewPacketFilters.CheckBoxes = true; + this.listViewPacketFilters.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderPacketName}); + this.listViewPacketFilters.Dock = System.Windows.Forms.DockStyle.Fill; + this.listViewPacketFilters.FullRowSelect = true; + this.listViewPacketFilters.GridLines = true; + listViewGroup1.Header = "Login"; + listViewGroup1.Name = "Login"; + listViewGroup2.Header = "Packets"; + listViewGroup2.Name = "Packets"; + this.listViewPacketFilters.Groups.AddRange(new System.Windows.Forms.ListViewGroup[] { + listViewGroup1, + listViewGroup2}); + this.listViewPacketFilters.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.listViewPacketFilters.Location = new System.Drawing.Point(3, 17); + this.listViewPacketFilters.MultiSelect = false; + this.listViewPacketFilters.Name = "listViewPacketFilters"; + this.listViewPacketFilters.Size = new System.Drawing.Size(291, 349); + this.listViewPacketFilters.Sorting = System.Windows.Forms.SortOrder.Ascending; + this.listViewPacketFilters.TabIndex = 0; + this.listViewPacketFilters.UseCompatibleStateImageBehavior = false; + this.listViewPacketFilters.View = System.Windows.Forms.View.Details; + this.listViewPacketFilters.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listViewPacketFilters_ItemChecked); + this.listViewPacketFilters.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewFilterSorter_ColumnClick); + // + // columnHeaderPacketName + // + this.columnHeaderPacketName.Text = "Name"; + this.columnHeaderPacketName.Width = 287; + // + // checkBoxCheckAllMessages + // + this.checkBoxCheckAllMessages.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.checkBoxCheckAllMessages.AutoSize = true; + this.checkBoxCheckAllMessages.Checked = true; + this.checkBoxCheckAllMessages.CheckState = System.Windows.Forms.CheckState.Indeterminate; + this.checkBoxCheckAllMessages.Location = new System.Drawing.Point(6, 378); + this.checkBoxCheckAllMessages.Name = "checkBoxCheckAllMessages"; + this.checkBoxCheckAllMessages.Size = new System.Drawing.Size(128, 19); + this.checkBoxCheckAllMessages.TabIndex = 2; + this.checkBoxCheckAllMessages.Text = "Check/Uncheck All"; + this.checkBoxCheckAllMessages.UseVisualStyleBackColor = true; + this.checkBoxCheckAllMessages.CheckedChanged += new System.EventHandler(this.checkBoxCheckallCaps_CheckedChanged); + // + // grpCapsFilters + // + this.grpCapsFilters.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.grpCapsFilters.Controls.Add(this.listViewMessageFilters); + this.grpCapsFilters.Enabled = false; + this.grpCapsFilters.Location = new System.Drawing.Point(3, 3); + this.grpCapsFilters.Name = "grpCapsFilters"; + this.grpCapsFilters.Size = new System.Drawing.Size(299, 366); + this.grpCapsFilters.TabIndex = 1; + this.grpCapsFilters.TabStop = false; + this.grpCapsFilters.Text = "Capabilities && EventQueue messages"; + // + // listViewMessageFilters + // + this.listViewMessageFilters.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listViewMessageFilters.CheckBoxes = true; + this.listViewMessageFilters.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderName}); + this.listViewMessageFilters.Dock = System.Windows.Forms.DockStyle.Fill; + this.listViewMessageFilters.FullRowSelect = true; + this.listViewMessageFilters.GridLines = true; + listViewGroup3.Header = "Capabilities"; + listViewGroup3.Name = "Capabilities"; + listViewGroup4.Header = "EventQueue Messages"; + listViewGroup4.Name = "EventQueueMessages"; + this.listViewMessageFilters.Groups.AddRange(new System.Windows.Forms.ListViewGroup[] { + listViewGroup3, + listViewGroup4}); + this.listViewMessageFilters.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.listViewMessageFilters.Location = new System.Drawing.Point(3, 17); + this.listViewMessageFilters.MultiSelect = false; + this.listViewMessageFilters.Name = "listViewMessageFilters"; + this.listViewMessageFilters.Size = new System.Drawing.Size(293, 346); + this.listViewMessageFilters.Sorting = System.Windows.Forms.SortOrder.Ascending; + this.listViewMessageFilters.TabIndex = 1; + this.listViewMessageFilters.UseCompatibleStateImageBehavior = false; + this.listViewMessageFilters.View = System.Windows.Forms.View.Details; + this.listViewMessageFilters.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listViewMessageFilters_ItemChecked); + this.listViewMessageFilters.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewFilterSorter_ColumnClick); + // + // columnHeaderName + // + this.columnHeaderName.Text = "Name"; + this.columnHeaderName.Width = 289; + // // toolStripFilters // this.toolStripFilters.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; @@ -801,90 +1046,12 @@ this.autoAddNewDiscoveredMessagesToolStripMenuItem.Size = new System.Drawing.Size(225, 22); this.autoAddNewDiscoveredMessagesToolStripMenuItem.Text = "Auto Check new Capabilities"; // - // splitContainerFilters - // - this.splitContainerFilters.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.splitContainerFilters.Location = new System.Drawing.Point(3, 31); - this.splitContainerFilters.Name = "splitContainerFilters"; - // - // splitContainerFilters.Panel1 - // - this.splitContainerFilters.Panel1.Controls.Add(this.checkBoxCheckAllPackets); - this.splitContainerFilters.Panel1.Controls.Add(this.grpUDPFilters); - // - // splitContainerFilters.Panel2 - // - this.splitContainerFilters.Panel2.Controls.Add(this.checkBoxCheckAllMessages); - this.splitContainerFilters.Panel2.Controls.Add(this.grpCapsFilters); - this.splitContainerFilters.Size = new System.Drawing.Size(613, 427); - this.splitContainerFilters.SplitterDistance = 303; - this.splitContainerFilters.SplitterWidth = 5; - this.splitContainerFilters.TabIndex = 0; - // - // checkBoxCheckAllPackets - // - this.checkBoxCheckAllPackets.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.checkBoxCheckAllPackets.AutoSize = true; - this.checkBoxCheckAllPackets.Checked = true; - this.checkBoxCheckAllPackets.CheckState = System.Windows.Forms.CheckState.Indeterminate; - this.checkBoxCheckAllPackets.Location = new System.Drawing.Point(6, 404); - this.checkBoxCheckAllPackets.Name = "checkBoxCheckAllPackets"; - this.checkBoxCheckAllPackets.Size = new System.Drawing.Size(128, 19); - this.checkBoxCheckAllPackets.TabIndex = 1; - this.checkBoxCheckAllPackets.Text = "Check/Uncheck All"; - this.checkBoxCheckAllPackets.UseVisualStyleBackColor = true; - this.checkBoxCheckAllPackets.CheckedChanged += new System.EventHandler(this.checkBoxCheckAllPackets_CheckedChanged); - // - // grpUDPFilters - // - this.grpUDPFilters.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.grpUDPFilters.Controls.Add(this.listViewPacketFilters); - this.grpUDPFilters.Enabled = false; - this.grpUDPFilters.Location = new System.Drawing.Point(3, 3); - this.grpUDPFilters.Name = "grpUDPFilters"; - this.grpUDPFilters.Size = new System.Drawing.Size(297, 394); - this.grpUDPFilters.TabIndex = 0; - this.grpUDPFilters.TabStop = false; - this.grpUDPFilters.Text = "UDP Packets && Login"; - // - // checkBoxCheckAllMessages - // - this.checkBoxCheckAllMessages.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.checkBoxCheckAllMessages.AutoSize = true; - this.checkBoxCheckAllMessages.Checked = true; - this.checkBoxCheckAllMessages.CheckState = System.Windows.Forms.CheckState.Indeterminate; - this.checkBoxCheckAllMessages.Location = new System.Drawing.Point(6, 405); - this.checkBoxCheckAllMessages.Name = "checkBoxCheckAllMessages"; - this.checkBoxCheckAllMessages.Size = new System.Drawing.Size(128, 19); - this.checkBoxCheckAllMessages.TabIndex = 2; - this.checkBoxCheckAllMessages.Text = "Check/Uncheck All"; - this.checkBoxCheckAllMessages.UseVisualStyleBackColor = true; - this.checkBoxCheckAllMessages.CheckedChanged += new System.EventHandler(this.checkBoxCheckallCaps_CheckedChanged); - // - // grpCapsFilters - // - this.grpCapsFilters.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.grpCapsFilters.Controls.Add(this.listViewMessageFilters); - this.grpCapsFilters.Enabled = false; - this.grpCapsFilters.Location = new System.Drawing.Point(3, 3); - this.grpCapsFilters.Name = "grpCapsFilters"; - this.grpCapsFilters.Size = new System.Drawing.Size(299, 394); - this.grpCapsFilters.TabIndex = 1; - this.grpCapsFilters.TabStop = false; - this.grpCapsFilters.Text = "Capabilities && EventQueue messages"; - // // tabPageInspect // this.tabPageInspect.Controls.Add(this.splitContainerInspectorTab); this.tabPageInspect.Location = new System.Drawing.Point(4, 30); this.tabPageInspect.Name = "tabPageInspect"; - this.tabPageInspect.Size = new System.Drawing.Size(619, 460); + this.tabPageInspect.Size = new System.Drawing.Size(619, 433); this.tabPageInspect.TabIndex = 3; this.tabPageInspect.Text = "Inspector"; this.tabPageInspect.UseVisualStyleBackColor = true; @@ -906,8 +1073,8 @@ // splitContainerInspectorTab.Panel2 // this.splitContainerInspectorTab.Panel2.Controls.Add(this.tabControlInspectorResponse); - this.splitContainerInspectorTab.Size = new System.Drawing.Size(619, 460); - this.splitContainerInspectorTab.SplitterDistance = 226; + this.splitContainerInspectorTab.Size = new System.Drawing.Size(619, 433); + this.splitContainerInspectorTab.SplitterDistance = 204; this.splitContainerInspectorTab.SplitterWidth = 6; this.splitContainerInspectorTab.TabIndex = 1; // @@ -924,7 +1091,7 @@ this.tabControlInspectorRequest.Location = new System.Drawing.Point(0, 0); this.tabControlInspectorRequest.Name = "tabControlInspectorRequest"; this.tabControlInspectorRequest.SelectedIndex = 0; - this.tabControlInspectorRequest.Size = new System.Drawing.Size(619, 226); + this.tabControlInspectorRequest.Size = new System.Drawing.Size(619, 204); this.tabControlInspectorRequest.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; this.tabControlInspectorRequest.TabIndex = 0; // @@ -935,7 +1102,7 @@ this.tabPageDecodedRequest.Location = new System.Drawing.Point(4, 24); this.tabPageDecodedRequest.Name = "tabPageDecodedRequest"; this.tabPageDecodedRequest.Padding = new System.Windows.Forms.Padding(3); - this.tabPageDecodedRequest.Size = new System.Drawing.Size(611, 198); + this.tabPageDecodedRequest.Size = new System.Drawing.Size(611, 176); this.tabPageDecodedRequest.TabIndex = 4; this.tabPageDecodedRequest.Text = "Request"; this.tabPageDecodedRequest.UseVisualStyleBackColor = true; @@ -948,7 +1115,7 @@ this.richTextBoxDecodedRequest.Location = new System.Drawing.Point(3, 3); this.richTextBoxDecodedRequest.Name = "richTextBoxDecodedRequest"; this.richTextBoxDecodedRequest.ShowSelectionMargin = true; - this.richTextBoxDecodedRequest.Size = new System.Drawing.Size(605, 192); + this.richTextBoxDecodedRequest.Size = new System.Drawing.Size(605, 170); this.richTextBoxDecodedRequest.TabIndex = 0; this.richTextBoxDecodedRequest.Text = ""; this.richTextBoxDecodedRequest.WordWrap = false; @@ -962,7 +1129,7 @@ this.tabPageRawRequest.Location = new System.Drawing.Point(4, 24); this.tabPageRawRequest.Name = "tabPageRawRequest"; this.tabPageRawRequest.Padding = new System.Windows.Forms.Padding(3); - this.tabPageRawRequest.Size = new System.Drawing.Size(611, 198); + this.tabPageRawRequest.Size = new System.Drawing.Size(611, 176); this.tabPageRawRequest.TabIndex = 0; this.tabPageRawRequest.Text = "Raw"; this.tabPageRawRequest.UseVisualStyleBackColor = true; @@ -976,7 +1143,7 @@ this.richTextBoxRawRequest.Location = new System.Drawing.Point(3, 3); this.richTextBoxRawRequest.Name = "richTextBoxRawRequest"; this.richTextBoxRawRequest.ShowSelectionMargin = true; - this.richTextBoxRawRequest.Size = new System.Drawing.Size(605, 193); + this.richTextBoxRawRequest.Size = new System.Drawing.Size(605, 170); this.richTextBoxRawRequest.TabIndex = 1; this.richTextBoxRawRequest.Text = ""; this.richTextBoxRawRequest.WordWrap = false; @@ -988,7 +1155,7 @@ this.tabPageXMLRequest.Location = new System.Drawing.Point(4, 24); this.tabPageXMLRequest.Name = "tabPageXMLRequest"; this.tabPageXMLRequest.Padding = new System.Windows.Forms.Padding(3); - this.tabPageXMLRequest.Size = new System.Drawing.Size(611, 198); + this.tabPageXMLRequest.Size = new System.Drawing.Size(611, 176); this.tabPageXMLRequest.TabIndex = 1; this.tabPageXMLRequest.Text = "XML"; this.tabPageXMLRequest.UseVisualStyleBackColor = true; @@ -999,7 +1166,7 @@ this.treeViewXMLRequest.Dock = System.Windows.Forms.DockStyle.Fill; this.treeViewXMLRequest.Location = new System.Drawing.Point(3, 3); this.treeViewXMLRequest.Name = "treeViewXMLRequest"; - this.treeViewXMLRequest.Size = new System.Drawing.Size(605, 193); + this.treeViewXMLRequest.Size = new System.Drawing.Size(605, 170); this.treeViewXMLRequest.TabIndex = 1; // // tabPageRequestJson @@ -1009,7 +1176,7 @@ this.tabPageRequestJson.Location = new System.Drawing.Point(4, 24); this.tabPageRequestJson.Name = "tabPageRequestJson"; this.tabPageRequestJson.Padding = new System.Windows.Forms.Padding(3); - this.tabPageRequestJson.Size = new System.Drawing.Size(611, 198); + this.tabPageRequestJson.Size = new System.Drawing.Size(611, 176); this.tabPageRequestJson.TabIndex = 3; this.tabPageRequestJson.Text = "Notation"; this.tabPageRequestJson.UseVisualStyleBackColor = true; @@ -1022,7 +1189,7 @@ this.richTextBoxNotationRequest.Location = new System.Drawing.Point(3, 3); this.richTextBoxNotationRequest.Name = "richTextBoxNotationRequest"; this.richTextBoxNotationRequest.ShowSelectionMargin = true; - this.richTextBoxNotationRequest.Size = new System.Drawing.Size(605, 193); + this.richTextBoxNotationRequest.Size = new System.Drawing.Size(605, 170); this.richTextBoxNotationRequest.TabIndex = 0; this.richTextBoxNotationRequest.Text = ""; // @@ -1034,7 +1201,7 @@ this.tabPageHexRequest.ImageIndex = 1; this.tabPageHexRequest.Location = new System.Drawing.Point(4, 24); this.tabPageHexRequest.Name = "tabPageHexRequest"; - this.tabPageHexRequest.Size = new System.Drawing.Size(611, 198); + this.tabPageHexRequest.Size = new System.Drawing.Size(611, 176); this.tabPageHexRequest.TabIndex = 2; this.tabPageHexRequest.Text = "Hex"; this.tabPageHexRequest.UseVisualStyleBackColor = true; @@ -1043,7 +1210,7 @@ // this.buttonSaveRequestHex.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonSaveRequestHex.Font = new System.Drawing.Font("Arial", 3.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonSaveRequestHex.Location = new System.Drawing.Point(594, 185); + this.buttonSaveRequestHex.Location = new System.Drawing.Point(594, 160); this.buttonSaveRequestHex.Name = "buttonSaveRequestHex"; this.buttonSaveRequestHex.Size = new System.Drawing.Size(13, 13); this.buttonSaveRequestHex.TabIndex = 4; @@ -1056,7 +1223,7 @@ this.labelHexRequestStatus.AutoSize = true; this.labelHexRequestStatus.Dock = System.Windows.Forms.DockStyle.Bottom; this.labelHexRequestStatus.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.labelHexRequestStatus.Location = new System.Drawing.Point(0, 185); + this.labelHexRequestStatus.Location = new System.Drawing.Point(0, 163); this.labelHexRequestStatus.Name = "labelHexRequestStatus"; this.labelHexRequestStatus.Size = new System.Drawing.Size(66, 13); this.labelHexRequestStatus.TabIndex = 3; @@ -1072,7 +1239,7 @@ this.hexBoxRequest.Location = new System.Drawing.Point(0, 0); this.hexBoxRequest.Name = "hexBoxRequest"; this.hexBoxRequest.ShadowSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(60)))), ((int)(((byte)(188)))), ((int)(((byte)(255))))); - this.hexBoxRequest.Size = new System.Drawing.Size(611, 182); + this.hexBoxRequest.Size = new System.Drawing.Size(611, 154); this.hexBoxRequest.StringViewVisible = true; this.hexBoxRequest.TabIndex = 2; this.hexBoxRequest.UseFixedBytesPerLine = true; @@ -1094,7 +1261,7 @@ this.tabControlInspectorResponse.Multiline = true; this.tabControlInspectorResponse.Name = "tabControlInspectorResponse"; this.tabControlInspectorResponse.SelectedIndex = 0; - this.tabControlInspectorResponse.Size = new System.Drawing.Size(619, 228); + this.tabControlInspectorResponse.Size = new System.Drawing.Size(619, 223); this.tabControlInspectorResponse.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; this.tabControlInspectorResponse.TabIndex = 0; // @@ -1105,7 +1272,7 @@ this.tabPageDecodeResponse.Location = new System.Drawing.Point(4, 24); this.tabPageDecodeResponse.Name = "tabPageDecodeResponse"; this.tabPageDecodeResponse.Padding = new System.Windows.Forms.Padding(3); - this.tabPageDecodeResponse.Size = new System.Drawing.Size(611, 200); + this.tabPageDecodeResponse.Size = new System.Drawing.Size(611, 195); this.tabPageDecodeResponse.TabIndex = 6; this.tabPageDecodeResponse.Text = "Response"; this.tabPageDecodeResponse.UseVisualStyleBackColor = true; @@ -1118,7 +1285,7 @@ this.richTextBoxDecodedResponse.Location = new System.Drawing.Point(3, 3); this.richTextBoxDecodedResponse.Name = "richTextBoxDecodedResponse"; this.richTextBoxDecodedResponse.ShowSelectionMargin = true; - this.richTextBoxDecodedResponse.Size = new System.Drawing.Size(605, 194); + this.richTextBoxDecodedResponse.Size = new System.Drawing.Size(605, 189); this.richTextBoxDecodedResponse.TabIndex = 0; this.richTextBoxDecodedResponse.Text = ""; this.richTextBoxDecodedResponse.WordWrap = false; @@ -1132,7 +1299,7 @@ this.tabPageInspectorRAWResponse.Location = new System.Drawing.Point(4, 24); this.tabPageInspectorRAWResponse.Name = "tabPageInspectorRAWResponse"; this.tabPageInspectorRAWResponse.Padding = new System.Windows.Forms.Padding(3); - this.tabPageInspectorRAWResponse.Size = new System.Drawing.Size(611, 200); + this.tabPageInspectorRAWResponse.Size = new System.Drawing.Size(611, 195); this.tabPageInspectorRAWResponse.TabIndex = 0; this.tabPageInspectorRAWResponse.Text = "Raw"; this.tabPageInspectorRAWResponse.UseVisualStyleBackColor = true; @@ -1146,7 +1313,7 @@ this.richTextBoxRawResponse.Location = new System.Drawing.Point(3, 3); this.richTextBoxRawResponse.Name = "richTextBoxRawResponse"; this.richTextBoxRawResponse.ShowSelectionMargin = true; - this.richTextBoxRawResponse.Size = new System.Drawing.Size(605, 195); + this.richTextBoxRawResponse.Size = new System.Drawing.Size(605, 189); this.richTextBoxRawResponse.TabIndex = 0; this.richTextBoxRawResponse.Text = ""; this.richTextBoxRawResponse.WordWrap = false; @@ -1158,7 +1325,7 @@ this.tabPageInspectorXMLResponse.Location = new System.Drawing.Point(4, 24); this.tabPageInspectorXMLResponse.Name = "tabPageInspectorXMLResponse"; this.tabPageInspectorXMLResponse.Padding = new System.Windows.Forms.Padding(3); - this.tabPageInspectorXMLResponse.Size = new System.Drawing.Size(611, 200); + this.tabPageInspectorXMLResponse.Size = new System.Drawing.Size(611, 195); this.tabPageInspectorXMLResponse.TabIndex = 1; this.tabPageInspectorXMLResponse.Text = "XML"; this.tabPageInspectorXMLResponse.UseVisualStyleBackColor = true; @@ -1169,7 +1336,7 @@ this.treeViewXmlResponse.Dock = System.Windows.Forms.DockStyle.Fill; this.treeViewXmlResponse.Location = new System.Drawing.Point(3, 3); this.treeViewXmlResponse.Name = "treeViewXmlResponse"; - this.treeViewXmlResponse.Size = new System.Drawing.Size(605, 195); + this.treeViewXmlResponse.Size = new System.Drawing.Size(605, 189); this.treeViewXmlResponse.TabIndex = 0; // // tabPageResponseJson @@ -1179,7 +1346,7 @@ this.tabPageResponseJson.Location = new System.Drawing.Point(4, 24); this.tabPageResponseJson.Name = "tabPageResponseJson"; this.tabPageResponseJson.Padding = new System.Windows.Forms.Padding(3); - this.tabPageResponseJson.Size = new System.Drawing.Size(611, 200); + this.tabPageResponseJson.Size = new System.Drawing.Size(611, 195); this.tabPageResponseJson.TabIndex = 5; this.tabPageResponseJson.Text = "Notation"; this.tabPageResponseJson.UseVisualStyleBackColor = true; @@ -1192,7 +1359,7 @@ this.richTextBoxNotationResponse.Location = new System.Drawing.Point(3, 3); this.richTextBoxNotationResponse.Name = "richTextBoxNotationResponse"; this.richTextBoxNotationResponse.ShowSelectionMargin = true; - this.richTextBoxNotationResponse.Size = new System.Drawing.Size(605, 195); + this.richTextBoxNotationResponse.Size = new System.Drawing.Size(605, 189); this.richTextBoxNotationResponse.TabIndex = 0; this.richTextBoxNotationResponse.Text = ""; // @@ -1204,7 +1371,7 @@ this.tabPageHexViewResponse.ImageIndex = 0; this.tabPageHexViewResponse.Location = new System.Drawing.Point(4, 24); this.tabPageHexViewResponse.Name = "tabPageHexViewResponse"; - this.tabPageHexViewResponse.Size = new System.Drawing.Size(611, 200); + this.tabPageHexViewResponse.Size = new System.Drawing.Size(611, 195); this.tabPageHexViewResponse.TabIndex = 4; this.tabPageHexViewResponse.Text = "Hex"; this.tabPageHexViewResponse.UseVisualStyleBackColor = true; @@ -1213,7 +1380,7 @@ // this.buttonExportRawHex.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonExportRawHex.Font = new System.Drawing.Font("Arial", 3.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonExportRawHex.Location = new System.Drawing.Point(594, 187); + this.buttonExportRawHex.Location = new System.Drawing.Point(594, 179); this.buttonExportRawHex.Name = "buttonExportRawHex"; this.buttonExportRawHex.Size = new System.Drawing.Size(13, 13); this.buttonExportRawHex.TabIndex = 3; @@ -1226,7 +1393,7 @@ this.labelHexBoxResponseStatus.AutoSize = true; this.labelHexBoxResponseStatus.Dock = System.Windows.Forms.DockStyle.Bottom; this.labelHexBoxResponseStatus.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.labelHexBoxResponseStatus.Location = new System.Drawing.Point(0, 187); + this.labelHexBoxResponseStatus.Location = new System.Drawing.Point(0, 182); this.labelHexBoxResponseStatus.Name = "labelHexBoxResponseStatus"; this.labelHexBoxResponseStatus.Size = new System.Drawing.Size(66, 13); this.labelHexBoxResponseStatus.TabIndex = 2; @@ -1242,7 +1409,7 @@ this.hexBoxResponse.Location = new System.Drawing.Point(0, 0); this.hexBoxResponse.Name = "hexBoxResponse"; this.hexBoxResponse.ShadowSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(60)))), ((int)(((byte)(188)))), ((int)(((byte)(255))))); - this.hexBoxResponse.Size = new System.Drawing.Size(611, 184); + this.hexBoxResponse.Size = new System.Drawing.Size(611, 173); this.hexBoxResponse.StringViewVisible = true; this.hexBoxResponse.TabIndex = 1; this.hexBoxResponse.UseFixedBytesPerLine = true; @@ -1252,27 +1419,37 @@ // // tabPageInject // - this.tabPageInject.Controls.Add(this.buttonInjectPacket); + this.tabPageInject.Controls.Add(this.toolStrip1); this.tabPageInject.Controls.Add(this.richTextBoxInject); this.tabPageInject.Location = new System.Drawing.Point(4, 30); this.tabPageInject.Name = "tabPageInject"; this.tabPageInject.Padding = new System.Windows.Forms.Padding(3); - this.tabPageInject.Size = new System.Drawing.Size(619, 460); + this.tabPageInject.Size = new System.Drawing.Size(619, 433); this.tabPageInject.TabIndex = 2; this.tabPageInject.Text = "Inject"; this.tabPageInject.UseVisualStyleBackColor = true; // - // buttonInjectPacket + // toolStrip1 // - this.buttonInjectPacket.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonInjectPacket.Enabled = false; - this.buttonInjectPacket.Location = new System.Drawing.Point(536, 429); - this.buttonInjectPacket.Name = "buttonInjectPacket"; - this.buttonInjectPacket.Size = new System.Drawing.Size(75, 23); - this.buttonInjectPacket.TabIndex = 1; - this.buttonInjectPacket.Text = "Inject"; - this.buttonInjectPacket.UseVisualStyleBackColor = true; - this.buttonInjectPacket.Click += new System.EventHandler(this.buttonInjectPacket_Click); + this.toolStrip1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButtonInject}); + this.toolStrip1.Location = new System.Drawing.Point(3, 405); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(613, 25); + this.toolStrip1.TabIndex = 2; + this.toolStrip1.Text = "toolStrip1"; + // + // toolStripButtonInject + // + this.toolStripButtonInject.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripButtonInject.Enabled = false; + this.toolStripButtonInject.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonInject.Image"))); + this.toolStripButtonInject.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButtonInject.Name = "toolStripButtonInject"; + this.toolStripButtonInject.Size = new System.Drawing.Size(40, 22); + this.toolStripButtonInject.Text = "Inject"; + this.toolStripButtonInject.Click += new System.EventHandler(this.toolStripButtonInject_Click); // // richTextBoxInject // @@ -1280,19 +1457,21 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.richTextBoxInject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.richTextBoxInject.DetectUrls = false; + this.richTextBoxInject.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.richTextBoxInject.Location = new System.Drawing.Point(6, 6); this.richTextBoxInject.Name = "richTextBoxInject"; - this.richTextBoxInject.Size = new System.Drawing.Size(605, 417); + this.richTextBoxInject.Size = new System.Drawing.Size(605, 396); this.richTextBoxInject.TabIndex = 0; this.richTextBoxInject.Text = ""; this.richTextBoxInject.TextChanged += new System.EventHandler(this.richTextBoxInject_TextChanged); // - // selectToolStripMenuItem1 + // removeToolStripMenuItem2 // - this.selectToolStripMenuItem1.DropDown = this.contextMenuStripSelect; - this.selectToolStripMenuItem1.Name = "selectToolStripMenuItem1"; - this.selectToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); - this.selectToolStripMenuItem1.Text = "Select"; + this.removeToolStripMenuItem2.DropDown = this.contextMenuStripRemove; + this.removeToolStripMenuItem2.Name = "removeToolStripMenuItem2"; + this.removeToolStripMenuItem2.Size = new System.Drawing.Size(137, 22); + this.removeToolStripMenuItem2.Text = "Remove"; // // toolStripLabelHexEditorRequest // @@ -1313,7 +1492,7 @@ this.toolStripDropDownButton4}); this.toolStripMenu.Location = new System.Drawing.Point(3, 0); this.toolStripMenu.Name = "toolStripMenu"; - this.toolStripMenu.Size = new System.Drawing.Size(139, 25); + this.toolStripMenu.Size = new System.Drawing.Size(108, 25); this.toolStripMenu.TabIndex = 2; this.toolStripMenu.Text = "toolStrip1"; // @@ -1478,7 +1657,7 @@ // this.copyToolStripMenuItem1.DropDown = this.contextMenuStripCopy; this.copyToolStripMenuItem1.Name = "copyToolStripMenuItem1"; - this.copyToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); + this.copyToolStripMenuItem1.Size = new System.Drawing.Size(137, 22); this.copyToolStripMenuItem1.Text = "Copy"; this.copyToolStripMenuItem1.Visible = false; // @@ -1538,6 +1717,8 @@ // toolStripDropDownButton4 // this.toolStripDropDownButton4.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.documentationToolStripMenuItem, + this.toolStripSeparator13, this.aboutToolStripMenuItem}); this.toolStripDropDownButton4.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripDropDownButton4.Name = "toolStripDropDownButton4"; @@ -1545,10 +1726,22 @@ this.toolStripDropDownButton4.Size = new System.Drawing.Size(36, 22); this.toolStripDropDownButton4.Text = "&Help"; // + // documentationToolStripMenuItem + // + this.documentationToolStripMenuItem.Name = "documentationToolStripMenuItem"; + this.documentationToolStripMenuItem.Size = new System.Drawing.Size(157, 22); + this.documentationToolStripMenuItem.Text = "Documentation"; + this.documentationToolStripMenuItem.Click += new System.EventHandler(this.documentationToolStripMenuItem_Click); + // + // toolStripSeparator13 + // + this.toolStripSeparator13.Name = "toolStripSeparator13"; + this.toolStripSeparator13.Size = new System.Drawing.Size(154, 6); + // // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(107, 22); + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(157, 22); this.aboutToolStripMenuItem.Text = "About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutWinGridProxyToolStripMenuItem_Click); // @@ -1561,6 +1754,7 @@ // // timer1 // + this.timer1.Interval = 250; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // toolStripDropDownButton1 @@ -1870,29 +2064,63 @@ this.autoColorizeToolStripMenuItem.Name = "autoColorizeToolStripMenuItem"; this.autoColorizeToolStripMenuItem.Size = new System.Drawing.Size(121, 22); this.autoColorizeToolStripMenuItem.Text = "Auto Colorize"; - this.autoColorizeToolStripMenuItem.Click += new System.EventHandler(this.autoColorizeToolStripMenuItem_Click); // // toolStripContainer1 // // + // toolStripContainer1.BottomToolStripPanel + // + this.toolStripContainer1.BottomToolStripPanel.Controls.Add(this.statusStrip1); + // // toolStripContainer1.ContentPanel // this.toolStripContainer1.ContentPanel.AutoScroll = true; this.toolStripContainer1.ContentPanel.Controls.Add(this.panelMainWindow); - this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(1111, 494); + this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(1111, 467); this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.toolStripContainer1.LeftToolStripPanelVisible = false; this.toolStripContainer1.Location = new System.Drawing.Point(0, 0); this.toolStripContainer1.Name = "toolStripContainer1"; this.toolStripContainer1.RightToolStripPanelVisible = false; - this.toolStripContainer1.Size = new System.Drawing.Size(1111, 519); + this.toolStripContainer1.Size = new System.Drawing.Size(1111, 514); this.toolStripContainer1.TabIndex = 6; this.toolStripContainer1.Text = "toolStripContainer1"; // // toolStripContainer1.TopToolStripPanel // + this.toolStripContainer1.TopToolStripPanel.BackColor = System.Drawing.SystemColors.Control; this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStripMenu); this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStripLogin); + this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStripQuickLaunch); + // + // statusStrip1 + // + this.statusStrip1.Dock = System.Windows.Forms.DockStyle.None; + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripLowerStatusLabel, + this.toolStripStatusLabel2}); + this.statusStrip1.Location = new System.Drawing.Point(0, 0); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.statusStrip1.Size = new System.Drawing.Size(1111, 22); + this.statusStrip1.SizingGrip = false; + this.statusStrip1.TabIndex = 0; + // + // toolStripLowerStatusLabel + // + this.toolStripLowerStatusLabel.Name = "toolStripLowerStatusLabel"; + this.toolStripLowerStatusLabel.Size = new System.Drawing.Size(0, 17); + // + // toolStripStatusLabel2 + // + this.toolStripStatusLabel2.BorderStyle = System.Windows.Forms.Border3DStyle.Sunken; + this.toolStripStatusLabel2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripStatusLabel2.Enabled = false; + this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; + this.toolStripStatusLabel2.Size = new System.Drawing.Size(1096, 17); + this.toolStripStatusLabel2.Spring = true; + this.toolStripStatusLabel2.Text = "WinGridProxy v0.8.0"; + this.toolStripStatusLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // toolStripLogin // @@ -1906,9 +2134,9 @@ this.comboBoxLoginURL, this.buttonStartProxy}); this.toolStripLogin.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow; - this.toolStripLogin.Location = new System.Drawing.Point(142, 0); + this.toolStripLogin.Location = new System.Drawing.Point(111, 0); this.toolStripLogin.Name = "toolStripLogin"; - this.toolStripLogin.Size = new System.Drawing.Size(751, 25); + this.toolStripLogin.Size = new System.Drawing.Size(726, 25); this.toolStripLogin.TabIndex = 3; // // toolStripLabel1 @@ -1943,18 +2171,13 @@ // // comboBoxLoginURL // - this.comboBoxLoginURL.Items.AddRange(new object[] { - "https://login.agni.lindenlab.com/cgi-bin/login.cgi", - "https://login.aditi.lindenlab.com/cgi-bin/login.cgi", - "http://127.0.0.1:8002", - "http://osgrid.org:8002"}); this.comboBoxLoginURL.Name = "comboBoxLoginURL"; - this.comboBoxLoginURL.Size = new System.Drawing.Size(300, 25); - this.comboBoxLoginURL.Text = "https://login.agni.lindenlab.com/cgi-bin/login.cgi"; + this.comboBoxLoginURL.Size = new System.Drawing.Size(275, 25); + this.comboBoxLoginURL.Leave += new System.EventHandler(this.comboBoxLoginURL_Leave); // // buttonStartProxy // - this.buttonStartProxy.BackColor = System.Drawing.Color.LightGreen; + this.buttonStartProxy.BackColor = System.Drawing.Color.LawnGreen; this.buttonStartProxy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.buttonStartProxy.ImageTransparentColor = System.Drawing.Color.Magenta; this.buttonStartProxy.Name = "buttonStartProxy"; @@ -1962,142 +2185,52 @@ this.buttonStartProxy.Text = "Start Proxy"; this.buttonStartProxy.Click += new System.EventHandler(this.buttonStartProxy_Click); // + // toolStripQuickLaunch + // + this.toolStripQuickLaunch.BackColor = System.Drawing.SystemColors.Control; + this.toolStripQuickLaunch.Dock = System.Windows.Forms.DockStyle.None; + this.toolStripQuickLaunch.Enabled = false; + this.toolStripQuickLaunch.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripComboBox1, + this.buttonLaunchViewer}); + this.toolStripQuickLaunch.Location = new System.Drawing.Point(837, 0); + this.toolStripQuickLaunch.Name = "toolStripQuickLaunch"; + this.toolStripQuickLaunch.Size = new System.Drawing.Size(164, 25); + this.toolStripQuickLaunch.TabIndex = 4; + // + // toolStripComboBox1 + // + this.toolStripComboBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.toolStripComboBox1.Name = "toolStripComboBox1"; + this.toolStripComboBox1.Size = new System.Drawing.Size(100, 25); + // + // buttonLaunchViewer + // + this.buttonLaunchViewer.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.buttonLaunchViewer.Image = ((System.Drawing.Image)(resources.GetObject("buttonLaunchViewer.Image"))); + this.buttonLaunchViewer.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttonLaunchViewer.Name = "buttonLaunchViewer"; + this.buttonLaunchViewer.Size = new System.Drawing.Size(50, 22); + this.buttonLaunchViewer.Text = "Launch"; + this.buttonLaunchViewer.Click += new System.EventHandler(this.toolStripButtonLaunchViewer_Click); + // // saveFileDialog3 // this.saveFileDialog3.DefaultExt = "packet"; this.saveFileDialog3.Filter = "Packets|*.packet|All Files|*.*"; this.saveFileDialog3.Title = "Export Binary Data to File"; // - // listViewSessions + // timerCleanupCache // - this.listViewSessions.AllowColumnReorder = true; - this.listViewSessions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeaderCounter, - this.columnHeaderProtocol, - this.columnHeaderType, - this.columnHeaderSize, - this.columnHeaderUrl, - this.columnHeaderContentType}); - this.listViewSessions.ContextMenuStrip = this.contextMenuStripSessions; - this.listViewSessions.Dock = System.Windows.Forms.DockStyle.Fill; - this.listViewSessions.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.listViewSessions.FullRowSelect = true; - this.listViewSessions.GridLines = true; - this.listViewSessions.HideSelection = false; - this.listViewSessions.Location = new System.Drawing.Point(0, 0); - this.listViewSessions.Name = "listViewSessions"; - this.listViewSessions.Size = new System.Drawing.Size(479, 494); - this.listViewSessions.SmallImageList = this.imageList1; - this.listViewSessions.TabIndex = 0; - this.listViewSessions.UseCompatibleStateImageBehavior = false; - this.listViewSessions.View = System.Windows.Forms.View.Details; - this.listViewSessions.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewSessions_ColumnClick); - this.listViewSessions.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listViewSessions_ItemSelectionChanged); - // - // columnHeaderCounter - // - this.columnHeaderCounter.Tag = "number"; - this.columnHeaderCounter.Text = "#"; - this.columnHeaderCounter.Width = 40; - // - // columnHeaderProtocol - // - this.columnHeaderProtocol.Tag = "string"; - this.columnHeaderProtocol.Text = "Protocol"; - // - // columnHeaderType - // - this.columnHeaderType.Tag = "string"; - this.columnHeaderType.Text = "Name"; - this.columnHeaderType.Width = 151; - // - // columnHeaderSize - // - this.columnHeaderSize.Tag = ""; - this.columnHeaderSize.Text = "Bytes"; - this.columnHeaderSize.Width = 42; - // - // columnHeaderUrl - // - this.columnHeaderUrl.Text = "Host"; - this.columnHeaderUrl.Width = 312; - // - // columnHeaderContentType - // - this.columnHeaderContentType.Text = "Content Type"; - this.columnHeaderContentType.Width = 250; - // - // listViewPacketFilters - // - this.listViewPacketFilters.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.listViewPacketFilters.CheckBoxes = true; - this.listViewPacketFilters.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeaderPacketName}); - this.listViewPacketFilters.Dock = System.Windows.Forms.DockStyle.Fill; - this.listViewPacketFilters.FullRowSelect = true; - this.listViewPacketFilters.GridLines = true; - listViewGroup9.Header = "Login"; - listViewGroup9.Name = "Login"; - listViewGroup10.Header = "Packets"; - listViewGroup10.Name = "Packets"; - this.listViewPacketFilters.Groups.AddRange(new System.Windows.Forms.ListViewGroup[] { - listViewGroup9, - listViewGroup10}); - this.listViewPacketFilters.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; - this.listViewPacketFilters.Location = new System.Drawing.Point(3, 17); - this.listViewPacketFilters.MultiSelect = false; - this.listViewPacketFilters.Name = "listViewPacketFilters"; - this.listViewPacketFilters.Size = new System.Drawing.Size(291, 374); - this.listViewPacketFilters.Sorting = System.Windows.Forms.SortOrder.Ascending; - this.listViewPacketFilters.TabIndex = 0; - this.listViewPacketFilters.UseCompatibleStateImageBehavior = false; - this.listViewPacketFilters.View = System.Windows.Forms.View.Details; - this.listViewPacketFilters.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listViewPacketFilters_ItemChecked); - this.listViewPacketFilters.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewFilterSorter_ColumnClick); - // - // columnHeaderPacketName - // - this.columnHeaderPacketName.Text = "Name"; - this.columnHeaderPacketName.Width = 287; - // - // listViewMessageFilters - // - this.listViewMessageFilters.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.listViewMessageFilters.CheckBoxes = true; - this.listViewMessageFilters.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeaderName}); - this.listViewMessageFilters.Dock = System.Windows.Forms.DockStyle.Fill; - this.listViewMessageFilters.FullRowSelect = true; - this.listViewMessageFilters.GridLines = true; - listViewGroup11.Header = "Capabilities"; - listViewGroup11.Name = "Capabilities"; - listViewGroup12.Header = "EventQueue Messages"; - listViewGroup12.Name = "EventQueueMessages"; - this.listViewMessageFilters.Groups.AddRange(new System.Windows.Forms.ListViewGroup[] { - listViewGroup11, - listViewGroup12}); - this.listViewMessageFilters.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; - this.listViewMessageFilters.Location = new System.Drawing.Point(3, 17); - this.listViewMessageFilters.MultiSelect = false; - this.listViewMessageFilters.Name = "listViewMessageFilters"; - this.listViewMessageFilters.Size = new System.Drawing.Size(293, 374); - this.listViewMessageFilters.Sorting = System.Windows.Forms.SortOrder.Ascending; - this.listViewMessageFilters.TabIndex = 1; - this.listViewMessageFilters.UseCompatibleStateImageBehavior = false; - this.listViewMessageFilters.View = System.Windows.Forms.View.Details; - this.listViewMessageFilters.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listViewMessageFilters_ItemChecked); - this.listViewMessageFilters.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewFilterSorter_ColumnClick); - // - // columnHeaderName - // - this.columnHeaderName.Text = "Name"; - this.columnHeaderName.Width = 289; + this.timerCleanupCache.Enabled = true; + this.timerCleanupCache.Interval = 30000; + this.timerCleanupCache.Tick += new System.EventHandler(this.timerExpireCache_Tick); // // FormWinGridProxy // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1111, 519); + this.ClientSize = new System.Drawing.Size(1111, 514); this.Controls.Add(this.toolStripContainer1); this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Name = "FormWinGridProxy"; @@ -2107,6 +2240,7 @@ this.splitContainerSessionsTabs.Panel1.ResumeLayout(false); this.splitContainerSessionsTabs.Panel2.ResumeLayout(false); this.splitContainerSessionsTabs.ResumeLayout(false); + this.panelActionProgress.ResumeLayout(false); this.contextMenuStripSessions.ResumeLayout(false); this.contextMenuStripRemove.ResumeLayout(false); this.contextMenuStripSelect.ResumeLayout(false); @@ -2120,8 +2254,6 @@ this.groupBox1.PerformLayout(); this.tabPageFilters.ResumeLayout(false); this.tabPageFilters.PerformLayout(); - this.toolStripFilters.ResumeLayout(false); - this.toolStripFilters.PerformLayout(); this.splitContainerFilters.Panel1.ResumeLayout(false); this.splitContainerFilters.Panel1.PerformLayout(); this.splitContainerFilters.Panel2.ResumeLayout(false); @@ -2129,6 +2261,8 @@ this.splitContainerFilters.ResumeLayout(false); this.grpUDPFilters.ResumeLayout(false); this.grpCapsFilters.ResumeLayout(false); + this.toolStripFilters.ResumeLayout(false); + this.toolStripFilters.PerformLayout(); this.tabPageInspect.ResumeLayout(false); this.splitContainerInspectorTab.Panel1.ResumeLayout(false); this.splitContainerInspectorTab.Panel2.ResumeLayout(false); @@ -2148,17 +2282,26 @@ this.tabPageHexViewResponse.ResumeLayout(false); this.tabPageHexViewResponse.PerformLayout(); this.tabPageInject.ResumeLayout(false); + this.tabPageInject.PerformLayout(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); this.toolStripMenu.ResumeLayout(false); this.toolStripMenu.PerformLayout(); this.contextMenuStripCopy.ResumeLayout(false); this.contextMenuStripFilterOptions.ResumeLayout(false); + this.toolStripContainer1.BottomToolStripPanel.ResumeLayout(false); + this.toolStripContainer1.BottomToolStripPanel.PerformLayout(); this.toolStripContainer1.ContentPanel.ResumeLayout(false); this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false); this.toolStripContainer1.TopToolStripPanel.PerformLayout(); this.toolStripContainer1.ResumeLayout(false); this.toolStripContainer1.PerformLayout(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); this.toolStripLogin.ResumeLayout(false); this.toolStripLogin.PerformLayout(); + this.toolStripQuickLaunch.ResumeLayout(false); + this.toolStripQuickLaunch.PerformLayout(); this.ResumeLayout(false); } @@ -2198,7 +2341,6 @@ private System.Windows.Forms.TabPage tabPageHexViewResponse; private Be.Windows.Forms.HexBox hexBoxResponse; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; - private System.Windows.Forms.Button buttonInjectPacket; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label8; @@ -2356,6 +2498,19 @@ private System.Windows.Forms.Button buttonExportRawHex; private System.Windows.Forms.Button buttonSaveRequestHex; private System.Windows.Forms.SaveFileDialog saveFileDialog3; + private System.Windows.Forms.Panel panelActionProgress; + private System.Windows.Forms.ProgressBar progressBar1; + private System.Windows.Forms.Timer timerCleanupCache; + private System.Windows.Forms.ToolStrip toolStripQuickLaunch; + private System.Windows.Forms.ToolStripComboBox toolStripComboBox1; + private System.Windows.Forms.ToolStripButton buttonLaunchViewer; + private System.Windows.Forms.ToolStripMenuItem documentationToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator13; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripButton toolStripButtonInject; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2; + private System.Windows.Forms.ToolStripStatusLabel toolStripLowerStatusLabel; } } diff --git a/Programs/WinGridProxy/FormWinGridProxy.cs b/Programs/WinGridProxy/FormWinGridProxy.cs index df82fff5..b0e13281 100644 --- a/Programs/WinGridProxy/FormWinGridProxy.cs +++ b/Programs/WinGridProxy/FormWinGridProxy.cs @@ -27,6 +27,7 @@ using System; using System.IO; using System.Net; +using System.Linq; using System.Collections; using System.Collections.Generic; using System.ComponentModel; @@ -49,10 +50,16 @@ namespace WinGridProxy { public partial class FormWinGridProxy : Form { + // only allow one thread at a time to do file I/O operations + private object m_FileIOLockerObject = new object(); + + // Class for saving and restoring settings private static SettingsStore Store = new SettingsStore(); private static bool m_ProxyRunning; + private Assembly m_CurrentAssembly = Assembly.GetExecutingAssembly(); + ProxyManager proxy; private FormPluginManager pluginManager; @@ -69,39 +76,52 @@ namespace WinGridProxy private int PacketsOutCounter; private int PacketsOutBytes; - private List QueuedSessions; - private System.Threading.Timer SessionQueue; - private int SessionQueueInterval; private bool monoRuntime; + // Sessions & Sessions ListView related + private List m_SessionViewItems; + private Dictionary m_SessionViewCache = new Dictionary(); + private SortOrder m_ListViewSortOrder = SortOrder.None; + // disable listview virtual items counter being updated + // if we're scrolling the listview to get around a flicker issue + // due to an item selected going out of view + private bool m_AllowUpdate = true; + private const string PROTO_CAPABILITIES = "Cap"; private const string PROTO_EVENTMESSAGE = "Event"; private const string PROTO_PACKETSTRING = "UDP"; private const string PROTO_AUTHENTICATE = "https"; + // some default colors for session items private readonly Color Color_Login = Color.OldLace; private readonly Color Color_Packet = Color.LightYellow; private readonly Color Color_Cap = Color.Honeydew; private readonly Color Color_Event = Color.AliceBlue; + // some UI customization + private Dictionary m_InstalledViewers = new Dictionary(); + private List m_DefaultGridLoginServers; + + // a reference to the last selected session item + private Session m_CurrentSession; + public FormWinGridProxy() { InitializeComponent(); + m_SessionViewItems = new List(); + Logger.Log("WinGridProxy ready", Helpers.LogLevel.Info); if (FireEventAppender.Instance != null) { FireEventAppender.Instance.MessageLoggedEvent += new MessageLoggedEventHandler(Instance_MessageLoggedEvent); } - - // Attempt to work around some mono bugs + + // Attempt to work around some mono inefficiencies monoRuntime = Type.GetType("Mono.Runtime") != null; // Officially supported way of detecting mono if (monoRuntime) { - SessionQueueInterval = 500; - SessionQueue = new System.Threading.Timer(new TimerCallback(SessionQueueWorker), null, SessionQueueInterval, SessionQueueInterval); - QueuedSessions = new List(); Font fixedFont = new Font(FontFamily.GenericMonospace, 9f, FontStyle.Regular, GraphicsUnit.Point); richTextBoxDecodedRequest.Font = richTextBoxDecodedResponse.Font = @@ -111,10 +131,7 @@ namespace WinGridProxy richTextBoxRawResponse.Font = fixedFont; } - // populate the listen box with the known IP Addresses of this host - IPHostEntry iphostentry = Dns.GetHostByName(Dns.GetHostName()); - foreach (IPAddress address in iphostentry.AddressList) - comboBoxListenAddress.Items.Add(address.ToString()); + InitializeInterfaceDefaults(); ProxyManager.OnPacketLog += ProxyManager_OnPacketLog; ProxyManager.OnMessageLog += ProxyManager_OnMessageLog; @@ -123,8 +140,93 @@ namespace WinGridProxy ProxyManager.OnEventMessageLog += ProxyManager_OnEventMessageLog; } - #region Event Handlers for Messages/Packets - + #region GUI Initialization + private void InitializeInterfaceDefaults() + { + // populate the listen box with the known IP Addresses of this host + IPHostEntry iphostentry = Dns.GetHostByName(Dns.GetHostName()); + foreach (IPAddress address in iphostentry.AddressList) + comboBoxListenAddress.Items.Add(address.ToString()); + + // Initialize login server combo box: + // * If gridservers.ini exists, read it and use values from that file + // * If gridservers.ini does not exist or is blank, use some pre-defined defaults + m_DefaultGridLoginServers = new List(); + string[] gridServers; + if (File.Exists("gridservers.ini")) + { + gridServers = File.ReadAllLines("gridservers.ini"); + for (int i = 0; i < gridServers.Length; i++) + { + if (String.IsNullOrEmpty(gridServers[i]) || !gridServers[i].Trim().StartsWith("http")) + continue; + m_DefaultGridLoginServers.Add(gridServers[i]); + } + } + string[] loginServers = {"https://login.agni.lindenlab.com/cgi-bin/login.cgi", + "https://login.aditi.lindenlab.com/cgi-bin/login.cgi", + "http://127.0.0.1:12043", + "http://127.0.0.1:8002", + "http://osgrid.org:8002"}; + + if (m_DefaultGridLoginServers.Count <= 0) + m_DefaultGridLoginServers.AddRange(loginServers); + + comboBoxLoginURL.Items.AddRange(m_DefaultGridLoginServers.ToArray()); + comboBoxLoginURL.Text = comboBoxLoginURL.Items[0].ToString(); + + // Find installed viewers for launch toolbar if running under windows + string[] viewerDistKeys = { "Linden Research, Inc.", "Open Metaverse Foundation" }; + Microsoft.Win32.RegistryKey viewerKeyRoot = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"Software\Wow6432Node"); + if (viewerKeyRoot == null) + { + viewerKeyRoot = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"Software"); + } + + if (viewerKeyRoot != null) + { + foreach (string key in viewerDistKeys) + { + Microsoft.Win32.RegistryKey viewerKey = viewerKeyRoot.OpenSubKey(key); + if (viewerKey != null) + { + string[] installed = viewerKey.GetSubKeyNames(); + foreach (string viewer in installed) + { + if (!m_InstalledViewers.ContainsKey(viewer)) + { + Microsoft.Win32.RegistryKey me = viewerKey.OpenSubKey(viewer); + if (me != null) + { + string dir = me.GetValue("").ToString(); // the install directory + string exe = me.GetValue("Exe").ToString(); // the executable name + string ver = me.GetValue("Version").ToString(); // the viewer version + + if (File.Exists(Path.Combine(dir, exe))) + { + toolStripComboBox1.Items.Add(viewer + " " + ver); + m_InstalledViewers.Add(viewer + " " + ver, Path.Combine(dir, exe)); + } + } + } + } + } + } + } + + if (toolStripComboBox1.Items.Count > 0) + { + toolStripComboBox1.Text = toolStripComboBox1.Items[0].ToString(); + } + else + { + toolStripQuickLaunch.Visible = false; + } + } + #endregion + + #region Event Handlers for Messages/Packets arriving via GridProxy + /// /// Adds a new EventQueue message to the Message Filters listview. /// @@ -134,10 +236,7 @@ namespace WinGridProxy { if (this.InvokeRequired) { - this.BeginInvoke(new MethodInvoker(delegate() - { - ProxyManager_OnEventMessageLog(req, stage); - })); + this.BeginInvoke(new MethodInvoker(() => ProxyManager_OnEventMessageLog(req, stage))); } else { @@ -168,10 +267,7 @@ namespace WinGridProxy { if (this.InvokeRequired) { - this.BeginInvoke(new MethodInvoker(delegate() - { - ProxyManager_OnCapabilityAdded(cap); - })); + this.BeginInvoke(new MethodInvoker(() => ProxyManager_OnCapabilityAdded(cap))); } else { @@ -196,13 +292,10 @@ namespace WinGridProxy { if (this.InvokeRequired) { - this.BeginInvoke(new MethodInvoker(delegate() - { - ProxyManager_OnLoginResponse(request, direction); - })); + this.BeginInvoke(new MethodInvoker(() => ProxyManager_OnLoginResponse(request, direction))); } else - { + { string loginType; if (request is XmlRpcRequest) @@ -227,9 +320,8 @@ namespace WinGridProxy sessionEntry.Tag = sessionLogin; sessionEntry.ImageIndex = (int)sessionLogin.Direction; - //session.ImageIndex = (request is XmlRpcRequest) ? 1 : 0; - AddSession(sessionEntry); + m_SessionViewItems.Add(sessionLogin); } } } @@ -250,14 +342,11 @@ namespace WinGridProxy PacketsOutBytes += packet.Length; } - SessionPacket sessionPacket = new SessionPacket(packet, direction, endpoint, + SessionPacket sessionPacket = new SessionPacket(packet, direction, endpoint, PacketDecoder.InterpretOptions(packet.Header) + " Seq: " + packet.Header.Sequence.ToString() + " Freq:" + packet.Header.Frequency.ToString()); - ListViewItem sessionItem = new ListViewItem(new string[] { PacketCounter.ToString(), sessionPacket.Protocol, sessionPacket.Name, sessionPacket.Length.ToString(), sessionPacket.Host, sessionPacket.ContentType }); - sessionItem.Tag = sessionPacket; - sessionItem.ImageIndex = (int)sessionPacket.Direction; + m_SessionViewItems.Add(sessionPacket); - AddSession(sessionItem); } /// @@ -267,10 +356,7 @@ namespace WinGridProxy { if (this.InvokeRequired) { - this.BeginInvoke(new MethodInvoker(delegate() - { - ProxyManager_OnMessageLog(req, stage); - })); + this.BeginInvoke(new MethodInvoker(() => ProxyManager_OnMessageLog(req, stage))); } else { @@ -320,15 +406,15 @@ namespace WinGridProxy capsSession = new SessionEvent(req.RawResponse, req.ResponseHeaders, req.Info.URI, req.Info.CapType, proto); } - string[] s = { PacketCounter.ToString(),capsSession.Protocol, capsSession.Name, capsSession.Length.ToString(), capsSession.Host, capsSession.ContentType }; + string[] s = { PacketCounter.ToString(), capsSession.Protocol, capsSession.Name, capsSession.Length.ToString(), capsSession.Host, capsSession.ContentType }; ListViewItem session = new ListViewItem(s); - - session.ImageIndex = (int)direction; + + session.ImageIndex = (int)direction; session.Tag = capsSession; session.BackColor = found.BackColor; - AddSession(session); + m_SessionViewItems.Add(capsSession); } else { @@ -360,6 +446,44 @@ namespace WinGridProxy return null; } + private void UpdateVirtualListSize(int newSize) + { + if (listViewSessions.VirtualListSize != newSize && listViewSessions.InvokeRequired) + { + this.BeginInvoke((MethodInvoker)(() => UpdateVirtualListSize(newSize))); + } + else + { + //if(listViewSessions.VirtualListSize != newSize) + //{ + listViewSessions.VirtualListSize = newSize; + //} + } + } + + private void ClearCache() + { + lock (m_SessionViewCache) + { + m_SessionViewCache.Clear(); + } + } + + private static string FormatBytes(long bytes) + { + const int scale = 1024; + string[] orders = new string[] { "GB", "MB", "KB", "Bytes" }; + long max = (long)Math.Pow(scale, orders.Length - 1); + + foreach (string order in orders) + { + if (bytes > max) + return string.Format("{0:##.##} {1}", decimal.Divide(bytes, max), order); + + max /= scale; + } + return "0"; + } #endregion #region GUI Event Handlers @@ -376,7 +500,7 @@ namespace WinGridProxy proxy.Start(); - loadFilterSelectionsToolStripMenuItem.Enabled = saveFilterSelectionsToolStripMenuItem.Enabled = true; + toolStripQuickLaunch.Enabled = loadFilterSelectionsToolStripMenuItem.Enabled = saveFilterSelectionsToolStripMenuItem.Enabled = true; // enable any gui elements toolStripSplitButton1.Enabled = @@ -388,7 +512,7 @@ namespace WinGridProxy } else if (buttonStartProxy.Text.StartsWith("Stop") && m_ProxyRunning.Equals(true)) { - loadFilterSelectionsToolStripMenuItem.Enabled = saveFilterSelectionsToolStripMenuItem.Enabled = false; + toolStripQuickLaunch.Enabled = loadFilterSelectionsToolStripMenuItem.Enabled = saveFilterSelectionsToolStripMenuItem.Enabled = false; // stop the proxy proxy.Stop(); toolStripMenuItemPlugins.Enabled = grpUDPFilters.Enabled = grpCapsFilters.Enabled = m_ProxyRunning = false; @@ -409,50 +533,6 @@ namespace WinGridProxy } } - private void listViewSessions_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) - { - - if (e.IsSelected && listViewSessions.SelectedItems.Count == 1) - { - // update the context menus - contextMenuStripSessions_Opening(sender, null); - - tabControlMain.SelectTab("tabPageInspect"); - - object tag = e.Item.Tag; - - if (tag is Session) - { - Session session = (Session)tag; - - treeViewXmlResponse.Nodes.Clear(); - treeViewXMLRequest.Nodes.Clear(); - - Be.Windows.Forms.DynamicByteProvider responseBytes = new Be.Windows.Forms.DynamicByteProvider(session.ToBytes(Direction.Incoming)); - richTextBoxDecodedResponse.Text = session.ToPrettyString(Direction.Incoming); - richTextBoxRawResponse.Text = session.ToRawString(Direction.Incoming); - richTextBoxNotationResponse.Text = session.ToStringNotation(Direction.Incoming); - hexBoxResponse.ByteProvider = responseBytes; - updateTreeView(session.ToXml(Direction.Incoming), treeViewXmlResponse); - - Be.Windows.Forms.DynamicByteProvider requestBytes = new Be.Windows.Forms.DynamicByteProvider(session.ToBytes(Direction.Outgoing)); - richTextBoxDecodedRequest.Text = session.ToPrettyString(Direction.Outgoing); - richTextBoxRawRequest.Text = session.ToRawString(Direction.Outgoing); - richTextBoxNotationRequest.Text = session.ToStringNotation(Direction.Outgoing); - hexBoxRequest.ByteProvider = requestBytes; - updateTreeView(session.ToXml(Direction.Outgoing), treeViewXMLRequest); - - RequestPosition_Changed(this, EventArgs.Empty); - ReplyPosition_Changed(this, EventArgs.Empty); - } - else - { - richTextBoxDecodedResponse.Text = "Unknown data object encountered: " + tag.GetType().ToString(); - } - - } - } - private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (m_ProxyRunning) @@ -465,54 +545,125 @@ namespace WinGridProxy // select all items in session list private void sessionSelectAll_Click(object sender, EventArgs e) { - foreach (ListViewItem item in listViewSessions.Items) + lock (m_SessionViewItems) { - item.Selected = true; + m_SessionViewItems.ForEach((session) => session.Selected = true); } + + ClearCache(); + listViewSessions.Invalidate(); } // unselect all items in session list private void sessionSelectNone_Click(object sender, EventArgs e) { - foreach (ListViewItem item in listViewSessions.Items) + lock (m_SessionViewItems) { - item.Selected = false; + m_SessionViewItems.ForEach((session) => session.Selected = false); } + + ClearCache(); + listViewSessions.Invalidate(); } // invert selection private void sessionInvertSelection_Click(object sender, EventArgs e) { - foreach (ListViewItem item in listViewSessions.Items) + lock (m_SessionViewItems) { - item.Selected = !item.Selected; + m_SessionViewItems.ForEach((session) => session.Selected = !session.Selected); } + + ClearCache(); + listViewSessions.Invalidate(); } // remove all sessions private void sessionRemoveAll_Click(object sender, EventArgs e) { - listViewSessions.Items.Clear(); + lock (m_SessionViewItems) + { + m_SessionViewItems.Clear(); + } + + ClearCache(); + listViewSessions.VirtualListSize = 0; + listViewSessions.Invalidate(); } // remove sessions that are currently selected private void sessionRemoveSelected_Click(object sender, EventArgs e) { - foreach (ListViewItem item in listViewSessions.Items) + + // first we'll check for any highlighted items + if (listViewSessions.SelectedIndices.Count > 0) { - if (item.Selected) - listViewSessions.Items.Remove(item); + for (int i = 0; i < listViewSessions.SelectedIndices.Count; i++) + { + int index = listViewSessions.SelectedIndices[i]; + lock (m_SessionViewItems) + { + m_SessionViewItems.RemoveAt(index); + } + } } + + // now we'll check for items that have their selected bool set + bool hasSelected = false; + + m_SessionViewItems.ForEach(delegate(Session action) + { + if (action.Selected) + { + hasSelected = true; + return; + } + }); + + if (hasSelected) + { + progressBar1.Step = 1; + progressBar1.Maximum = m_SessionViewItems.Count; + progressBar1.Value = 0; + panelActionProgress.Visible = true; + + lock (m_SessionViewItems) + { + m_SessionViewItems.RemoveAll(delegate(Session sess) + { + progressBar1.PerformStep(); + return sess.Selected; + }); + } + } + + ClearCache(); + panelActionProgress.Visible = false; + listViewSessions.VirtualListSize = m_SessionViewItems.Count; + listViewSessions.SelectedIndices.Clear(); + listViewSessions.Invalidate(); } // remove sessions that are not currently selected private void sessionRemoveUnselected_Click(object sender, EventArgs e) { - foreach (ListViewItem item in listViewSessions.Items) + progressBar1.Step = m_SessionViewItems.Count / 100; + progressBar1.Value = 0; + panelActionProgress.Visible = true; + + lock (m_SessionViewItems) { - if (!item.Selected) - listViewSessions.Items.Remove(item); + for (int i = 0; i < m_SessionViewItems.Count; i++) + { + progressBar1.PerformStep(); + if (!m_SessionViewItems[i].Selected) + m_SessionViewItems.RemoveAt(i);//.Remove(m_SessionViewItems[i]); + } } + + ClearCache(); + listViewSessions.Invalidate(); + panelActionProgress.Visible = false; } // Colorize selected sessions @@ -520,22 +671,30 @@ namespace WinGridProxy { ToolStripMenuItem menu = (ToolStripMenuItem)sender; - foreach (ListViewItem item in listViewSessions.Items) + lock (m_SessionViewItems) { - if (item.Selected) - item.BackColor = Color.FromName(menu.Text); + for (int i = 0; i < m_SessionViewItems.Count; i++) + { + if (m_SessionViewItems[i].Selected) + m_SessionViewItems[i].BackColor = Color.FromName(menu.Text); + } } + sessionSelectNone_Click(sender, e); } // Unmark selected sessions private void sessionUnmarkSelected_Click(object sender, EventArgs e) { - foreach (ListViewItem item in listViewSessions.Items) + lock (m_SessionViewItems) { - if (item.Selected) - item.BackColor = Color.White; + for (int i = 0; i < m_SessionViewItems.Count; i++) + { + if (m_SessionViewItems[i].Selected) + m_SessionViewItems[i].BackColor = Color.White; + } } + sessionSelectNone_Click(sender, e); } @@ -567,15 +726,22 @@ namespace WinGridProxy } buttonExportRawHex.Visible = (hexBoxResponse.ByteProvider != null && hexBoxResponse.ByteProvider.Length > 0); } - + // select all specified sessions by packet name private void sessionSelectAllPacketType_Click(object sender, EventArgs e) { - foreach (ListViewItem item in listViewSessions.Items) + lock (m_SessionViewItems) { - if (item.SubItems[2].Text.Equals(toolStripMenuItemSelectPacketName.Tag) && !item.Selected) - item.Selected = true; + for (int i = 0; i < m_SessionViewItems.Count; i++) + { + Session item = m_SessionViewItems[i]; + if (item.Name.Equals(toolStripMenuItemSelectPacketName.Tag) && !item.Selected) + item.Selected = true; + } } + + ClearCache(); + listViewSessions.Invalidate(); } // stop capturing selected filters @@ -602,8 +768,6 @@ namespace WinGridProxy /// /// Setup the context menu prior to it being displayed with specific entries for filtering packets/messages /// - /// - /// private void contextMenuStripSessions_Opening(object sender, CancelEventArgs e) { if (listViewSessions.FocusedItem != null) @@ -629,7 +793,7 @@ namespace WinGridProxy if (found != null) ctxChecked = found.Checked; } - else if (strPacketOrMessage.Equals("Messages"))// && listViewMessageFilters.Items.ContainsKey(toolStripMenuItemSelectPacketName.Tag.ToString())) + else if (strPacketOrMessage.Equals("Messages")) { ListViewItem found = FindListViewItem(listViewMessageFilters, toolStripMenuItemSelectPacketName.Tag.ToString(), false); if (found != null) @@ -648,6 +812,7 @@ namespace WinGridProxy if (listViewSessions.Items.Count > 0) { + toolStripMenuItemRemoveAll.Visible = markToolStripMenuItem2.Enabled = findToolStripMenuItem1.Enabled = toolStripMenuSessionsRemove.Enabled = @@ -655,6 +820,7 @@ namespace WinGridProxy } else { + toolStripMenuItemRemoveAll.Visible = markToolStripMenuItem2.Enabled = findToolStripMenuItem1.Enabled = toolStripMenuSessionsRemove.Enabled = @@ -664,7 +830,7 @@ namespace WinGridProxy private void findSessions_Click(object sender, EventArgs e) { - FilterOptions opts = new FilterOptions((listViewSessions.SelectedItems.Count > 0)); + FilterOptions opts = new FilterOptions((listViewSessions.SelectedIndices.Count > 0)); FormSessionSearch search = new FormSessionSearch(ref opts); search.ShowDialog(); @@ -679,17 +845,6 @@ namespace WinGridProxy } } - // Enable Inject button if box contains text - private void richTextBoxInject_TextChanged(object sender, EventArgs e) - { - buttonInjectPacket.Enabled = (richTextBoxInject.TextLength > 0); - } - - private void buttonInjectPacket_Click(object sender, EventArgs e) - { - proxy.InjectPacket(richTextBoxInject.Text, true); - } - private void saveFilterSelectionsToolStripMenuItem_Click(object sender, EventArgs e) { if (saveFileDialog2.ShowDialog() == DialogResult.OK) @@ -705,7 +860,7 @@ namespace WinGridProxy RestoreSavedSettings(openFileDialog2.FileName); if (listViewSessions.Items.Count > 0) { - if (MessageBox.Show("Would you like to apply these settings to the current session list?", + if (MessageBox.Show("Would you like to apply these settings to the current session list?", "Apply Filter", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { listViewSessions.BeginUpdate(); @@ -731,7 +886,7 @@ namespace WinGridProxy private void listViewPacketFilters_ItemChecked(object sender, ItemCheckedEventArgs e) { - if(e.Item.Group.Name.Equals("Packets")) + if (e.Item.Group.Name.Equals("Packets")) proxy.AddUDPDelegate(PacketTypeFromName(e.Item.Text), e.Item.Checked); } @@ -764,47 +919,13 @@ namespace WinGridProxy { OSDMap map = new OSDMap(1); OSDArray sessionArray = new OSDArray(); - foreach (ListViewItem item in listViewSessions.Items) + + foreach (Session item in m_SessionViewItems) { - if (item.Tag is Session) - { - Session data = null; - if (item.Tag is SessionCaps) - { - data = (SessionCaps)item.Tag; - } - else if (item.Tag is SessionEvent) - { - data = (SessionEvent)item.Tag; - } - else if (item.Tag is SessionLogin) - { - data = (SessionLogin)item.Tag; - } - else if (item.Tag is SessionPacket) - { - data = (SessionPacket)item.Tag; - } - else - { - Console.WriteLine("Not a valid session type?"); - continue; - } - //Type t = item.Tag.GetType(); - - //Session data = (SessionCaps)item.Tag; - OSDMap session = new OSDMap(); - //session["name"] = OSD.FromString(item.Name); - //session["image_index"] = OSD.FromInteger(item.ImageIndex); - session["id"] = OSD.FromString(item.SubItems[0].Text); - //session["protocol"] = OSD.FromString(item.SubItems[1].Text); - //session["packet"] = OSD.FromString(item.SubItems[2].Text); - //session["size"] = OSD.FromString(item.SubItems[3].Text); - //session["host"] = OSD.FromString(item.SubItems[4].Text); - session["type"] = OSD.FromString(data.GetType().ToString()); - session["tag"] = OSD.FromBinary(data.Serialize()); - sessionArray.Add(session); - } + OSDMap session = new OSDMap(); + session["type"] = OSD.FromString(item.GetType().Name); + session["tag"] = OSD.FromBinary(item.Serialize()); + sessionArray.Add(session); } map["sessions"] = sessionArray; @@ -820,42 +941,131 @@ namespace WinGridProxy } } - private void loadSessionArchiveToolStripMenuItem_Click(object sender, EventArgs e) + private void SetProgressStep(int step) { - if (openFileDialog1.ShowDialog() == DialogResult.OK) + if (progressBar1.InvokeRequired) { - OSDMap map = (OSDMap)OSDParser.DeserializeLLSDNotation(File.ReadAllText(openFileDialog1.FileName)); - - OSDArray sessionsArray = (OSDArray)map["sessions"]; - - listViewSessions.Items.Clear(); - listViewSessions.BeginUpdate(); - for (int i = 0; i < sessionsArray.Count; i++) - { - OSDMap session = (OSDMap)sessionsArray[i]; - - Session importedSession = (Session)m_CurrentAssembly.CreateInstance(session["type"].AsString()); - importedSession.Deserialize(session["tag"].AsBinary()); - - ListViewItem addedItem = new ListViewItem(new string[] { - session["id"].AsString(), - importedSession.Protocol, - importedSession.Name, - importedSession.Length.ToString(), - importedSession.Host, - importedSession.ContentType}); - AddSession(addedItem); - //addedItem.ImageIndex = session["image_index"].AsInteger(); - addedItem.ImageIndex = (int)importedSession.Direction; - addedItem.BackColor = Color.GhostWhite; // give imported items a different color - addedItem.Tag = importedSession; - } - - listViewSessions.EndUpdate(); + progressBar1.Invoke(new MethodInvoker(delegate() + { + SetProgressStep(step); + })); + } + else + { + //progressBar1.Step = step; + progressBar1.Value += step; } } - //Generic ListView sort event + private void SetProgressVisible(bool visible) + { + if (panelActionProgress.InvokeRequired) + { + panelActionProgress.BeginInvoke(new MethodInvoker(delegate() + { + SetProgressVisible(visible); + })); + } + else + { + panelActionProgress.Visible = visible; + } + } + + private void loadSessionArchiveToolStripMenuItem_Click(object sender, EventArgs e) + { + + if (openFileDialog1.ShowDialog() == DialogResult.OK) + { + FileInfo fi = new FileInfo(openFileDialog1.FileName); + progressBar1.Maximum = (int)fi.Length; + progressBar1.Value = 0; + + // toss this job into a thread so the UI remains responsive for large files + System.Threading.ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(Object obj) + { + lock (m_FileIOLockerObject) + { + SetProgressVisible(true); + StringBuilder fileContents = new StringBuilder((int)fi.Length); + using (StreamReader sr = fi.OpenText()) + { + String input; + while ((input = sr.ReadLine()) != null) + { + fileContents.AppendLine(input); + SetProgressStep(input.Length); + } + input = null; + } + + OSDMap map = (OSDMap)OSDParser.DeserializeLLSDNotation(fileContents.ToString()); + + // Give the GC a little push + fileContents = null; + GC.Collect(0); + GC.WaitForPendingFinalizers(); + + // turn the map into a list + OSDMapToSessions(map); + + SetProgressVisible(false); + } + })); + } + } + + private void OSDMapToSessions(OSDMap map) + { + if (!map.ContainsKey("sessions")) + return; + + if (this.InvokeRequired) + this.Invoke(new MethodInvoker(delegate() { OSDMapToSessions(map); })); + else + { + + OSDArray sessionsArray = (OSDArray)map["sessions"]; + + progressBar1.Maximum = sessionsArray.Count; + progressBar1.Value = 0; + progressBar1.Step = 1; + + panelActionProgress.Visible = true; + + listViewSessions.VirtualListSize = 0; + m_SessionViewItems.Clear(); + + ClearCache(); + + for (int i = 0; i < sessionsArray.Count; i++) + { + OSDMap session = (OSDMap)sessionsArray[i]; + + Session importedSession = (Session)m_CurrentAssembly.CreateInstance("WinGridProxy." + session["type"].AsString()); + importedSession.Deserialize(session["tag"].AsBinary()); + m_SessionViewItems.Add(importedSession); + progressBar1.PerformStep(); + } + + listViewSessions.VirtualListSize = m_SessionViewItems.Count; + + listViewSessions.Invalidate(); + + // resize columns to fit whats currently on screen + listViewSessions.Columns[0].Width = + listViewSessions.Columns[1].Width = + listViewSessions.Columns[2].Width = + listViewSessions.Columns[3].Width = + listViewSessions.Columns[5].Width = -2; + + panelActionProgress.Visible = false; + + map = null; + } + } + + //Generic ListView sort event used by filter listviews only private void listViewFilterSorter_ColumnClick(object sender, ColumnClickEventArgs e) { ListView lv = (ListView)sender; @@ -873,7 +1083,13 @@ namespace WinGridProxy private void exitToolStripMenuItem1_Click(object sender, EventArgs e) { // TODO: warn if client is connected! - + + if (timer1 != null) + timer1.Dispose(); + + if (timerCleanupCache != null) + timerCleanupCache.Dispose(); + this.Close(); } @@ -910,75 +1126,78 @@ namespace WinGridProxy Store.SaveSessionOnExit = saveOptionsOnExitToolStripMenuItem.Checked; Store.AutoCheckNewCaps = autoAddNewDiscoveredMessagesToolStripMenuItem.Checked; - Store.SerializeToFile(fileName); + lock (m_FileIOLockerObject) + { + Store.SerializeToFile(fileName); + } } private void RestoreSavedSettings(string fileName) { // load saved settings from OSD Formatted file - - if (Store.DeserializeFromFile(fileName)) - { - enableStatisticsToolStripMenuItem.Checked = Store.StatisticsEnabled; - saveOptionsOnExitToolStripMenuItem.Checked = Store.SaveSessionOnExit; - autoAddNewDiscoveredMessagesToolStripMenuItem.Checked = Store.AutoCheckNewCaps; - - // Update message filter listview - listViewMessageFilters.BeginUpdate(); - foreach (KeyValuePair kvp in Store.MessageSessions) - { - ListViewItem foundMessage = FindListViewItem(listViewPacketFilters, kvp.Key, false); - if (foundMessage == null) - { - ListViewItem addedItem = listViewMessageFilters.Items.Add( - new ListViewItem(kvp.Key, listViewMessageFilters.Groups[kvp.Value.Group])); - addedItem.Name = kvp.Key; - addedItem.Checked = kvp.Value.Checked; - addedItem.SubItems.Add(kvp.Value.Type); - //addedItem.Group = listViewMessageFilters.Groups[kvp.Value.Group]; - - addedItem.BackColor = (kvp.Value.Type.Equals(PROTO_CAPABILITIES)) ? Color_Cap : Color_Event; - } - else - { - foundMessage.Checked = kvp.Value.Checked; - } - if (kvp.Value.Type.Equals(PROTO_CAPABILITIES)) - { - proxy.AddCapsDelegate(kvp.Key, kvp.Value.Checked); - } - } - listViewMessageFilters.EndUpdate(); - - // updateTreeView packet filter listview - listViewPacketFilters.BeginUpdate(); - foreach (KeyValuePair kvp in Store.PacketSessions) - { - ListViewItem foundPacket = FindListViewItem(listViewPacketFilters, kvp.Key, false); - if (foundPacket == null) - { - ListViewItem addedItem = listViewPacketFilters.Items.Add( - new ListViewItem(kvp.Key, listViewPacketFilters.Groups[kvp.Value.Group])); - - addedItem.Name = kvp.Key; - addedItem.Checked = kvp.Value.Checked; - addedItem.SubItems.Add(kvp.Value.Type); - - addedItem.BackColor = (kvp.Value.Type.Equals(PROTO_AUTHENTICATE)) ? Color_Login : Color_Packet; - } - else - { - foundPacket.Checked = kvp.Value.Checked; - } - if (kvp.Value.Type.Equals(PROTO_PACKETSTRING)) - { - proxy.AddUDPDelegate(PacketTypeFromName(kvp.Key), kvp.Value.Checked); - } - } - listViewPacketFilters.EndUpdate(); + lock (m_FileIOLockerObject) + { + if (!Store.DeserializeFromFile(fileName)) + return; } - } + enableStatisticsToolStripMenuItem.Checked = Store.StatisticsEnabled; + saveOptionsOnExitToolStripMenuItem.Checked = Store.SaveSessionOnExit; + autoAddNewDiscoveredMessagesToolStripMenuItem.Checked = Store.AutoCheckNewCaps; + + // Update message filter listview + listViewMessageFilters.BeginUpdate(); + foreach (KeyValuePair kvp in Store.MessageSessions) + { + ListViewItem foundMessage = FindListViewItem(listViewPacketFilters, kvp.Key, false); + if (foundMessage == null) + { + ListViewItem addedItem = listViewMessageFilters.Items.Add( + new ListViewItem(kvp.Key, listViewMessageFilters.Groups[kvp.Value.Group])); + addedItem.Name = kvp.Key; + addedItem.Checked = kvp.Value.Checked; + addedItem.SubItems.Add(kvp.Value.Type); + + addedItem.BackColor = (kvp.Value.Type.Equals(PROTO_CAPABILITIES)) ? Color_Cap : Color_Event; + } + else + { + foundMessage.Checked = kvp.Value.Checked; + } + if (kvp.Value.Type.Equals(PROTO_CAPABILITIES)) + { + proxy.AddCapsDelegate(kvp.Key, kvp.Value.Checked); + } + } + listViewMessageFilters.EndUpdate(); + + // updateTreeView packet filter listview + listViewPacketFilters.BeginUpdate(); + foreach (KeyValuePair kvp in Store.PacketSessions) + { + ListViewItem foundPacket = FindListViewItem(listViewPacketFilters, kvp.Key, false); + if (foundPacket == null) + { + ListViewItem addedItem = listViewPacketFilters.Items.Add( + new ListViewItem(kvp.Key, listViewPacketFilters.Groups[kvp.Value.Group])); + + addedItem.Name = kvp.Key; + addedItem.Checked = kvp.Value.Checked; + addedItem.SubItems.Add(kvp.Value.Type); + + addedItem.BackColor = (kvp.Value.Type.Equals(PROTO_AUTHENTICATE)) ? Color_Login : Color_Packet; + } + else + { + foundPacket.Checked = kvp.Value.Checked; + } + if (kvp.Value.Type.Equals(PROTO_PACKETSTRING)) + { + proxy.AddUDPDelegate(PacketTypeFromName(kvp.Key), kvp.Value.Checked); + } + } + listViewPacketFilters.EndUpdate(); + } private void InitProxyFilters() { @@ -992,7 +1211,7 @@ namespace WinGridProxy { ListViewItem addedItem = listViewPacketFilters.Items.Add(new ListViewItem(name, listViewPacketFilters.Groups["Packets"])); addedItem.Name = name; - addedItem.SubItems.Add(PROTO_PACKETSTRING); + addedItem.SubItems.Add(PROTO_PACKETSTRING); } } @@ -1015,7 +1234,7 @@ namespace WinGridProxy } listViewPacketFilters.EndUpdate(); - + } private static PacketType PacketTypeFromName(string name) @@ -1034,124 +1253,69 @@ namespace WinGridProxy { if (this.InvokeRequired) { - this.BeginInvoke(new MethodInvoker(delegate() - { - SearchSessions(opts); - })); + this.BeginInvoke(new MethodInvoker(() => SearchSessions(opts))); } else { int resultCount = 0; + progressBar1.Step = 1;// m_SessionViewItems.Count / 100 / 100; + progressBar1.Maximum = m_SessionViewItems.Count; + progressBar1.Value = 0; + panelActionProgress.Visible = true; - foreach (ListViewItem item in listViewSessions.Items) + lock (m_SessionViewItems) { - if (opts.UnMarkPrevious) - item.BackColor = Color.White; - - if (opts.SearchSelected && !item.Selected) + for (int i = 0; i < m_SessionViewItems.Count; i++) { - continue; - } + Session session = m_SessionViewItems[i]; - if ( + if (opts.UnMarkPrevious) + session.BackColor = Color.White; + + if (opts.SearchSelected && !session.Selected) + continue; + + if ( (opts.MatchCase - && (item.SubItems[2].Text.Contains(opts.SearchText) - /*|| TagToString(item.Tag, item.SubItems[2].Text).Contains(opts.SearchText)*/) + && (session.Name.Contains(opts.SearchText) + || session.ToPrettyString(session.Direction).Contains(opts.SearchText)) ) // no case matching - || ((item.SubItems[2].Text.ToLower().Contains(opts.SearchText.ToLower()) - /*|| TagToString(item.Tag, item.SubItems[2].Text).ToLower().Contains(opts.SearchText.ToLower())*/ + || ((session.Name.ToLower().Contains(opts.SearchText.ToLower()) + || session.ToPrettyString(session.Direction).ToLower().Contains(opts.SearchText.ToLower()) )) ) - { - resultCount++; + { + if (opts.MarkMatches) + session.BackColor = opts.HighlightMatchColor; - if (opts.MarkMatches) - item.BackColor = opts.HighlightMatchColor; + if (opts.SelectResults) + session.Selected = true; + else + session.Selected = false; - if (opts.SelectResults) - item.Selected = true; - else - item.Selected = false; + resultCount++; + } + progressBar1.PerformStep(); } } - - //toolStripMainLabel.Text = String.Format("Search found {0} Matches", resultCount); + ClearCache(); + listViewSessions.Invalidate(); + panelActionProgress.Visible = false; + toolStripLowerStatusLabel.Text = String.Format("Searched {0} session{2} and found {1} matche{2}", m_SessionViewItems.Count, resultCount, + (resultCount != 1) ? "s" : ""); } } - //private string TagToString(object tag, string key) - //{ - // if (tag is XmlRpcRequest) - // { - // XmlRpcRequest requestData = (XmlRpcRequest)tag; - // return requestData.ToString(); - // } - // else if (tag is XmlRpcResponse) - // { - // XmlRpcResponse responseData = (XmlRpcResponse)tag; - - // return responseData.ToString(); - // } - // else if (tag is Packet) - // { - // Packet packet = (Packet)tag; - // return PacketDecoder.PacketToString(packet); - // //return DecodePacket.PacketToString(packet); - // } - // else if (tag is CapsRequest) - // { - // CapsRequest capsData = (CapsRequest)tag; - - // if (capsData.Request != null) - // { - // return capsData.Request.ToString(); - // } - - // if (capsData.Response != null) - // { - // return capsData.Response.ToString(); - // } - // return "Unable to decode CapsRequest"; - // } - // else if (tag is OSD) - // { - // OSD osd = (OSD)tag; - // if (osd.Type == OSDType.Map) - // { - // OSDMap data = (OSDMap)osd; - // IMessage message; - // if (data.ContainsKey("body")) - // message = OpenMetaverse.Messages.MessageUtils.DecodeEvent(key, (OSDMap)data["body"]); - // else - // message = OpenMetaverse.Messages.MessageUtils.DecodeEvent(key, data); - - // if (message != null) - // return IMessageToString(message, 0); - // else - // return "No Decoder for " + key + System.Environment.NewLine - // + osd.ToString(); - // } - // else - // { - // return osd.ToString(); - // } - // } - // else - // { - // return "Could not decode object type: " + tag.GetType().ToString(); - // } - //} - #endregion #region XML Tree private void updateTreeView(string xml, TreeView treeView) { + treeView.BeginUpdate(); try { treeView.Nodes.Clear(); - XmlDocument tmpxmldoc = new XmlDocument(); tmpxmldoc.LoadXml(xml); FillTree(tmpxmldoc.DocumentElement, treeView.Nodes); @@ -1159,7 +1323,11 @@ namespace WinGridProxy } catch (Exception ex) { - Console.WriteLine("Error during xml conversion:" + ex.Message); + Logger.Log("Error during XML conversion", Helpers.LogLevel.Error, ex); + } + finally + { + treeView.EndUpdate(); } } @@ -1217,104 +1385,122 @@ namespace WinGridProxy { if (this.InvokeRequired) { - this.BeginInvoke(new MethodInvoker(delegate() - { - timer1_Tick(sender, e); - })); + this.BeginInvoke(new MethodInvoker(() => timer1_Tick(sender, e))); } else { - label1PacketsOut.Text = String.Format("{0} ({1} bytes)", PacketsOutCounter, PacketsOutBytes); - labelPacketsIn.Text = String.Format("{0} ({1} bytes)", PacketsInCounter, PacketsInBytes); - labelPacketsTotal.Text = String.Format("{0} ({1} bytes)", PacketsOutCounter + PacketsInCounter, PacketsOutBytes + PacketsInBytes); + label1PacketsOut.Text = String.Format("{0} ({1})", PacketsOutCounter, FormatBytes(PacketsOutBytes)); + labelPacketsIn.Text = String.Format("{0} ({1})", PacketsInCounter, FormatBytes(PacketsInBytes)); + labelPacketsTotal.Text = String.Format("{0} ({1})", PacketsOutCounter + PacketsInCounter, FormatBytes(PacketsOutBytes + PacketsInBytes)); + + labelCapsIn.Text = String.Format("{0} ({1})", CapsInCounter, FormatBytes(CapsInBytes)); + labelCapsOut.Text = String.Format("{0} ({1})", CapsOutCounter, FormatBytes(CapsOutBytes)); + labelCapsTotal.Text = String.Format("{0} ({1})", CapsInCounter + CapsOutCounter, FormatBytes(CapsOutBytes + CapsInBytes)); + + // pause during scroll + if (m_AllowUpdate) + UpdateVirtualListSize(m_SessionViewItems.Count); - labelCapsIn.Text = String.Format("{0} ({1} bytes)", CapsInCounter, CapsInBytes); - labelCapsOut.Text = String.Format("{0} ({1} bytes)", CapsOutCounter, CapsOutBytes); - labelCapsTotal.Text = String.Format("{0} ({1} bytes)", CapsInCounter + CapsOutCounter, CapsOutBytes + CapsInBytes); } } + private void timerExpireCache_Tick(object sender, EventArgs e) + { + int expired = 0; + lock (m_SessionViewCache) + { + int[] keys = new int[m_SessionViewCache.Keys.Count]; + m_SessionViewCache.Keys.CopyTo(keys, 0); + + foreach (int key in keys) + { + long expires = 0; + if (long.TryParse(m_SessionViewCache[key].Name, out expires)) + { + if (expires > 0 && expires <= DateTime.UtcNow.ToLocalTime().Ticks) + { + expired++; + m_SessionViewCache.Remove(key); + } + } + } + } + } #endregion private void EditToolStripButton_DropDownOpening(object sender, EventArgs e) { - if (listViewSessions.Items.Count > 0) + lock (m_SessionViewItems) { - toolStripMenuSessionsRemove.Enabled = - removeToolStripMenuItem2.Enabled = - selectToolStripMenuItem1.Enabled = - saveSessionArchiveToolStripMenuItem.Enabled = - toolStripMenuItemRemoveAll.Enabled = true; - - if (listViewSessions.SelectedItems.Count < listViewSessions.Items.Count) + if (m_SessionViewItems.Count > 0) { - toolStripMenuItemRemoveUnselected.Enabled = true; + toolStripMenuSessionsRemove.Enabled = + removeToolStripMenuItem2.Enabled = + selectToolStripMenuItem1.Enabled = + saveSessionArchiveToolStripMenuItem.Enabled = + toolStripMenuItemRemoveAll.Enabled = true; + + if (listViewSessions.SelectedIndices.Count > 0) + { + toolStripMenuItemRemoveUnselected.Enabled = + markToolStripMenuItem1.Enabled = + toolStripSeparatorSelectPacketProto.Visible = + toolStripMenuItemSelectPacketName.Visible = + noneToolStripMenuItem2.Enabled = + copyToolStripMenuItem1.Enabled = + toolStripMenuItemRemoveSelected.Enabled = true; + } + else + { + toolStripMenuItemRemoveUnselected.Enabled = + markToolStripMenuItem1.Enabled = + toolStripSeparatorSelectPacketProto.Visible = + toolStripMenuItemSelectPacketName.Visible = + noneToolStripMenuItem2.Enabled = + noneToolStripMenuItem2.Enabled = + copyToolStripMenuItem1.Enabled = + toolStripMenuItemRemoveSelected.Enabled = false; + } + + //if (listViewSessions.SelectedIndices.Count > 0 + // && listViewSessions.SelectedItems.Count != listViewSessions.Items.Count) + //{ + // toolStripMenuItemRemoveUnselected.Enabled = + // invertToolStripMenuItem1.Enabled = + // noneToolStripMenuItem2.Enabled = true; + //} + //else + //{ + // toolStripMenuItemRemoveUnselected.Enabled = + // invertToolStripMenuItem1.Enabled = + // noneToolStripMenuItem2.Enabled = false; + //} + } else { - toolStripMenuItemRemoveUnselected.Enabled = false; - } - - if (listViewSessions.SelectedItems.Count > 0) - { - markToolStripMenuItem1.Enabled = + toolStripMenuSessionsRemove.Enabled = toolStripSeparatorSelectPacketProto.Visible = toolStripMenuItemSelectPacketName.Visible = - noneToolStripMenuItem2.Enabled = + findToolStripMenuItem.Enabled = + selectToolStripMenuItem1.Enabled = + removeToolStripMenuItem2.Enabled = + toolStripMenuItemRemoveUnselected.Enabled = copyToolStripMenuItem1.Enabled = - toolStripMenuItemRemoveSelected.Enabled = true; - } - else - { markToolStripMenuItem1.Enabled = - toolStripSeparatorSelectPacketProto.Visible = - toolStripMenuItemSelectPacketName.Visible = - noneToolStripMenuItem2.Enabled = - noneToolStripMenuItem2.Enabled = - copyToolStripMenuItem1.Enabled = - toolStripMenuItemRemoveSelected.Enabled = false; + saveSessionArchiveToolStripMenuItem.Enabled = + toolStripMenuItemRemoveAll.Enabled = false; } - if (listViewSessions.SelectedItems.Count > 0 - && listViewSessions.SelectedItems.Count != listViewSessions.Items.Count) + if (listViewPacketFilters.Items.Count + m_SessionViewItems.Count > 0) { - toolStripMenuItemRemoveUnselected.Enabled = - invertToolStripMenuItem1.Enabled = - noneToolStripMenuItem2.Enabled = true; + saveFilterSelectionsToolStripMenuItem.Enabled = true; } else { - toolStripMenuItemRemoveUnselected.Enabled = - invertToolStripMenuItem1.Enabled = - noneToolStripMenuItem2.Enabled = false; + saveFilterSelectionsToolStripMenuItem.Enabled = false; } - } - else - { - toolStripMenuSessionsRemove.Enabled = - toolStripSeparatorSelectPacketProto.Visible = - // toolStripMenuItemSelectProtocol.Visible = - toolStripMenuItemSelectPacketName.Visible = - findToolStripMenuItem.Enabled = - selectToolStripMenuItem1.Enabled = - removeToolStripMenuItem2.Enabled = - toolStripMenuItemRemoveUnselected.Enabled = - copyToolStripMenuItem1.Enabled = - markToolStripMenuItem1.Enabled = - saveSessionArchiveToolStripMenuItem.Enabled = - toolStripMenuItemRemoveAll.Enabled = false; - } - - if (listViewPacketFilters.Items.Count + listViewSessions.Items.Count > 0) - { - saveFilterSelectionsToolStripMenuItem.Enabled = true; - } - else - { - saveFilterSelectionsToolStripMenuItem.Enabled = false; - } - } private void autoColorizeToolStripMenuItem_Click(object sender, EventArgs e) @@ -1340,10 +1526,7 @@ namespace WinGridProxy if (InvokeRequired) { - BeginInvoke(new MethodInvoker(delegate() - { - Instance_MessageLoggedEvent(sender, e); - })); + BeginInvoke(new MethodInvoker(() => Instance_MessageLoggedEvent(sender, e))); } else { @@ -1392,53 +1575,6 @@ namespace WinGridProxy } } - private void SessionQueueWorker(object sender) - { - if (InvokeRequired) - { - BeginInvoke(new MethodInvoker(() => SessionQueueWorker(sender))); - return; - } - - lock (QueuedSessions) - { - if (QueuedSessions.Count > 0) - { - listViewSessions.BeginUpdate(); - listViewSessions.Items.AddRange(QueuedSessions.ToArray()); - listViewSessions.EndUpdate(); - QueuedSessions.Clear(); - } - } - } - - private void DirectAddSession(ListViewItem item) - { - if (InvokeRequired) - { - BeginInvoke(new MethodInvoker(() => DirectAddSession(item))); - } - else - { - listViewSessions.Items.Add(item); - } - } - - private void AddSession(ListViewItem item) - { - if (!monoRuntime) - { - DirectAddSession(item); - } - else - { - lock (QueuedSessions) - { - QueuedSessions.Add(item); - } - } - } - private void asDecodedTextToolStripMenuItem_Click(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == DialogResult.OK) @@ -1479,41 +1615,13 @@ namespace WinGridProxy { SaveAllSettings("settings.osd"); } - // Column sorter - private void listViewSessions_ColumnClick(object sender, ColumnClickEventArgs e) - { - ListView listView1 = (ListView)sender; - ListViewSorter Sorter = new ListViewSorter(); - listView1.ListViewItemSorter = Sorter; - if (!(listView1.ListViewItemSorter is ListViewSorter)) - return; - - Sorter = (ListViewSorter)listView1.ListViewItemSorter; - - if (Sorter.LastSort == e.Column) - { - if (listView1.Sorting == SortOrder.Ascending) - listView1.Sorting = SortOrder.Descending; - else - listView1.Sorting = SortOrder.Ascending; - } - else - { - listView1.Sorting = SortOrder.Descending; - } - Sorter.ByColumn = e.Column; - - listView1.Sort(); - - listView1.Columns[e.Column].Width = -2;// = listView1.Columns[e.Column].Text + " " + '\u23BC'; - } private void buttonSaveRequestHex_Click(object sender, EventArgs e) { if (hexBoxRequest.ByteProvider != null && hexBoxRequest.ByteProvider.Length > 0) { - saveFileDialog3.FileName = listViewSessions.SelectedItems[0].Name; + saveFileDialog3.FileName = m_CurrentSession.Name; if (saveFileDialog3.ShowDialog() == DialogResult.OK) { byte[] bytes = new byte[hexBoxRequest.ByteProvider.Length]; @@ -1524,17 +1632,13 @@ namespace WinGridProxy File.WriteAllBytes(saveFileDialog3.FileName, bytes); } } - else - { - // no bytes to read! - } } private void buttonExportRawHex_Click(object sender, EventArgs e) { if (hexBoxResponse.ByteProvider != null && hexBoxResponse.ByteProvider.Length > 0) { - saveFileDialog3.FileName = listViewSessions.SelectedItems[0].Name; + saveFileDialog3.FileName = m_CurrentSession.Name; if (saveFileDialog3.ShowDialog() == DialogResult.OK) { byte[] bytes = new byte[hexBoxResponse.ByteProvider.Length]; @@ -1545,76 +1649,245 @@ namespace WinGridProxy File.WriteAllBytes(saveFileDialog3.FileName, bytes); } } + } + + + /// + /// Column Sorting + /// + private void listViewSessions_ColumnClick(object sender, ColumnClickEventArgs e) + { + if (m_ListViewSortOrder == SortOrder.Ascending) + m_ListViewSortOrder = SortOrder.Descending; else - { - // no bytes to read! - } - } - } + m_ListViewSortOrder = SortOrder.Ascending; - public class ListViewSorter : System.Collections.IComparer - { - public int Compare(object o1, object o2) + string name = ((ListView)sender).Columns[e.Column].Text; + lock (m_SessionViewItems) + { + switch (name) + { + case "#": + if (m_ListViewSortOrder == SortOrder.Ascending) + m_SessionViewItems.Sort((x, y) => x.TimeStamp.CompareTo(y.TimeStamp)); + else + m_SessionViewItems.Sort((x, y) => y.TimeStamp.CompareTo(x.TimeStamp)); + break; + case "Protocol": + if (m_ListViewSortOrder == SortOrder.Ascending) + m_SessionViewItems.Sort((x, y) => x.Protocol.CompareTo(y.Protocol)); + else + m_SessionViewItems.Sort((x, y) => y.Protocol.CompareTo(x.Protocol)); + break; + case "Name": + if (m_ListViewSortOrder == SortOrder.Ascending) + m_SessionViewItems.Sort((x, y) => x.Name.CompareTo(y.Name)); + else + m_SessionViewItems.Sort((x, y) => y.Name.CompareTo(x.Name)); + break; + case "Bytes": + if (m_ListViewSortOrder == SortOrder.Ascending) + m_SessionViewItems.Sort((x, y) => x.Length.CompareTo(y.Length)); + else + m_SessionViewItems.Sort((x, y) => y.Length.CompareTo(x.Length)); + break; + case "Host": + if (m_ListViewSortOrder == SortOrder.Ascending) + m_SessionViewItems.Sort((x, y) => x.Host.CompareTo(y.Host)); + else + m_SessionViewItems.Sort((x, y) => y.Host.CompareTo(x.Host)); + break; + case "Content Type": + if (m_ListViewSortOrder == SortOrder.Ascending) + m_SessionViewItems.Sort((x, y) => x.ContentType.CompareTo(y.ContentType)); + else + m_SessionViewItems.Sort((x, y) => y.ContentType.CompareTo(x.ContentType)); + break; + } + } + + ClearCache(); + listViewSessions.Invalidate(); + ((ListView)sender).Columns[e.Column].Width = -2; + } + + /// + /// Retrieve an item for display in the listview, first trying the cache + /// + private void listViewSessions_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { - if (!(o1 is ListViewItem)) - return 0; - if (!(o2 is ListViewItem)) - return 0; - - int result; - - ListViewItem lvi1 = (ListViewItem)o2; - ListViewItem lvi2 = (ListViewItem)o1; - - if (lvi1.ListView.Columns[ByColumn].Tag == null - || lvi1.ListView.Columns[ByColumn].Tag == null) + lock (m_SessionViewCache) { - return 0; - } - - if (lvi1.ListView.Columns[ByColumn].Tag.ToString().ToLower().Equals("number")) - { - float fl1 = float.Parse(lvi1.SubItems[ByColumn].Text); - float fl2 = float.Parse(lvi2.SubItems[ByColumn].Text); - - if (lvi1.ListView.Sorting == SortOrder.Ascending) - result = fl1.CompareTo(fl2); + if (m_SessionViewCache.ContainsKey(e.ItemIndex)) + { + e.Item = m_SessionViewCache[e.ItemIndex]; + } else - result = fl2.CompareTo(fl1); + { + e.Item = GenerateListViewItem(e.ItemIndex); + m_SessionViewCache.Add(e.ItemIndex, e.Item); + } } - else if (lvi1.ListView.Columns[ByColumn].Tag.ToString().ToLower().Equals("string")) - { - string str1 = lvi1.SubItems[ByColumn].Text; - string str2 = lvi2.SubItems[ByColumn].Text; + } - if (lvi1.ListView.Sorting == SortOrder.Ascending) - result = String.Compare(str1, str2); + private ListViewItem GenerateListViewItem(int index) + { + Session sessionItem = null; + lock (m_SessionViewItems) + { + sessionItem = m_SessionViewItems[index]; + } + + ListViewItem sessionViewItem = new ListViewItem(new string[] { sessionItem.TimeStamp.ToLocalTime().ToString("hh:m:s.fff")/*index.ToString()*/, sessionItem.Protocol, sessionItem.Name, + sessionItem.Length.ToString(), sessionItem.Host, sessionItem.ContentType }); + + sessionViewItem.Checked = sessionItem.Selected; + sessionViewItem.Tag = sessionItem; + sessionViewItem.ImageIndex = (int)sessionItem.Direction; + + sessionViewItem.BackColor = sessionItem.BackColor; + + if (sessionItem is SessionPacket && Int32.Parse(sessionViewItem.SubItems[3].Text) > 1400) + { + sessionViewItem.UseItemStyleForSubItems = false; + sessionViewItem.SubItems[3].ForeColor = Color.Red; + } + + // this is used for expiring the cache + sessionViewItem.Name = DateTime.UtcNow.ToLocalTime().AddMinutes(1).Ticks.ToString(); + + return sessionViewItem; + } + + private void listViewSessions_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e) + { + int end = (e.EndIndex + 2 <= m_SessionViewItems.Count) ? e.EndIndex + 2 : m_SessionViewItems.Count; + + lock (m_SessionViewItems) + { + for (int i = e.StartIndex; i < end; i++) + { + m_SessionViewItems[i].Selected = e.IsSelected; + } + } + + ClearCache(); + listViewSessions.Invalidate(); + } + + private void listViewSessions_CacheVirtualItems(object sender, CacheVirtualItemsEventArgs e) + { + for (int i = e.StartIndex; i < e.EndIndex + 1; i++) + { + lock (m_SessionViewCache) + { + if (!m_SessionViewCache.ContainsKey(i)) + m_SessionViewCache.Add(i, GenerateListViewItem(i)); + } + } + } + + private void listViewSessions_SelectedIndexChanged(object sender, EventArgs e) + { + if (listViewSessions.SelectedIndices.Count == 1) + { + // update the context menus + contextMenuStripSessions_Opening(sender, null); + + tabControlMain.SelectTab("tabPageInspect"); + + int index = listViewSessions.SelectedIndices[0]; + + object tag = null; + if (m_SessionViewCache.ContainsKey(index)) + tag = m_SessionViewCache[index].Tag; else - result = String.Compare(str2, str1); + tag = GenerateListViewItem(listViewSessions.SelectedIndices[0]).Tag; //e.Item.Tag; + + if (tag is Session) + { + Session session = (Session)tag; + + this.m_CurrentSession = session; + + treeViewXmlResponse.Nodes.Clear(); + treeViewXMLRequest.Nodes.Clear(); + + Be.Windows.Forms.DynamicByteProvider responseBytes = new Be.Windows.Forms.DynamicByteProvider(session.ToBytes(Direction.Incoming)); + richTextBoxDecodedResponse.Text = session.ToPrettyString(Direction.Incoming); + richTextBoxRawResponse.Text = session.ToRawString(Direction.Incoming); + richTextBoxNotationResponse.Text = session.ToStringNotation(Direction.Incoming); + hexBoxResponse.ByteProvider = responseBytes; + updateTreeView(session.ToXml(Direction.Incoming), treeViewXmlResponse); + + Be.Windows.Forms.DynamicByteProvider requestBytes = new Be.Windows.Forms.DynamicByteProvider(session.ToBytes(Direction.Outgoing)); + richTextBoxDecodedRequest.Text = session.ToPrettyString(Direction.Outgoing); + richTextBoxRawRequest.Text = session.ToRawString(Direction.Outgoing); + richTextBoxNotationRequest.Text = session.ToStringNotation(Direction.Outgoing); + hexBoxRequest.ByteProvider = requestBytes; + updateTreeView(session.ToXml(Direction.Outgoing), treeViewXMLRequest); + + RequestPosition_Changed(this, EventArgs.Empty); + ReplyPosition_Changed(this, EventArgs.Empty); + } + else + { + richTextBoxDecodedResponse.Text = "Unknown data object encountered: " + tag.GetType().ToString(); + } } - else + } + + private void toolStripButtonLaunchViewer_Click(object sender, EventArgs e) + { + System.Diagnostics.Process.Start(String.Format("{0}", m_InstalledViewers[toolStripComboBox1.Text]), String.Format("--set InstallLanguage en -multiple -loginuri http://{0}:{1}", comboBoxListenAddress.Text, textBoxProxyPort)); + } + + private void listViewSessions_Scrolling(object sender, ScrollingEventArgs e) + { + m_AllowUpdate = !e.Scrolling; + if (!e.Scrolling) { - return 0; + listViewSessions.TopItem.Focused = true; } - - LastSort = ByColumn; - - return (result); } - - public int ByColumn + private void comboBoxLoginURL_Leave(object sender, EventArgs e) + { + if (!String.IsNullOrEmpty(comboBoxLoginURL.Text)) + { + if (m_DefaultGridLoginServers.Contains(comboBoxLoginURL.Text)) + { + // make the selection the default for next time + m_DefaultGridLoginServers.Remove(comboBoxLoginURL.Text); + } + m_DefaultGridLoginServers.Insert(0, comboBoxLoginURL.Text); + + File.WriteAllLines("gridservers.ini", m_DefaultGridLoginServers.ToArray()); + } + } + + private void documentationToolStripMenuItem_Click(object sender, EventArgs e) + { + System.Diagnostics.Process.Start("http://lib.openmetaverse.org/wiki/WinGridProxy"); + } + + #region Inject Tab + // Enable Inject button if box contains text + private void richTextBoxInject_TextChanged(object sender, EventArgs e) + { + toolStripButtonInject.Enabled = (richTextBoxInject.TextLength > 0); + } + + private void toolStripButtonInject_Click(object sender, EventArgs e) + { + proxy.InjectPacket(richTextBoxInject.Text, true); + } + + #endregion Inject Tab + + private void listViewSessions_SearchForVirtualItem(object sender, SearchForVirtualItemEventArgs e) { - get { return Column; } - set { Column = value; } - } - int Column = 0; - public int LastSort - { - get { return LastColumn; } - set { LastColumn = value; } } - int LastColumn = 0; } } diff --git a/Programs/WinGridProxy/FormWinGridProxy.resx b/Programs/WinGridProxy/FormWinGridProxy.resx index aee6fff3..fbe1bdee 100644 --- a/Programs/WinGridProxy/FormWinGridProxy.resx +++ b/Programs/WinGridProxy/FormWinGridProxy.resx @@ -118,10 +118,19 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 555, 17 + 567, 0 + + + 17, 39 + + + 1116, 0 + + + 762, 0 - 309, 17 + 321, 0 @@ -173,19 +182,7 @@ - 339, 56 - - - 17, 56 - - - 1104, 17 - - - 750, 17 - - - 339, 56 + 339, 39 @@ -234,6 +231,24 @@ dvl0uhZQ1eqX8aVc7EKLqrum651ATLf9OJx5XQM4KmY0xPzZ0hFAiQJnXB0WwME0E3IsL5B17ZlADqWb NYDrOepdlcysmTWWOrxqbceRWtaLk0VO1XW72D5Vckd2gMBfq8zdpmUG62NJvKM4+XyziDk24xmfWoGE s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC + + + + 352, 78 + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAgxJREFUOE+lkvtL + U2EYx+0PEbtpFwnBKPGKiJImGP0gYhIYs1E5GF5gIxkpA00JRSmMEF0ohMh+GaRWYlqabMVcNdS2QpaI + VqiDIYhk397vA6fXhCjyhYdzeM/5fp7vczkAdeL2cwho7v/wWzT1zcN+Pwhr51uY2/y41PQaF+wzKKiZ + QvaN58g0jyLd5KEUcQbg+84P/Cm2tncQjW3j68YWIqubCC3FcOJc478BAuGoZM6zvoRnakXEruEIjhc4 + /g5gZop9c+voGAyLbQIfeBZxLL9BA1jzXvuGbWamuKh+GmmVbswE19A59FEBbmoAG7YbsLtm2mZmiml9 + cvabNDwpz6YB7LYBoMXCumkJr7LOmnnHzBQ/9X2Bo2cOibm1GsBREbAQiYmw/8lnuCeWkVzcgnZlnw1j + 3HV/wuNXK6i/9x5Hc6wawDlTXHbLJ+LZUBQPRyKwdQdxutwl1h+NLXHh5Ht1ewBHsiwawCW57HyDAfWR + dvl0uhZQ1eqX8aVc7EKLqrum651ATLf9OJx5XQM4KmY0xPzZ0hFAiQJnXB0WwME0E3IsL5B17ZlADqWb + NYDrOepdlcysmTWWOrxqbceRWtaLk0VO1XW72D5Vckd2gMBfq8zdpmUG62NJvKM4+XyziDk24xmfWoGE + s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC @@ -254,6 +269,9 @@ s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC + + 939, 0 + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 @@ -271,11 +289,8 @@ AAAAAElFTkSuQmCC - - 927, 17 - - 226, 17 + 234, 0 @@ -323,27 +338,54 @@ - 470, 56 + 470, 39 - 606, 56 + 606, 39 - 746, 56 + 746, 39 - 882, 56 + 882, 39 - 17, 95 + 17, 78 - 1022, 56 + 1022, 39 + + + 236, 78 - 210, 56 + 210, 39 + + 236, 58 + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAgxJREFUOE+lkvtL + U2EYx+0PEbtpFwnBKPGKiJImGP0gYhIYs1E5GF5gIxkpA00JRSmMEF0ohMh+GaRWYlqabMVcNdS2QpaI + VqiDIYhk397vA6fXhCjyhYdzeM/5fp7vczkAdeL2cwho7v/wWzT1zcN+Pwhr51uY2/y41PQaF+wzKKiZ + QvaN58g0jyLd5KEUcQbg+84P/Cm2tncQjW3j68YWIqubCC3FcOJc478BAuGoZM6zvoRnakXEruEIjhc4 + /g5gZop9c+voGAyLbQIfeBZxLL9BA1jzXvuGbWamuKh+GmmVbswE19A59FEBbmoAG7YbsLtm2mZmiml9 + cvabNDwpz6YB7LYBoMXCumkJr7LOmnnHzBQ/9X2Bo2cOibm1GsBREbAQiYmw/8lnuCeWkVzcgnZlnw1j + 3HV/wuNXK6i/9x5Hc6wawDlTXHbLJ+LZUBQPRyKwdQdxutwl1h+NLXHh5Ht1ewBHsiwawCW57HyDAfWR + dvl0uhZQ1eqX8aVc7EKLqrum651ATLf9OJx5XQM4KmY0xPzZ0hFAiQJnXB0WwME0E3IsL5B17ZlADqWb + NYDrOepdlcysmTWWOrxqbceRWtaLk0VO1XW72D5Vckd2gMBfq8zdpmUG62NJvKM4+XyziDk24xmfWoGE + s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC + + - 419, 17 + 431, 0 + + + 147, 0 + + + 25 \ No newline at end of file diff --git a/Programs/WinGridProxy/ListViewNoFlicker.cs b/Programs/WinGridProxy/ListViewNoFlicker.cs index 41265095..3aa5a498 100644 --- a/Programs/WinGridProxy/ListViewNoFlicker.cs +++ b/Programs/WinGridProxy/ListViewNoFlicker.cs @@ -27,32 +27,75 @@ using System; using System.Collections.Generic; using System.Text; +using System.ComponentModel; using System.Windows.Forms; namespace WinGridProxy { - class ListViewNoFlicker : ListView + internal class ListViewNoFlicker : ListView { public ListViewNoFlicker() - { - - //Activate double buffering - this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); + { + this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); + this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); //Enable the OnNotifyMessage event so we get a chance to filter out // Windows messages before they get to the form's WndProc - this.SetStyle(ControlStyles.EnableNotifyMessage, true); + this.SetStyle(ControlStyles.EnableNotifyMessage, true); } - + protected override void OnNotifyMessage(Message m) - { + { + //private const UInt32 WM_VSCROLL = 0x0115; + if (m.Msg == 0x0115) + { + if (m.WParam.ToInt32().Equals(8)) + { + // Scrollbar scrolling stopped + OnScrolling(new ScrollingEventArgs(false)); + } + else + { + // Scroll starting + OnScrolling(new ScrollingEventArgs(true)); + } + } + + //Filter out the WM_ERASEBKGND message if (m.Msg != 0x14) { base.OnNotifyMessage(m); - } + } + } + + private EventHandler m_Scrolling; + private void OnScrolling(ScrollingEventArgs e) + { + EventHandler handler = m_Scrolling; + if (handler != null) + handler(this, e); } + private readonly object m_ScrollingLock = new object(); + + [Description("Occurs, when the listview scrolling starts and stops")] + public event EventHandler Scrolling + { + add { lock (m_ScrollingLock) { m_Scrolling += value; } } + remove { lock (m_ScrollingLock) { m_Scrolling -= value; } } + } + } + + public class ScrollingEventArgs : EventArgs + { + private bool m_Scrolling; + public bool Scrolling { get { return m_Scrolling; } set { this.m_Scrolling = value; } } + + public ScrollingEventArgs(bool scrolling) + { + this.m_Scrolling = scrolling; + } } public class ListViewItemComparer : IComparer diff --git a/Programs/WinGridProxy/Properties/AssemblyInfo.cs b/Programs/WinGridProxy/Properties/AssemblyInfo.cs index 4d3a709a..c8b16c0d 100644 --- a/Programs/WinGridProxy/Properties/AssemblyInfo.cs +++ b/Programs/WinGridProxy/Properties/AssemblyInfo.cs @@ -6,7 +6,7 @@ using System.Runtime.InteropServices; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("WinGridProxy")] -[assembly: AssemblyDescription("Proxy and Packet Analyzer")] +[assembly: AssemblyDescription("Proxy server and packet analyzer")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("OpenMetaverse")] [assembly: AssemblyProduct("WinGridProxy")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyVersion("0.8.0.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Programs/WinGridProxy/ProxyManager.cs b/Programs/WinGridProxy/ProxyManager.cs index ae87145d..a1039d92 100644 --- a/Programs/WinGridProxy/ProxyManager.cs +++ b/Programs/WinGridProxy/ProxyManager.cs @@ -128,10 +128,10 @@ namespace WinGridProxy OnCapabilityAdded((CapInfo)de.Value); } - private void LoginRequest(XmlRpcRequest request) + private void LoginRequest(object sender, XmlRpcRequestEventArgs e) { if (OnLoginResponse != null) - OnLoginResponse(request, Direction.Outgoing); + OnLoginResponse(e.m_Request, Direction.Outgoing); } private void LoginResponse(XmlRpcResponse response) diff --git a/Programs/WinGridProxy/SessionTypes.cs b/Programs/WinGridProxy/SessionTypes.cs index 20e5dc29..b05568c8 100644 --- a/Programs/WinGridProxy/SessionTypes.cs +++ b/Programs/WinGridProxy/SessionTypes.cs @@ -40,20 +40,25 @@ namespace WinGridProxy #region Base Class internal abstract class Session { - private const string EmptyXml = "XML representation of this item is not available."; - private const string EmptyString = "String representation of this item is not available."; - private const string EmptyNotation = "Notation representation of this item is not available."; + internal const string EmptyXml = "XML representation of this item is not available."; + internal const string EmptyString = "String representation of this item is not available."; + internal const string EmptyNotation = "Notation representation of this item is not available."; public Direction Direction { get; set; } public String Host { get; set; } public String Protocol { get; set; } public String Name { get; set; } public String ContentType { get; set; } - public int Length { get; set; } + public DateTime TimeStamp { get; set; } + + // listview specific stuff, not serialized or deserialized + public bool Selected { get; set; } + public System.Drawing.Color BackColor { get; set; } public Session() { + this.TimeStamp = DateTime.UtcNow; this.Host = this.Protocol = this.Name = String.Empty; this.Length = 0; this.ContentType = String.Empty; @@ -167,8 +172,42 @@ namespace WinGridProxy this.Length = packetData.Length; int packetEnd = packetData.Length - 1; - this.Packet = Packet.BuildPacket(packetData, ref packetEnd, null); - this.Name = this.Packet.Type.ToString(); + + try + { + bool msg_zer = ((packetData[0] & Helpers.MSG_ZEROCODED) != 0); + bool msg_res = ((packetData[0] & Helpers.MSG_RESENT) != 0); + bool msg_rel = ((packetData[0] & Helpers.MSG_RELIABLE) != 0); + bool msg_ack = ((packetData[0] & Helpers.MSG_APPENDED_ACKS) != 0); + + if ((packetData[0] & Helpers.MSG_ZEROCODED) != 0) + { + packetData[0] = 0x00; + } + + this.Packet = Packet.BuildPacket(packetData, ref packetEnd, null); + + this.Packet.Header.Resent = msg_res; + this.Packet.Header.Reliable = msg_rel; + this.Packet.Header.Zerocoded = msg_zer; + this.Packet.Header.AppendedAcks = msg_ack; + + this.Name = this.Packet.Type.ToString(); + } + catch (IndexOutOfRangeException ex) + { + this.Name = ex.Message; + } + catch (MalformedDataException ex) + { + this.Name = ex.Message; + //throw; + } + catch (NullReferenceException ex) + { + this.Name = ex.Message; + } + return this; } } @@ -188,8 +227,15 @@ namespace WinGridProxy Direction direction, string uri, string capsKey, String proto) : base() { - this.RequestBytes = requestBytes; - this.ResponseBytes = responseBytes; + if (requestBytes != null) + this.RequestBytes = requestBytes; + else + this.RequestBytes = OpenMetaverse.Utils.EmptyBytes; + + if (responseBytes != null) + this.ResponseBytes = responseBytes; + else + this.ResponseBytes = OpenMetaverse.Utils.EmptyBytes; this.RequestHeaders = requestHeaders; this.ResponseHeaders = responseHeaders; this.Protocol = proto; @@ -392,10 +438,10 @@ namespace WinGridProxy public override byte[] Serialize() { - OSDMap map = new OSDMap(9); + OSDMap map = new OSDMap(5); map["Name"] = OSD.FromString(this.Name); map["Host"] = OSD.FromString(this.Host); - map["RequestBytes"] = OSD.FromBinary(this.RequestBytes); + map["RequestBytes"] = OSD.FromBinary(this.RequestBytes); map["ResponseBytes"] = OSD.FromBinary(this.ResponseBytes); map["Direction"] = OSD.FromInteger((int)this.Direction); map["ContentType"] = OSD.FromString(this.ContentType); @@ -408,7 +454,8 @@ namespace WinGridProxy rMap[key] = OSD.FromString(this.RequestHeaders[key]); requestHeadersArray.Add(rMap); } - map["RequestHeaders"] = requestHeadersArray; + if(requestHeadersArray.Count > 0) + map["RequestHeaders"] = requestHeadersArray; OSDArray responseHeadersArray = new OSDArray(); foreach (String key in this.ResponseHeaders.Keys) @@ -417,15 +464,18 @@ namespace WinGridProxy rMap[key] = OSD.FromString(this.ResponseHeaders[key]); responseHeadersArray.Add(rMap); } - map["ResponseHeaders"] = responseHeadersArray; + if(responseHeadersArray.Count > 0) + map["ResponseHeaders"] = responseHeadersArray; return OpenMetaverse.Utils.StringToBytes(map.ToString()); } public override Session Deserialize(byte[] bytes) { + var s = OpenMetaverse.Utils.BytesToString(bytes); + + //OSDMap map = (OSDMap)OSDParser.Deserialize(bytes); OSDMap map = (OSDMap)OSDParser.DeserializeLLSDNotation(OpenMetaverse.Utils.BytesToString(bytes)); - this.Name = map["Name"].AsString(); this.Host = map["Host"].AsString(); this.RequestBytes = map["RequestBytes"].AsBinary(); @@ -436,23 +486,30 @@ namespace WinGridProxy this.Protocol = map["Protocol"].AsString(); this.RequestHeaders = new WebHeaderCollection(); - OSDArray requestHeadersArray = (OSDArray)map["RequestHeaders"]; - for (int i = 0; i < requestHeadersArray.Count; i++) + if (map.ContainsKey("RequestHeaders")) { - OSDMap rMap = (OSDMap)requestHeadersArray[i]; - foreach (string key in rMap.Keys) + OSDArray requestHeadersArray = (OSDArray)map["RequestHeaders"]; + for (int i = 0; i < requestHeadersArray.Count; i++) { - this.RequestHeaders.Add(key, rMap[key].AsString()); + OSDMap rMap = (OSDMap)requestHeadersArray[i]; + foreach (string key in rMap.Keys) + { + this.RequestHeaders.Add(key, rMap[key].AsString()); + } } } + this.ResponseHeaders = new WebHeaderCollection(); - OSDArray responseHeadersArray = (OSDArray)map["ResponseHeaders"]; - for (int i = 0; i < responseHeadersArray.Count; i++) + if (map.ContainsKey("ResponseHeaders")) { - OSDMap rMap = (OSDMap)responseHeadersArray[i]; - foreach (string key in rMap.Keys) + OSDArray responseHeadersArray = (OSDArray)map["ResponseHeaders"]; + for (int i = 0; i < responseHeadersArray.Count; i++) { - this.ResponseHeaders.Add(key, rMap[key].AsString()); + OSDMap rMap = (OSDMap)responseHeadersArray[i]; + foreach (string key in rMap.Keys) + { + this.ResponseHeaders.Add(key, rMap[key].AsString()); + } } } @@ -502,18 +559,17 @@ namespace WinGridProxy return String.Empty; } } + public override string ToXml(Direction direction) { - return base.ToXml(direction); - - //if (direction == this.Direction) - //{ - // return this.Data.ToString(); - //} - //else - //{ - // return base.ToXml(direction); - //} + if (direction == this.Direction) + { + return this.Data.ToString(); + } + else + { + return base.ToXml(direction); + } } public override byte[] ToBytes(Direction direction) @@ -691,8 +747,8 @@ namespace WinGridProxy this.Direction = (Direction)map["Direction"].AsInteger(); this.ContentType = map["ContentType"].AsString(); this.Protocol = map["Protocol"].AsString(); - this.Length = ResponseBytes.Length; + if (map.ContainsKey("ResponseHeaders")) { this.ResponseHeaders = new WebHeaderCollection(); diff --git a/prebuild.xml b/prebuild.xml index 829d6c97..6d30592e 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -499,6 +499,35 @@ + @@ -600,6 +629,7 @@ ../../bin/ +