void AddTestResult(string OriginalRequestBinaryString, string OriginalResonseBinaryString, string TestRequestBinaryString, string TestResponseBinaryString, int PercentOfDifference, Request OriginalRequest, Request TestRequest) { if (ConfigurePanel.InvokeRequired) { AddTestResult_d CALL_d = new AddTestResult_d(AddTestResult); ConfigurePanel.Invoke(CALL_d, new object[] { OriginalRequestBinaryString, OriginalResonseBinaryString, TestRequestBinaryString, TestResponseBinaryString, PercentOfDifference, OriginalRequest, TestRequest }); } else { /* * ID * HostName * URL * Test ID * % of diff * Ori Req BS * Ori Res BS * Test Req BS * Test Res BS */ int RowId = ResultsGrid.Rows.Add(new object[] { OriginalRequest.ID, OriginalRequest.Host, OriginalRequest.Url, TestRequest.ID, PercentOfDifference, OriginalRequestBinaryString, OriginalResonseBinaryString, TestRequestBinaryString, TestResponseBinaryString }); if (PercentOfDifference <= 10) { ResultsGrid.Rows[RowId].DefaultCellStyle.BackColor = Color.Red; } } }
void ResultsEnd() { if (ConfigurePanel.InvokeRequired) { ResultsEnd_d CALL_d = new ResultsEnd_d(ResultsEnd); ConfigurePanel.Invoke(CALL_d, new object[] { }); } else { ResultsStepProgressBar.Visible = false; } }
void ShowConfigScopeValues(List <string> Hosts, List <string> Files) { if (ConfigurePanel.InvokeRequired) { ShowConfigScopeValues_d CALL_d = new ShowConfigScopeValues_d(ShowConfigScopeValues); ConfigurePanel.Invoke(CALL_d, new object[] { Hosts, Files }); } else { List <List <string> > HostPartsList = new List <List <string> >(); foreach (string Host in Hosts) { List <string> Parts = new List <string>(Host.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries)); Parts.Reverse(); HostPartsList.Add(Parts); } HostnamesScopeTree.Nodes.Clear(); foreach (List <string> HostParts in HostPartsList) { HostParts.Reverse(); string HostName = string.Join(".", HostParts.ToArray()); HostParts.Reverse(); string BaseHost = ""; if (HostParts.Count > 1) { BaseHost = string.Format("{0}.{1}", HostParts[1], HostParts[0]); } else { BaseHost = HostParts[0]; } TreeNode BaseNode = null; if (HostnamesScopeTree.Nodes.ContainsKey(BaseHost)) { BaseNode = HostnamesScopeTree.Nodes[BaseHost]; } else { BaseNode = HostnamesScopeTree.Nodes.Add(BaseHost, " " + BaseHost); } for (int i = 2; i < HostParts.Count; i++) { if (BaseNode.Nodes.ContainsKey(HostParts[i])) { BaseNode = BaseNode.Nodes[HostParts[i]]; } else { string NodeText = ""; StringBuilder SB = new StringBuilder(" "); for (int j = i; j >= 0; j--) { SB.Append(HostParts[j]); SB.Append("."); } NodeText = SB.ToString().Trim('.'); BaseNode = BaseNode.Nodes.Add(HostParts[i], NodeText); } } } HostnamesScopeTree.ExpandAll(); FileTypesScopeGrid.Rows.Clear(); foreach (string File in Files) { if (File.Trim().Length == 0) { FileTypesScopeGrid.Rows.Add(new object[] { true, " NO EXTENSION " }); } else { if (Crawler.ExtenionsToAvoid.Contains(File)) { FileTypesScopeGrid.Rows.Add(new object[] { false, File }); } else { FileTypesScopeGrid.Rows.Add(new object[] { true, File }); } } } ConfigureStepProgressBar.Visible = false; ConfigurePanel.Visible = true; } }
void ShowMatchingRecordValues(List <LogRow> Records) { if (ConfigurePanel.InvokeRequired) { ShowMatchingRecordValues_d CALL_d = new ShowMatchingRecordValues_d(ShowMatchingRecordValues); ConfigurePanel.Invoke(CALL_d, new object[] { Records }); } else { FilterTree.Nodes.Clear(); FilterTree.Nodes.Add("Methods").Checked = true; FilterTree.Nodes.Add("File Extensions").Checked = true; FilterTree.Nodes.Add("Urls").Checked = true; CandidatesGrid.Rows.Clear(); foreach (LogRow LR in Records) { if (!FilterTree.Nodes[0].Nodes.ContainsKey(LR.Method)) { FilterTree.Nodes[0].Nodes.Add(LR.Method, LR.Method).Checked = true; } string File = LR.File; if (File.Trim().Length == 0) { File = " - NO EXTENSION - "; } if (!FilterTree.Nodes[1].Nodes.ContainsKey(File)) { FilterTree.Nodes[1].Nodes.Add(File, File).Checked = true; } if (!FilterTree.Nodes[2].Nodes.ContainsKey(LR.Host)) { FilterTree.Nodes[2].Nodes.Add(LR.Host, LR.Host).Checked = true; } TreeNode HostNode = FilterTree.Nodes[2].Nodes[LR.Host]; if (!HostNode.Nodes.ContainsKey("/")) { HostNode.Nodes.Add("/", "/").Checked = true; } Request Req = new Request(string.Format("http://{0}{1}", LR.Host, LR.Url)); for (int i = 0; i < Req.UrlPathParts.Count; i++) { string Path = Req.UrlPathParts[i]; string FullPath = ""; if (Req.UrlPathParts.Count > 0) { StringBuilder SB = new StringBuilder(); for (int j = 0; j <= i; j++) { SB.Append("/"); SB.Append(Req.UrlPathParts[j]); } FullPath = SB.ToString(); } else { FullPath = "/"; } if (!HostNode.Nodes.ContainsKey(FullPath)) { HostNode.Nodes.Add(FullPath, Path).Checked = true; if (!HostNode.Checked) { HostNode.Checked = true; } } HostNode = HostNode.Nodes[FullPath]; } } //Adding the rows after the tree population since every check on the tree node would trigger a filter application on the grids foreach (LogRow LR in Records) { object[] Fields = LR.ToLogAnalyzerGridRowObjectArray(); Fields[0] = true; CandidatesGrid.Rows.Add(Fields); } FilterTree.ExpandAll(); CandidatesStepProgressBar.Visible = false; CandidatesBaseSplit.Visible = true; TestCandidatesBtn.Visible = true; } }