///<summary>When grid is clicked, show bug submissions grouped by version in Hash Data grid.</summary> private void gridHashes_CellClick(object sender, UI.ODGridClickEventArgs e) { Dictionary <string, List <BugSubmission> > dictSubStackTraces; object gridTagObj = gridHashes.ListGridRows[e.Row].Tag; if (gridTagObj is BugSubmissionHash) //No Grouping { dictSubStackTraces = _dictBugSubsByHashNum[(gridTagObj as BugSubmissionHash).BugSubmissionHashNum] .GroupBy(x => x.ProgramVersion) .ToDictionary(x => x.Key, x => x.ToList()); } else if (gridTagObj is List <BugSubmissionHash> ) { dictSubStackTraces = new Dictionary <string, List <BugSubmission> >(); foreach (BugSubmissionHash hash in (gridTagObj as List <BugSubmissionHash>)) { _dictBugSubsByHashNum[hash.BugSubmissionHashNum] .GroupBy(x => x.ProgramVersion) .ForEach(x => { if (dictSubStackTraces.ContainsKey(x.Key)) { dictSubStackTraces[x.Key].AddRange(x.ToList()); } else { dictSubStackTraces.Add(x.Key, x.ToList()); } }); } } else { MsgBox.Show("Error loading Hash Details: Unknown Tag"); return; } gridHashData.BeginUpdate(); gridHashData.ListGridRows.Clear(); foreach (string key in dictSubStackTraces.Keys) { BugSubmission sub = dictSubStackTraces[key].OrderBy(x => new Version(x.ProgramVersion)).Last(); //Most recent version. BugSubmissionHashes.ProcessSubmission(sub , out long matchedBugId, out string matchedFixedVersions, out long matchedBugSubmissionHashNum , useConnectionStore: false ); string versionSubmitted = new Version(sub.ProgramVersion).ToString(); string countRegKeys = dictSubStackTraces[key].Select(x => x.RegKey).Distinct().Count().ToString(); string countTotalSubs = dictSubStackTraces[key].Count().ToString(); gridHashData.AddRow(tag: dictSubStackTraces[key], versionSubmitted, countRegKeys, countTotalSubs, (matchedFixedVersions ?? "")); } gridHashData.EndUpdate(); gridSubs.BeginUpdate(); gridSubs.ListGridRows.Clear(); gridSubs.EndUpdate(); }
///<summary>When clicked, allows user to past stacktrace and enter version to attempt to find hash and matched info.</summary> private void butCheckHash_Click(object sender, EventArgs e) { InputBox input = new InputBox("Please paste a stack trace", true); if (input.ShowDialog() != DialogResult.OK) { return; } BugSubmission sub = new BugSubmission() { ExceptionStackTrace = input.textResult.Text.Replace("\r\n", "\n"), }; input = new InputBox("Please enter a version like: 19.2.1.0"); if (input.ShowDialog() != DialogResult.OK || !Version.TryParse(input.textResult.Text, out Version version)) { return; } BugSubmissionHashes.ProcessSubmission(sub , out long matchedBugId, out string matchedFixedVersions, out long matchedBugSubmissionHashNum , version, false ); MsgBox.Show($"MatchedBugId: {matchedBugId}\r\nMatchedFixedVersions: {matchedFixedVersions}\r\nMatchedBugSubmissionHashNum: {matchedBugSubmissionHashNum}"); }