示例#1
0
 static void MakeSureAddressCanBeShown(MemoryControl mc, ulong addr, ulong size)
 {
     if (CanShowAll(mc, addr, size))
     {
         return;
     }
     mc.hexBox.InitializeStartEndOffsetToDocument();
 }
示例#2
0
		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;
		}
示例#3
0
 static void ShowInMemoryWindow(MemoryControl mc, ulong addr, ulong size)
 {
     MakeSureAddressCanBeShown(mc, addr, size);
     if (mc.CanShow)
     {
         mc.Show();
     }
     mc.hexBox.SelectAndMoveCaret(addr, size);
 }
示例#4
0
		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;
		}
示例#5
0
        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);
        }
示例#6
0
 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);
 }
示例#7
0
        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);
        }
示例#8
0
        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);
        }
示例#9
0
		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);
		}
示例#10
0
        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);
        }
示例#11
0
		static void MakeSureAddressCanBeShown(MemoryControl mc, ulong addr, ulong size) {
			if (CanShowAll(mc, addr, size))
				return;
			mc.hexBox.InitializeStartEndOffsetToDocument();
		}
示例#12
0
		static void ShowInMemoryWindow(MemoryControl mc, ulong addr, ulong size) {
			MakeSureAddressCanBeShown(mc, addr, size);
			if (mc.CanShow)
				mc.Show();
			mc.hexBox.SelectAndMoveCaret(addr, size);
		}