private void UpdateByteLabel(int position, Highlight[] highlights) { if (highlights.Any(h => h.Type == HighlightType.Pointer)) { var highlight = highlights.First(h => h.Type == HighlightType.Pointer); int relativePos = (int)highlight.Value - position; labelByteInfo.Text = $"0x{((int)highlight.Value).ToString("X8")} ({(relativePos > 0 ? "+" : "-")}{Math.Abs(relativePos)})"; } else labelByteInfo.Text = "Not a pointer"; if (hexView1.History.Count > 0) textBoxHistory.Text = hexView1.History.Select(a => hexView1.SelectedPosition == a ? $"(0x{a.ToString("X8")})" : $" 0x{a.ToString("X8")} ").Aggregate((a, b) => $"{a} > {b}"); }
private void hexView1_ByteSelected(Object sender, int position, Highlight[] highlights) { labelPosition.Text = $"Position: {position}, 0x{position.ToString("X")}"; UpdateByteLabel(position, highlights); PopulateReferenceList(position, highlights); }
private void PopulateReferenceList(int position, Highlight[] highlights) { listView1.Clear(); foreach (var highlight in highlights.Where(h => h.Type == HighlightType.ReferencedValue)) { int relativePos = (int)highlight.Value - position; listView1.Items.Add(new ListViewItem() { Text = $"0x{((int)highlight.Value).ToString("X8")} ({(relativePos > 0 ? "+" : "-")}{Math.Abs(relativePos)})", Tag = highlight.Value }); } }
private void hexView1_ByteDoubleClick(Object sender, Int32 position, Highlight[] highlights) { var pointers = highlights.Where(h => h.Type == HighlightType.Pointer); if (pointers.Any()) { var pointer = pointers.First(); hexView1.SelectedPosition = (int)pointer.Value; } }