public HexLineTextSource(HexLine hexLine) { this.hexLine = hexLine; }
void InitializeFontProperties() { var textRunProps = CreateHexTextRunProperties(); var paraProps = CreateHexTextParagraphProperties(textRunProps); var hexLine = new HexLine(0, 0, "O", new HexLinePart[1] { new HexLinePart(0, 1, textRunProps) }); var hexLineTextSource = new HexLineTextSource(hexLine); using (var textLine = textFormatter.FormatLine(hexLineTextSource, 0, 10000, paraProps, null)) { characterWidth = textLine.Width; characterHeight = textLine.Height; } }
bool CompareBytes(HexLine line) { // Assume it's been modified if the array is null. It'll be null if CacheLineBytes // was false, the HexLine was created, then CacheLineBytes was set to true. if (line.OriginalBytes == null) return false; var doc = Document; if (doc == null) return false; int i = 0; for (ulong addr = line.StartOffset; addr <= line.EndOffset && i < line.OriginalBytes.Length; addr++, i++) { int b = doc.ReadByte(addr); if (line.OriginalBytes[i] != b) return false; } return true; }
Rect GetCharacterRect(HexLine hexLine, double y, int column) { return new Rect(column * characterWidth, y, characterWidth, characterHeight); }