void AddFinding(AssemblyFinding finding) { var item = new ListViewItem(new string[] { finding.Severity.ToString(), (finding.LineNumber == int.MinValue) ? "" : ((finding.LineNumber + 1)).ToString(), finding.Message }, (int)finding.Severity) { Tag = finding }; mFindingsListView.Items.Add(item); }
public SelectionChangedEventArgs(AssemblyFinding finding) { mSelectedFinding = finding; }
void ApplyFindingColoring(AssemblyFinding finding, MarkOperation mark) { if (finding != null && finding.LineNumber != int.MinValue && finding.LineNumber >= 0 && finding.LineNumber < mInstructions.Count) { ProcessedSourceLine processedLine = mInstructions[finding.LineNumber]; int lineTextIndex = processedLine.LineTextIndex; int length = 0; switch (finding.LineSection) { case LineSection.LocationField: if (finding.Length <= 0) { lineTextIndex = processedLine.LocTextIndex; length = processedLine.SourceLine.LocationField.Length; break; } lineTextIndex = processedLine.LocTextIndex + finding.StartCharIndex; length = finding.Length; break; case LineSection.OpField: if (finding.Length <= 0) { lineTextIndex = processedLine.OpTextIndex; length = processedLine.SourceLine.OpField.Length; break; } lineTextIndex = processedLine.OpTextIndex + finding.StartCharIndex; length = finding.Length; break; case LineSection.AddressField: if (finding.Length <= 0) { lineTextIndex = processedLine.AddressTextIndex; length = processedLine.SourceLine.AddressField.Length; break; } lineTextIndex = processedLine.AddressTextIndex + finding.StartCharIndex; length = finding.Length; break; case LineSection.CommentField: if (finding.Length <= 0) { lineTextIndex = processedLine.CommentTextIndex; length = processedLine.SourceLine.Comment.Length; break; } lineTextIndex = processedLine.CommentTextIndex + finding.StartCharIndex; length = finding.Length; break; case LineSection.EntireLine: length = processedLine.LineTextLength; break; } mSourceBox.Select(lineTextIndex, length); if (length != 0) { if (mark == MarkOperation.Mark) { Font font = mSourceBox.Font; mSourceBox.SelectionFont = new Font(font.Name, font.Size, FontStyle.Underline, font.Unit, font.GdiCharSet); mSourceBox.Focus(); mSourceBox.ScrollToCaret(); } else if (mark == MarkOperation.Unmark) { mSourceBox.SelectionFont = mSourceBox.Font; } mSourceBox.SelectionColor = findingColors[(int)finding.Severity]; mSourceBox.SelectionLength = 0; } } }