LIBOMV-492 More WinGridProxy fixes:

Complete Search (CTRL+F) Tools
Disable menu items and entries depending on current state of application
Look into ViewerStats Message and verify proper date "AgentStartTime: 1/1/1970 12:00:00 AM (DateTime)"
packet sizes in session list should be combined or an additional column added to separate inbound/outbound
PacketToString remove extraneous information "Name: Object a[OpenMetaverse.Packets.ObjectPropertiesFamilyPacket+ObjectDataBlock]"
PacketToString should format long byte[] fields better
Verify In/Out Icons are being properly shown for packet/message direction


git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2646 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
Jim Radford
2009-04-23 10:02:39 +00:00
parent c9944b8aaf
commit c1b8bdec9d
8 changed files with 754 additions and 530 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -47,7 +47,7 @@ using Nwc.XmlRpc;
namespace WinGridProxy
{
public partial class Form1 : Form
public partial class FormWinGridProxy : Form
{
private static SettingsStore Store = new SettingsStore();
@@ -56,10 +56,10 @@ namespace WinGridProxy
private bool AutoScrollSessions = false;
ProxyManager proxy;
private int PacketCounter = 0;
private int CapsInCounter = 0;
private int CapsInBytes = 0;
private int CapsOutCounter = 0;
@@ -70,7 +70,7 @@ namespace WinGridProxy
private int PacketsOutCounter = 0;
private int PacketsOutBytes;
public Form1()
public FormWinGridProxy()
{
InitializeComponent();
@@ -83,6 +83,17 @@ namespace WinGridProxy
#region Event Handlers for Messages/Packets
public ListViewItem FindListViewItem(ListView listView, string key, bool searchAll)
{
foreach (ListViewItem item in listView.Items)
{
if (item.Text.Equals(key)
|| (searchAll && item.SubItems.ContainsKey(key)))
return item;
}
return null;
}
/// <summary>
/// Adds a new EventQueue message to the Message Filters listview.
/// </summary>
@@ -99,7 +110,9 @@ namespace WinGridProxy
}
else
{
ListViewItem foundCap = listViewMessageFilters.FindItemWithText(req.Info.CapType);
ListViewItem foundCap = FindListViewItem(listViewMessageFilters, req.Info.CapType, false);
if (foundCap == null)
{
ListViewItem addedItem = listViewMessageFilters.Items.Add(new ListViewItem(req.Info.CapType, new ListViewGroup("EventQueue Messages")));
@@ -111,7 +124,6 @@ namespace WinGridProxy
}
else
{
// add to sessions if checked = true
ProxyManager_OnMessageLog(req, CapsStage.Response);
}
}
@@ -163,35 +175,11 @@ namespace WinGridProxy
{
PacketCounter++;
string t = (request is XmlRpcRequest) ? "Login Request" : "Login Response";
string l = request.ToString().Length.ToString();
string[] s = { PacketCounter.ToString(), "HTTPS", t, l, comboBoxLoginURL.Text };
ListViewItem session = new ListViewItem(s);
string loginType = (request is XmlRpcRequest) ? "Login Request" : "Login Response";
ListViewItem session = new ListViewItem(new string[] { PacketCounter.ToString(), "HTTPS", loginType, request.ToString().Length.ToString(), comboBoxLoginURL.Text, "xml-rpc"});
session.Tag = request;
session.ImageIndex = (request is XmlRpcRequest) ? 1 : 0;
listViewSessions.Items.Add(session);
// TODO: this needs to refresh the Capabilities filters
if (request is XmlRpcResponse)
{
XmlRpcResponse r = (XmlRpcResponse)request;
if (!r.IsFault)
{
Hashtable ht = (Hashtable)r.Value;
string st = String.Empty;
if (ht.ContainsKey("login"))
{
if ((string)ht["login"] == "true")
{
//Console.WriteLine("Refresh");
//buttonRefreshCapsList_Click(this, new EventArgs());
}
}
}
}
}
}
@@ -207,28 +195,25 @@ namespace WinGridProxy
else
{
PacketCounter++;
string[] s = { PacketCounter.ToString(), "UDP", packet.Type.ToString(), packet.Length.ToString(), endpoint.ToString() };
ListViewItem session = new ListViewItem(s);
session.Tag = packet;
if (direction == Direction.Incoming)
{
session.ImageIndex = 0;
PacketsInCounter++;
PacketsInBytes += packet.Length;
}
else
{
session.ImageIndex = 1;
PacketsOutCounter++;
PacketsOutBytes += packet.Length;
}
ListViewItem session = new ListViewItem(new string[] { PacketCounter.ToString(), "UDP", packet.Type.ToString(), packet.Length.ToString(), endpoint.ToString(), "binary udp"});
session.Tag = packet;
session.ImageIndex = (direction == Direction.Incoming) ? 0 : 1;
listViewSessions.Items.Add(session);
if (AutoScrollSessions)
if (listViewSessions.Items.Count > 0 && AutoScrollSessions)
listViewSessions.EnsureVisible(listViewSessions.Items.Count - 1);
}
}
@@ -244,15 +229,25 @@ namespace WinGridProxy
}
else
{
ListViewItem found = listViewMessageFilters.FindItemWithText(req.Info.CapType);
ListViewItem found = FindListViewItem(listViewMessageFilters, req.Info.CapType, false);
if (found != null && found.Checked)
{
PacketCounter++;
// TODO: the sizes should be combined
string size = (stage == CapsStage.Request) ? req.Request.ToString().Length.ToString() : req.Response.ToString().Length.ToString();
string[] s = { PacketCounter.ToString(), found.SubItems[1].Text, req.Info.CapType, size, req.Info.URI };
int size = 0;
string cType = String.Empty;
if(req.RawRequest != null)
{
size += req.RawRequest.Length;
cType = req.RequestHeaders.Get("Content-Type"); //req.RequestHeaders["Content-Type"];
}
if (req.RawResponse != null)
{
size += req.RawResponse.Length;
cType = req.ResponseHeaders.Get("Content-Type");
}
string[] s = { PacketCounter.ToString(), found.SubItems[1].Text, req.Info.CapType, size.ToString(), req.Info.URI, cType };
ListViewItem session = new ListViewItem(s);
session.BackColor = found.BackColor;
@@ -285,6 +280,9 @@ namespace WinGridProxy
addedItem.Checked = true;
}
}
if (listViewSessions.Items.Count > 0 && AutoScrollSessions)
listViewSessions.EnsureVisible(listViewSessions.Items.Count - 1);
}
}
@@ -294,15 +292,19 @@ namespace WinGridProxy
private void buttonStartProxy_Click(object sender, EventArgs e)
{
if (button1.Text.StartsWith("Start") && IsProxyRunning.Equals(false))
{
proxy = new ProxyManager(textBoxProxyPort.Text, textBoxProxyListenIP.Text, comboBoxLoginURL.Text);
// disable any gui elements
textBoxProxyListenIP.Enabled = textBoxProxyPort.Enabled = comboBoxLoginURL.Enabled = false;
InitProxyFilters();
proxy.Start();
// enable any gui elements
toolStripDropDownButton5.Enabled =
grpUDPFilters.Enabled = grpCapsFilters.Enabled = IsProxyRunning = true;
button1.Text = "Stop Proxy";
@@ -332,9 +334,12 @@ 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);
tabControl1.SelectTab("tabPageInspect");
object tag = e.Item.Tag;
@@ -359,7 +364,7 @@ namespace WinGridProxy
{
XmlRpcResponse responseData = (XmlRpcResponse)tag;
richTextBoxDecodedResponse.Text = responseData.ToString();
richTextBoxDecodedResponse.Text = responseData.ToString();
richTextBoxRawResponse.Text = responseData.ToString();
richTextBoxNotationResponse.Text = "Notation Not Available for XML Request";
updateTreeView(responseData.ToString(), treeViewXmlResponse);
@@ -371,7 +376,7 @@ namespace WinGridProxy
richTextBoxNotationRequest.Text = String.Empty;
treeViewXMLRequest.Nodes.Clear();
hexBoxRequest.ByteProvider = null;
}
else if (tag is Packet)
{
@@ -385,18 +390,7 @@ namespace WinGridProxy
treeViewXMLRequest.Nodes.Clear();
// 0 = incoming, 1 = outgoing
if (e.Item.ImageIndex == 1)
{
richTextBoxDecodedRequest.Text = String.Empty;
richTextBoxRawRequest.Text = String.Empty;
richTextBoxNotationRequest.Text = "Notation Not Available for Packet Types";
hexBoxRequest.ByteProvider = data;
richTextBoxDecodedResponse.Text = String.Empty;
richTextBoxRawResponse.Text = String.Empty;
hexBoxResponse.ByteProvider = null;
}
else
if (e.Item.ImageIndex == 0)
{
richTextBoxDecodedResponse.Text = TagToString(tag, listViewSessions.FocusedItem.SubItems[2].Text);
richTextBoxRawResponse.Text = TagToString(tag, listViewSessions.FocusedItem.SubItems[2].Text);
@@ -406,7 +400,19 @@ namespace WinGridProxy
richTextBoxDecodedRequest.Text = String.Empty;
richTextBoxRawRequest.Text = String.Empty;
hexBoxRequest.ByteProvider = null;
}
else
{
richTextBoxDecodedRequest.Text = TagToString(tag, listViewSessions.FocusedItem.SubItems[2].Text);
richTextBoxRawRequest.Text = TagToString(tag, listViewSessions.FocusedItem.SubItems[2].Text);
richTextBoxNotationRequest.Text = "Notation Not Available for Packet Types";
hexBoxRequest.ByteProvider = data;
richTextBoxDecodedResponse.Text = String.Empty;
richTextBoxRawResponse.Text = String.Empty;
hexBoxResponse.ByteProvider = null;
}
}
else if (tag is CapsRequest)
{
@@ -416,13 +422,13 @@ namespace WinGridProxy
{
StringBuilder rawRequest = new StringBuilder();
if(capsData.RequestHeaders != null)
if (capsData.RequestHeaders != null)
{
foreach (KeyValuePair<string, string> kvp in capsData.RequestHeaders)
{
rawRequest.AppendFormat("{0}: {1}" + System.Environment.NewLine, kvp.Key, kvp.Value);
}
rawRequest.AppendLine();
foreach (string key in capsData.RequestHeaders.Keys)
{
rawRequest.AppendFormat("{0}: {1}" + System.Environment.NewLine, key, capsData.RequestHeaders[key]);
}
rawRequest.AppendLine();
}
rawRequest.AppendLine(Utils.BytesToString(capsData.RawRequest));
@@ -485,7 +491,7 @@ namespace WinGridProxy
if (IsProxyRunning)
proxy.Stop();
if(saveOptionsOnExitToolStripMenuItem.Checked)
if (saveOptionsOnExitToolStripMenuItem.Checked)
SaveAllSettings("settings.osd");
}
@@ -611,20 +617,20 @@ namespace WinGridProxy
}
}
private void sessionSelectAllProtocol_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in listViewSessions.Items)
{
if (item.SubItems[1].Text.Equals(toolStripMenuItemSelectProtocol.Tag) && !item.Selected)
item.Selected = true;
}
}
//private void sessionSelectAllProtocol_Click(object sender, EventArgs e)
//{
// foreach (ListViewItem item in listViewSessions.Items)
// {
// if (item.SubItems[1].Text.Equals(toolStripMenuItemSelectProtocol.Tag) && !item.Selected)
// item.Selected = true;
// }
//}
// stop capturing selected filters
private void filterDisableByPacketName_CheckedChanged(object sender, EventArgs e)
{
if (enableDisableFilterByNameToolStripMenuItem.Tag != null)
{
{
ListViewItem found = listViewMessageFilters.FindItemWithText(enableDisableFilterByNameToolStripMenuItem.Tag.ToString());
if (found != null)
@@ -657,17 +663,17 @@ namespace WinGridProxy
toolStripMenuItemSelectPacketName.Text = String.Format("All {0} {1}", listViewSessions.FocusedItem.SubItems[2].Text, strPacketOrMessage);
toolStripMenuItemSelectProtocol.Text = String.Format("All {0} {1}", listViewSessions.FocusedItem.SubItems[1].Text, strPacketOrMessage);
// toolStripMenuItemSelectProtocol.Text = String.Format("All {0} {1}", listViewSessions.FocusedItem.SubItems[1].Text, strPacketOrMessage);
toolStripMenuItemSelectProtocol.Visible =
enableDisableFilterByNameToolStripMenuItem.Visible =
toolStripSeparatorSelectPacketProto.Visible =
toolStripSeparatorFilterPacketByName.Visible =
toolStripMenuItemSelectPacketName.Visible = true;
// toolStripMenuItemSelectProtocol.Visible =
enableDisableFilterByNameToolStripMenuItem.Visible =
toolStripSeparatorSelectPacketProto.Visible =
toolStripSeparatorFilterPacketByName.Visible =
toolStripMenuItemSelectPacketName.Visible = true;
// find checkstate of selected menuitem in packets or messages filters checkedListBoxes
bool ctxChecked = false;
if (strPacketOrMessage.Equals("Packets"))
{
ListViewItem found = listViewPacketFilters.FindItemWithText(toolStripMenuItemSelectPacketName.Tag.ToString());
@@ -685,12 +691,27 @@ namespace WinGridProxy
else
{
// Hide specific selection options on context menu
toolStripMenuItemSelectProtocol.Visible =
enableDisableFilterByNameToolStripMenuItem.Visible =
toolStripSeparatorSelectPacketProto.Visible =
toolStripSeparatorFilterPacketByName.Visible =
toolStripMenuItemSelectPacketName.Visible = false;
enableDisableFilterByNameToolStripMenuItem.Visible =
toolStripSeparatorSelectPacketProto.Visible =
toolStripSeparatorFilterPacketByName.Visible =
toolStripMenuItemSelectPacketName.Visible = false;
}
if (listViewSessions.Items.Count > 0)
{
markToolStripMenuItem2.Enabled =
findToolStripMenuItem1.Enabled =
toolStripMenuSessionsRemove.Enabled =
selectToolStripMenuItem2.Enabled = true;
}
else
{
markToolStripMenuItem2.Enabled =
findToolStripMenuItem1.Enabled =
toolStripMenuSessionsRemove.Enabled =
selectToolStripMenuItem2.Enabled = false;
}
}
private void findSessions_Click(object sender, EventArgs e)
@@ -699,8 +720,15 @@ namespace WinGridProxy
FormSessionSearch search = new FormSessionSearch(ref opts);
search.ShowDialog();
if (!String.IsNullOrEmpty(opts.SearchWhat))
SearchSessions(opts);
if (!String.IsNullOrEmpty(opts.SearchText))
{
Thread sThread = new Thread(delegate()
{
SearchSessions(opts);
});
sThread.Name = "Search";
sThread.Start();
}
}
@@ -795,12 +823,12 @@ namespace WinGridProxy
myStream.Close();
}
}
}
}
private void loadSessionArchiveToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
OSD osd = OSDParser.DeserializeLLSDNotation(File.ReadAllText(openFileDialog1.FileName));
@@ -867,8 +895,9 @@ namespace WinGridProxy
// a byte array
if (messageField.GetValue(message).GetType() == typeof(Byte[]))
{
result.AppendFormat("{0, 30}: {1} ({2})" + System.Environment.NewLine,
messageField.Name, Utils.BytesToHexString((byte[])messageField.GetValue(message), ""), messageField.FieldType.Name);
result.AppendFormat("{0, 30}: ({1})" + System.Environment.NewLine,
messageField.Name, messageField.FieldType.Name);
result.AppendFormat("{0}" + System.Environment.NewLine, Utils.BytesToHexString((byte[])messageField.GetValue(message), string.Format("{0,30}", "")));
}
// an array of class objects
@@ -882,21 +911,52 @@ namespace WinGridProxy
foreach (FieldInfo nestedField in nestedArrayObject.GetType().GetFields())
{
result.AppendFormat("{0, 30}: {1} ({2})" + System.Environment.NewLine,
nestedField.Name, nestedField.GetValue(nestedArrayObject), nestedField.Name.GetType().Name);
var nt = nestedField.GetValue(nestedArrayObject).GetType().Name;
if (nestedField.FieldType.IsEnum)
{
result.AppendFormat("{0, 30}: {1} {2} ({3})" + System.Environment.NewLine,
nestedField.Name,
Enum.Format(nestedField.GetValue(nestedArrayObject).GetType(),
nestedField.GetValue(nestedArrayObject), "D"),
nestedField.GetValue(nestedArrayObject),
nestedField.GetValue(nestedArrayObject).GetType().Name);
}
else
{
result.AppendFormat("{0, 30}: {1} ({2})" + System.Environment.NewLine,
nestedField.Name,
nestedField.GetValue(nestedArrayObject),
nestedField.GetValue(nestedArrayObject).GetType().Name);
}
}
}
}
else
{
result.AppendFormat("{0, 30}: {1} ({2})" + System.Environment.NewLine,
messageField.Name, messageField.GetValue(message), messageField.FieldType.Name);
if (messageField.FieldType.IsEnum)
{
result.AppendFormat("{0, 30}: {1} {2} ({3})" + System.Environment.NewLine,
messageField.Name,
Enum.Format(messageField.GetValue(message).GetType(),
messageField.GetValue(message), "D"),
messageField.GetValue(message), messageField.FieldType.Name);
}
else
{
result.AppendFormat("{0, 30}: {1} ({2})" + System.Environment.NewLine,
messageField.Name, messageField.GetValue(message), messageField.FieldType.Name);
}
}
}
return result.ToString();
}
/// <summary>
/// Creates a formatted string containing the values of a Packet
/// </summary>
/// <param name="packet">The Packet</param>
/// <returns>A formatted string of values of the nested items in the Packet object</returns>
public static string PacketToString(Packet packet)
{
StringBuilder result = new StringBuilder();
@@ -922,9 +982,9 @@ namespace WinGridProxy
foreach (FieldInfo packetArrayField in nestedArrayRecord.GetType().GetFields())
{
if (packetArrayField.GetValue(nestedArrayRecord).GetType() == typeof(System.Byte[]))
{
{
result.AppendFormat("{0,30}: {1}" + System.Environment.NewLine,
packetArrayField.Name,
packetArrayField.Name,
new Color4((byte[])packetArrayField.GetValue(nestedArrayRecord), 0, false).ToString());
}
else
@@ -961,7 +1021,7 @@ namespace WinGridProxy
}
else
{
result.AppendFormat("{0,30}: {1} a[{2}]" + System.Environment.NewLine,
result.AppendFormat("{0,30}: {1} [{2}]" + System.Environment.NewLine,
packetPropertyField.Name,
Utils.BytesToString((byte[])packetPropertyField.GetValue(packetDataObject, null)),
packetDataObject.GetType());
@@ -972,7 +1032,7 @@ namespace WinGridProxy
// this seems to be limited to the length property, since all others have been previously handled
if (packetPropertyField.Name != "Length")
{
result.AppendFormat("{0,30}: {1} b[{2}]" + System.Environment.NewLine,
result.AppendFormat("{0,30}: {1} [{2}]" + System.Environment.NewLine,
packetPropertyField.Name, packetPropertyField.GetValue(packetDataObject, null),
packetPropertyField.GetType());
}
@@ -1003,7 +1063,7 @@ namespace WinGridProxy
entry.pType = item.SubItems[1].Text;
Store.MessageSessions.Add(item.Text, entry);
}
Store.StatisticsEnabled = enableStatisticsToolStripMenuItem.Checked;
Store.AutoScrollEnabled = autoScrollSessionsToolStripMenuItem.Checked;
Store.SaveSessionOnExit = saveOptionsOnExitToolStripMenuItem.Checked;
@@ -1098,7 +1158,7 @@ namespace WinGridProxy
}
//listViewPacketFilters.Sort();
listViewPacketFilters.EndUpdate();
}
@@ -1113,35 +1173,52 @@ namespace WinGridProxy
private void SearchSessions(FilterOptions opts)
{
Console.WriteLine("{1}: {0}", opts.HasSelection, "HasSelection");
Console.WriteLine("{1}: {0}", opts.HighlightMatches, "HighlightMatches");
Console.WriteLine("{1}: {0}", opts.MatchCase, "MatchCase");
Console.WriteLine("{1}: {0}", opts.SearchSelected, "SearchSelected");
Console.WriteLine("{1}: {0}", opts.SearchText, "SearchText");
Console.WriteLine("{1}: {0}", opts.SearchWhat, "SearchWhat");
Console.WriteLine("{1}: {0}", opts.SelectResults, "SelectResults");
Console.WriteLine("{1}: {0}", opts.UnMarkPrevious, "UnmarkPrevious");
foreach (ListViewItem item in listViewSessions.Items)
if (this.InvokeRequired)
{
if (item.Text.Contains(opts.SearchText) || TagToString(item.Tag, item.SubItems[2].Text).Contains(opts.SearchText))
{
if (opts.UnMarkPrevious)
item.BackColor = Color.White;
this.BeginInvoke(new MethodInvoker(delegate()
{
SearchSessions(opts);
}));
}
else
{
int resultCount = 0;
item.BackColor = opts.HighlightMatches;
foreach (ListViewItem item in listViewSessions.Items)
{
if (opts.UnMarkPrevious)
item.BackColor = Color.White;
if (opts.SearchSelected && !item.Selected)
{
continue;
}
if (
(opts.MatchCase
&& (item.SubItems[2].Text.Contains(opts.SearchText)
|| TagToString(item.Tag, item.SubItems[2].Text).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())
))
)
{
resultCount++;
if (opts.MarkMatches)
item.BackColor = opts.HighlightMatchColor;
if (opts.SelectResults)
item.Selected = true;
else
item.Selected = false;
}
}
}
if (opts.SearchWhat.Equals("Both") || opts.SearchWhat.Equals("Messages"))
{
}
toolStripMainLabel.Text = String.Format("Search found {0} Matches", resultCount);
}
}
private string TagToString(object tag, string key)
{
@@ -1173,7 +1250,7 @@ namespace WinGridProxy
if (capsData.Response != null)
{
return capsData.Response.ToString();
return capsData.Response.ToString();
}
return "Unable to decode CapsRequest";
}
@@ -1207,7 +1284,7 @@ namespace WinGridProxy
}
#endregion
#region XML Tree
private void updateTreeView(string xml, TreeView treeView)
@@ -1215,7 +1292,7 @@ namespace WinGridProxy
try
{
treeView.Nodes.Clear();
XmlDocument tmpxmldoc = new XmlDocument();
tmpxmldoc.LoadXml(xml);
FillTree(tmpxmldoc.DocumentElement, treeView.Nodes);
@@ -1298,7 +1375,97 @@ namespace WinGridProxy
}
}
#endregion
}
#endregion
private void EditToolStripButton_DropDownOpening(object sender, EventArgs e)
{
if (listViewSessions.Items.Count > 0)
{
toolStripMenuSessionsRemove.Enabled =
removeToolStripMenuItem2.Enabled =
selectToolStripMenuItem1.Enabled =
saveSessionArchiveToolStripMenuItem.Enabled =
toolStripMenuItemRemoveAll.Enabled = true;
if (listViewSessions.SelectedItems.Count < listViewSessions.Items.Count)
{
toolStripMenuItemRemoveUnselected.Enabled = true;
}
else
{
toolStripMenuItemRemoveUnselected.Enabled = false;
}
if (listViewSessions.SelectedItems.Count > 0)
{
markToolStripMenuItem1.Enabled =
toolStripSeparatorSelectPacketProto.Visible =
toolStripMenuItemSelectPacketName.Visible =
noneToolStripMenuItem2.Enabled =
copyToolStripMenuItem1.Enabled =
toolStripMenuItemRemoveSelected.Enabled = true;
}
else
{
markToolStripMenuItem1.Enabled =
toolStripSeparatorSelectPacketProto.Visible =
toolStripMenuItemSelectPacketName.Visible =
noneToolStripMenuItem2.Enabled =
noneToolStripMenuItem2.Enabled =
copyToolStripMenuItem1.Enabled =
toolStripMenuItemRemoveSelected.Enabled = false;
}
if (listViewSessions.SelectedItems.Count > 0
&& listViewSessions.SelectedItems.Count != listViewSessions.Items.Count)
{
toolStripMenuItemRemoveUnselected.Enabled =
invertToolStripMenuItem1.Enabled =
noneToolStripMenuItem2.Enabled = true;
}
else
{
toolStripMenuItemRemoveUnselected.Enabled =
invertToolStripMenuItem1.Enabled =
noneToolStripMenuItem2.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)
{
if (colorDialog1.ShowDialog() == DialogResult.OK)
{
//listview.BackColor = colorDialog1.Color;
}
}
}
}

View File

@@ -172,12 +172,6 @@
BQAD/wUACw==
</value>
</data>
<metadata name="statusStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>414, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>116, 17</value>
</metadata>
<metadata name="contextMenuStripRemove.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>185, 54</value>
</metadata>
@@ -193,6 +187,12 @@
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>116, 17</value>
</metadata>
<metadata name="statusStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>414, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>116, 17</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
@@ -307,4 +307,13 @@
<metadata name="openFileDialog2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>750, 54</value>
</metadata>
<metadata name="statusStrip3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>880, 54</value>
</metadata>
<metadata name="contextMenuStripFilterOptions.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 91</value>
</metadata>
<metadata name="colorDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>990, 54</value>
</metadata>
</root>

View File

@@ -30,15 +30,13 @@
{
this.label1 = new System.Windows.Forms.Label();
this.textBoxFind = new System.Windows.Forms.TextBox();
this.labelMarkColor = new System.Windows.Forms.Label();
this.checkBoxMatchCase = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.panelColor = new System.Windows.Forms.Panel();
this.checkBoxMarkResults = new System.Windows.Forms.CheckBox();
this.buttonPickColor = new System.Windows.Forms.Button();
this.checkBoxUnmark = new System.Windows.Forms.CheckBox();
this.checkBoxSelectMatches = new System.Windows.Forms.CheckBox();
this.label3 = new System.Windows.Forms.Label();
this.comboBoxPacketsOrMessages = new System.Windows.Forms.ComboBox();
this.checkBoxSearchSelected = new System.Windows.Forms.CheckBox();
this.buttonClose = new System.Windows.Forms.Button();
this.buttonFind = new System.Windows.Forms.Button();
@@ -60,24 +58,14 @@
//
this.textBoxFind.Location = new System.Drawing.Point(48, 12);
this.textBoxFind.Name = "textBoxFind";
this.textBoxFind.Size = new System.Drawing.Size(231, 20);
this.textBoxFind.Size = new System.Drawing.Size(203, 20);
this.textBoxFind.TabIndex = 1;
this.textBoxFind.TextChanged += new System.EventHandler(this.textBoxFind_TextChanged);
//
// labelMarkColor
//
this.labelMarkColor.AutoSize = true;
this.labelMarkColor.BackColor = System.Drawing.Color.Transparent;
this.labelMarkColor.Location = new System.Drawing.Point(27, 7);
this.labelMarkColor.Name = "labelMarkColor";
this.labelMarkColor.Size = new System.Drawing.Size(72, 13);
this.labelMarkColor.TabIndex = 3;
this.labelMarkColor.Text = "Mark Results:";
//
// checkBoxMatchCase
//
this.checkBoxMatchCase.AutoSize = true;
this.checkBoxMatchCase.Location = new System.Drawing.Point(9, 46);
this.checkBoxMatchCase.Location = new System.Drawing.Point(6, 19);
this.checkBoxMatchCase.Name = "checkBoxMatchCase";
this.checkBoxMatchCase.Size = new System.Drawing.Size(83, 17);
this.checkBoxMatchCase.TabIndex = 4;
@@ -89,13 +77,11 @@
this.groupBox1.Controls.Add(this.panelColor);
this.groupBox1.Controls.Add(this.checkBoxUnmark);
this.groupBox1.Controls.Add(this.checkBoxSelectMatches);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.comboBoxPacketsOrMessages);
this.groupBox1.Controls.Add(this.checkBoxSearchSelected);
this.groupBox1.Controls.Add(this.checkBoxMatchCase);
this.groupBox1.Location = new System.Drawing.Point(15, 38);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(271, 145);
this.groupBox1.Size = new System.Drawing.Size(245, 151);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Options";
@@ -103,19 +89,31 @@
// panelColor
//
this.panelColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.panelColor.Controls.Add(this.checkBoxMarkResults);
this.panelColor.Controls.Add(this.buttonPickColor);
this.panelColor.Controls.Add(this.labelMarkColor);
this.panelColor.Location = new System.Drawing.Point(10, 111);
this.panelColor.Location = new System.Drawing.Point(3, 111);
this.panelColor.Name = "panelColor";
this.panelColor.Size = new System.Drawing.Size(255, 28);
this.panelColor.Size = new System.Drawing.Size(230, 28);
this.panelColor.TabIndex = 11;
//
// checkBoxMarkResults
//
this.checkBoxMarkResults.AutoSize = true;
this.checkBoxMarkResults.Checked = true;
this.checkBoxMarkResults.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxMarkResults.Location = new System.Drawing.Point(3, 7);
this.checkBoxMarkResults.Name = "checkBoxMarkResults";
this.checkBoxMarkResults.Size = new System.Drawing.Size(88, 17);
this.checkBoxMarkResults.TabIndex = 12;
this.checkBoxMarkResults.Text = "Mark Results";
this.checkBoxMarkResults.UseVisualStyleBackColor = true;
//
// buttonPickColor
//
this.buttonPickColor.BackColor = System.Drawing.SystemColors.ButtonFace;
this.buttonPickColor.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.buttonPickColor.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonPickColor.Location = new System.Drawing.Point(134, 3);
this.buttonPickColor.Location = new System.Drawing.Point(151, 4);
this.buttonPickColor.Name = "buttonPickColor";
this.buttonPickColor.Size = new System.Drawing.Size(66, 21);
this.buttonPickColor.TabIndex = 10;
@@ -128,7 +126,7 @@
this.checkBoxUnmark.AutoSize = true;
this.checkBoxUnmark.Checked = true;
this.checkBoxUnmark.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxUnmark.Location = new System.Drawing.Point(144, 92);
this.checkBoxUnmark.Location = new System.Drawing.Point(6, 88);
this.checkBoxUnmark.Name = "checkBoxUnmark";
this.checkBoxUnmark.Size = new System.Drawing.Size(120, 17);
this.checkBoxUnmark.TabIndex = 9;
@@ -138,40 +136,20 @@
// checkBoxSelectMatches
//
this.checkBoxSelectMatches.AutoSize = true;
this.checkBoxSelectMatches.Location = new System.Drawing.Point(9, 92);
this.checkBoxSelectMatches.Checked = true;
this.checkBoxSelectMatches.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxSelectMatches.Location = new System.Drawing.Point(6, 65);
this.checkBoxSelectMatches.Name = "checkBoxSelectMatches";
this.checkBoxSelectMatches.Size = new System.Drawing.Size(100, 17);
this.checkBoxSelectMatches.TabIndex = 8;
this.checkBoxSelectMatches.Text = "Select Matches";
this.checkBoxSelectMatches.UseVisualStyleBackColor = true;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 22);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 13);
this.label3.TabIndex = 7;
this.label3.Text = "Search:";
//
// comboBoxPacketsOrMessages
//
this.comboBoxPacketsOrMessages.FormattingEnabled = true;
this.comboBoxPacketsOrMessages.Items.AddRange(new object[] {
"Both",
"Messages",
"Packets"});
this.comboBoxPacketsOrMessages.Location = new System.Drawing.Point(84, 19);
this.comboBoxPacketsOrMessages.Name = "comboBoxPacketsOrMessages";
this.comboBoxPacketsOrMessages.Size = new System.Drawing.Size(180, 21);
this.comboBoxPacketsOrMessages.TabIndex = 6;
this.comboBoxPacketsOrMessages.Text = "Both";
//
// checkBoxSearchSelected
//
this.checkBoxSearchSelected.AutoSize = true;
this.checkBoxSearchSelected.Enabled = false;
this.checkBoxSearchSelected.Location = new System.Drawing.Point(9, 69);
this.checkBoxSearchSelected.Location = new System.Drawing.Point(6, 42);
this.checkBoxSearchSelected.Name = "checkBoxSearchSelected";
this.checkBoxSearchSelected.Size = new System.Drawing.Size(168, 17);
this.checkBoxSearchSelected.TabIndex = 5;
@@ -194,7 +172,7 @@
//
this.buttonFind.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonFind.Enabled = false;
this.buttonFind.Location = new System.Drawing.Point(166, 195);
this.buttonFind.Location = new System.Drawing.Point(140, 195);
this.buttonFind.Name = "buttonFind";
this.buttonFind.Size = new System.Drawing.Size(120, 23);
this.buttonFind.TabIndex = 7;
@@ -213,7 +191,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonClose;
this.ClientSize = new System.Drawing.Size(298, 230);
this.ClientSize = new System.Drawing.Size(275, 223);
this.Controls.Add(this.buttonFind);
this.Controls.Add(this.buttonClose);
this.Controls.Add(this.groupBox1);
@@ -239,18 +217,16 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBoxFind;
private System.Windows.Forms.Label labelMarkColor;
private System.Windows.Forms.CheckBox checkBoxMatchCase;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button buttonClose;
private System.Windows.Forms.Button buttonFind;
private System.Windows.Forms.CheckBox checkBoxUnmark;
private System.Windows.Forms.CheckBox checkBoxSelectMatches;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox comboBoxPacketsOrMessages;
private System.Windows.Forms.CheckBox checkBoxSearchSelected;
private System.Windows.Forms.Button buttonPickColor;
private System.Windows.Forms.ColorDialog colorDialog1;
private System.Windows.Forms.Panel panelColor;
private System.Windows.Forms.CheckBox checkBoxMarkResults;
}
}

View File

@@ -59,13 +59,13 @@ namespace WinGridProxy
private void buttonFind_Click(object sender, EventArgs e)
{
FilterOpts.HighlightMatches = panelColor.BackColor;
FilterOpts.HighlightMatchColor = panelColor.BackColor;
FilterOpts.MatchCase = checkBoxMatchCase.Checked;
FilterOpts.SearchSelected = checkBoxSearchSelected.Checked;
FilterOpts.SearchText = textBoxFind.Text;
FilterOpts.SearchWhat = comboBoxPacketsOrMessages.SelectedItem.ToString();
FilterOpts.SelectResults = checkBoxSelectMatches.Checked;
FilterOpts.UnMarkPrevious = checkBoxUnmark.Checked;
FilterOpts.MarkMatches = checkBoxMarkResults.Checked;
this.Close();
}
@@ -84,12 +84,12 @@ namespace WinGridProxy
public bool HasSelection; // set to true if SessionList has sessions selected already;
public string SearchText;
public string SearchWhat; // Both, Messages, Packets
public bool MatchCase;
public bool SearchSelected;
public bool SelectResults;
public bool UnMarkPrevious;
public Color HighlightMatches;
public bool MarkMatches;
public Color HighlightMatchColor;
public FilterOptions(bool hasSelection)
{

View File

@@ -14,7 +14,7 @@ namespace WinGridProxy
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
Application.Run(new FormWinGridProxy());
}
}
}