static void MakeSureAddressCanBeShown(MemoryControl mc, ulong addr, ulong size) { if (CanShowAll(mc, addr, size)) { return; } mc.hexBox.InitializeStartEndOffsetToDocument(); }
static bool CanShowAll(MemoryControl mc, ulong addr, ulong size) { if (size == 0) size = 1; var endAddr = addr + size - 1; if (endAddr < addr) endAddr = ulong.MaxValue; var hb = mc.hexBox; return addr >= hb.StartOffset && endAddr <= hb.EndOffset && hb.StartOffset <= hb.EndOffset; }
static void ShowInMemoryWindow(MemoryControl mc, ulong addr, ulong size) { MakeSureAddressCanBeShown(mc, addr, size); if (mc.CanShow) { mc.Show(); } mc.hexBox.SelectAndMoveCaret(addr, size); }
internal static MemoryControl GetMemoryControlInstance(int index) { var mc = memoryControls[index]; if (mc == null) { memoryControls[index] = mc = new MemoryControl(index); mc.DataContext = new MemoryVM(mc.RefreshLines); mc.hexBox.StartOffset = 0; mc.hexBox.EndOffset = IntPtr.Size == 4 ? uint.MaxValue : ulong.MaxValue; } return mc; }
public MemoryContent(IWpfCommandService wpfCommandService, IMemoryVM memoryVM, HexEditorGroupFactoryService hexEditorGroupFactoryService) { vmMemory = memoryVM; memoryVM.UnderlyingStreamChanged += MemoryVM_UnderlyingStreamChanged; hexViewHost = hexEditorGroupFactoryService.Create(memoryVM.Buffer, PredefinedHexViewRoles.HexEditorGroup, PredefinedHexViewRoles.HexEditorGroupDebuggerMemory, new Guid(MenuConstants.GUIDOBJ_DEBUGGER_MEMORY_HEXVIEW_GUID)); memoryControl = new MemoryControl(hexViewHost.HostControl); memoryControl.DataContext = vmMemory; wpfCommandService.Add(ControlConstants.GUID_DEBUGGER_MEMORY_CONTROL, memoryControl); wpfCommandService.Add(ControlConstants.GUID_DEBUGGER_MEMORY_WPFHEXVIEWHOST, hexViewHost.HostControl); }
public IPane Create(string name) { for (int i = 0; i < NUMBER_OF_MEMORY_WINDOWS; i++) { var pname = MemoryControl.IndexToPaneName(i); if (name == pname) { return(GetMemoryControlInstance(i)); } } return(null); }
internal static MemoryControl GetMemoryControlInstance(int index) { var mc = memoryControls[index]; if (mc == null) { memoryControls[index] = mc = new MemoryControl(index); mc.DataContext = new MemoryVM(mc.RefreshLines); mc.hexBox.StartOffset = 0; mc.hexBox.EndOffset = IntPtr.Size == 4 ? uint.MaxValue : ulong.MaxValue; } return(mc); }
static bool CanShowAll(MemoryControl mc, ulong addr, ulong size) { if (size == 0) { size = 1; } var endAddr = addr + size - 1; if (endAddr < addr) { endAddr = ulong.MaxValue; } var hb = mc.hexBox; return(addr >= hb.StartOffset && endAddr <= hb.EndOffset && hb.StartOffset <= hb.EndOffset); }
public MemoryContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, IMenuManager menuManager, IHexEditorSettings hexEditorSettings, IMemoryVM memoryVM, IAppSettings appSettings) { this.memoryControl = new MemoryControl(); this.vmMemory = memoryVM; this.vmMemory.SetRefreshLines(() => this.memoryControl.DnHexBox.RedrawModifiedLines()); this.memoryControl.DataContext = this.vmMemory; var dnHexBox = new DnHexBox(menuManager, hexEditorSettings) { CacheLineBytes = true, IsMemory = true, }; dnHexBox.SetBinding(HexBox.DocumentProperty, "HexDocument"); this.memoryControl.DnHexBox = dnHexBox; dnHexBox.StartOffset = 0; dnHexBox.EndOffset = IntPtr.Size == 4 ? uint.MaxValue : ulong.MaxValue; appSettings.PropertyChanged += AppSettings_PropertyChanged; UpdateHexBoxRenderer(appSettings.UseNewRenderer_HexEditor); wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_MEMORY_CONTROL, memoryControl); wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_MEMORY_HEXBOX, memoryControl.DnHexBox); }
public MemoryContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, IMenuManager menuManager, IHexEditorSettings hexEditorSettings, IMemoryVM memoryVM, IAppSettings appSettings) { this.memoryControl = new MemoryControl(); this.vmMemory = memoryVM; this.vmMemory.SetRefreshLines(() => this.memoryControl.DnHexBox.RedrawModifiedLines()); this.memoryControl.DataContext = this.vmMemory; var dnHexBox = new DnHexBox(menuManager, hexEditorSettings) { CacheLineBytes = true, IsMemory = true, }; dnHexBox.SetBinding(HexBox.DocumentProperty, nameof(vmMemory.HexDocument)); this.memoryControl.DnHexBox = dnHexBox; dnHexBox.StartOffset = 0; dnHexBox.EndOffset = IntPtr.Size == 4 ? uint.MaxValue : ulong.MaxValue; appSettings.PropertyChanged += AppSettings_PropertyChanged; UpdateHexBoxRenderer(appSettings.UseNewRenderer_HexEditor); wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_MEMORY_CONTROL, memoryControl); wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_MEMORY_HEXBOX, memoryControl.DnHexBox); }
static void MakeSureAddressCanBeShown(MemoryControl mc, ulong addr, ulong size) { if (CanShowAll(mc, addr, size)) return; mc.hexBox.InitializeStartEndOffsetToDocument(); }
static void ShowInMemoryWindow(MemoryControl mc, ulong addr, ulong size) { MakeSureAddressCanBeShown(mc, addr, size); if (mc.CanShow) mc.Show(); mc.hexBox.SelectAndMoveCaret(addr, size); }