protected override void Execute(DnHexBox dnHexBox) { var sel = dnHexBox.Selection; if (sel == null) { return; } var ask = new AskForInput(); ask.Owner = MainWindow.Instance; ask.Title = "Enter Value"; ask.label.Content = "_Byte"; ask.textBox.Text = "0xFF"; ask.ShowDialog(); if (ask.DialogResult != true) { return; } string error; byte b = NumberVMUtils.ParseByte(ask.textBox.Text, byte.MinValue, byte.MaxValue, out error); if (!string.IsNullOrEmpty(error)) { MainWindow.Instance.ShowMessageBox(error); return; } dnHexBox.FillBytes(sel.Value.StartOffset, sel.Value.EndOffset, b); dnHexBox.Selection = null; }
static void ExecuteInternal(DnHexBox dnHexBox) { if (dnHexBox == null) { return; } ulong start = dnHexBox.CaretPosition.Offset; ulong end = start; if (dnHexBox.Selection != null) { start = dnHexBox.Selection.Value.StartOffset; end = dnHexBox.Selection.Value.EndOffset; } var data = new SelectVM(dnHexBox.PhysicalToVisibleOffset(start), dnHexBox.PhysicalToVisibleOffset(end), dnHexBox.PhysicalToVisibleOffset(dnHexBox.StartOffset), dnHexBox.PhysicalToVisibleOffset(dnHexBox.EndOffset)); var win = new SelectDlg(); win.DataContext = data; win.Owner = MainWindow.Instance; if (win.ShowDialog() != true) { return; } dnHexBox.Selection = new HexSelection(dnHexBox.VisibleToPhysicalOffset(data.EndVM.Value), dnHexBox.VisibleToPhysicalOffset(data.StartVM.Value)); dnHexBox.CaretPosition = new HexBoxPosition(dnHexBox.VisibleToPhysicalOffset(data.StartVM.Value), dnHexBox.CaretPosition.Kind, 0); }
internal static void Execute2(DnHexBox dnHexBox) { if (!CanExecute(dnHexBox)) { return; } var data = new GoToOffsetVM(dnHexBox.PhysicalToVisibleOffset(dnHexBox.CaretPosition.Offset), dnHexBox.PhysicalToVisibleOffset(dnHexBox.StartOffset), dnHexBox.PhysicalToVisibleOffset(dnHexBox.EndOffset)); var win = new GoToOffsetDlg(); win.DataContext = data; win.Owner = MainWindow.Instance; if (dnHexBox.IsMemory) { win.Title = "Go to Address"; win.offsetLabel.Content = "_Address"; } else { win.Title = "Go to Offset"; win.offsetLabel.Content = "O_ffset"; } if (win.ShowDialog() != true) { return; } dnHexBox.CaretPosition = new HexBoxPosition(dnHexBox.VisibleToPhysicalOffset(data.OffsetVM.Value), dnHexBox.CaretPosition.Kind, 0); }
internal static void Execute2(DnHexBox dnHexBox) { var sel = dnHexBox.Selection; if (sel == null) { return; } dnHexBox.StartOffset = sel.Value.StartOffset; dnHexBox.EndOffset = sel.Value.EndOffset; }
protected override void Initialize(DnHexBox dnHexBox, MenuItem menuItem) { foreach (var info in subMenus) { var mi = new MenuItem { Header = info.Item2, IsChecked = info.Item1 == dnHexBox.BytesPerLine, }; var tmpInfo = info; mi.Click += (s, e) => dnHexBox.BytesPerLine = tmpInfo.Item1; menuItem.Items.Add(mi); } }
public HexTabState() { this.HexBox = new DnHexBox(); this.HexBox.Tag = this; var scroller = new ScrollViewer(); scroller.Content = HexBox; scroller.CanContentScroll = true; scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; scroller.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; this.TabItem.Content = scroller; InstallMouseWheelZoomHandler(HexBox); }
public void CopyTo(DnHexBox dnHexBox) { dnHexBox.BytesGroupCount = this.BytesGroupCount; dnHexBox.BytesPerLine = this.BytesPerLine; dnHexBox.UseHexPrefix = this.UseHexPrefix; dnHexBox.ShowAscii = this.ShowAscii; dnHexBox.LowerCaseHex = this.LowerCaseHex; dnHexBox.AsciiEncoding = this.AsciiEncoding; dnHexBox.HexOffsetSize = this.HexOffsetSize; dnHexBox.UseRelativeOffsets = this.UseRelativeOffsets; dnHexBox.BaseOffset = this.BaseOffset; dnHexBox.StartOffset = this.StartOffset ?? dnHexBox.DocumentStartOffset; dnHexBox.EndOffset = this.EndOffset ?? dnHexBox.DocumentEndOffset; }
protected override void Initialize(DnHexBox dnHexBox, MenuItem menuItem) { foreach (var info in subMenus) { var mi = new MenuItem { Header = info.Item2, IsChecked = info.Item1 == dnHexBox.AsciiEncoding, }; var tmpInfo = info; mi.Click += (s, e) => dnHexBox.AsciiEncoding = tmpInfo.Item1; menuItem.Items.Add(mi); } }
public LocalHexSettings(DnHexBox dnHexBox) { this.BytesGroupCount = dnHexBox.BytesGroupCount; this.BytesPerLine = dnHexBox.BytesPerLine; this.UseHexPrefix = dnHexBox.UseHexPrefix; this.ShowAscii = dnHexBox.ShowAscii; this.LowerCaseHex = dnHexBox.LowerCaseHex; this.AsciiEncoding = dnHexBox.AsciiEncoding; this.HexOffsetSize = dnHexBox.HexOffsetSize; this.UseRelativeOffsets = dnHexBox.UseRelativeOffsets; this.BaseOffset = dnHexBox.BaseOffset; this.StartOffset = dnHexBox.StartOffset == dnHexBox.DocumentStartOffset ? (ulong?)null : dnHexBox.StartOffset; this.EndOffset = dnHexBox.EndOffset == dnHexBox.DocumentEndOffset ? (ulong?)null : dnHexBox.EndOffset; }
public LocalHexSettings(DnHexBox dnHexBox) { this.BytesGroupCount = dnHexBox.BytesGroupCount; this.BytesPerLine = dnHexBox.BytesPerLine; this.UseHexPrefix = dnHexBox.UseHexPrefix; this.ShowAscii = dnHexBox.ShowAscii; this.LowerCaseHex = dnHexBox.LowerCaseHex; this.AsciiEncoding = dnHexBox.AsciiEncoding; this.HexOffsetSize = dnHexBox.HexOffsetSize; this.UseRelativeOffsets = dnHexBox.UseRelativeOffsets; this.BaseOffset = dnHexBox.BaseOffset; this.StartOffset = dnHexBox.StartOffset == dnHexBox.DocumentStartOffset ? (ulong?)null : dnHexBox.StartOffset; this.EndOffset = dnHexBox.EndOffset == dnHexBox.DocumentEndOffset ? (ulong?)null : dnHexBox.EndOffset; }
protected override void Execute(DnHexBox dnHexBox) { var data = new LocalSettingsVM(new LocalHexSettings(dnHexBox)); var win = new LocalSettingsDlg(); win.DataContext = data; win.Owner = MainWindow.Instance; if (win.ShowDialog() != true) { return; } data.CreateLocalHexSettings().CopyTo(dnHexBox); }
internal static void Execute2(DnHexBox dnHexBox) { if (!CanExecute(dnHexBox)) { return; } var data = GetBlobData(ClipboardUtils.GetData()); if (data != null) { dnHexBox.Paste(data); } }
public void CopyTo(DnHexBox dnHexBox) { dnHexBox.BytesGroupCount = this.BytesGroupCount; dnHexBox.BytesPerLine = this.BytesPerLine; dnHexBox.UseHexPrefix = this.UseHexPrefix; dnHexBox.ShowAscii = this.ShowAscii; dnHexBox.LowerCaseHex = this.LowerCaseHex; dnHexBox.AsciiEncoding = this.AsciiEncoding; dnHexBox.HexOffsetSize = this.HexOffsetSize; dnHexBox.UseRelativeOffsets = this.UseRelativeOffsets; dnHexBox.BaseOffset = this.BaseOffset; dnHexBox.StartOffset = this.StartOffset ?? dnHexBox.DocumentStartOffset; dnHexBox.EndOffset = this.EndOffset ?? dnHexBox.DocumentEndOffset; }
internal static void Execute2(DnHexBox dnHexBox) { dnHexBox.StartOffset = dnHexBox.DocumentStartOffset; dnHexBox.EndOffset = dnHexBox.DocumentEndOffset; var sel = dnHexBox.Selection; dnHexBox.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(delegate { if (sel != null && sel == dnHexBox.Selection) { dnHexBox.SetCaretPositionAndMakeVisible(sel.Value.StartOffset, sel.Value.EndOffset); } else { dnHexBox.BringCaretIntoView(); } })); }
internal static void Execute2(DnHexBox dnHexBox) { var doc = dnHexBox.Document; if (doc == null) { return; } var sel = dnHexBox.Selection; if (sel == null) { return; } var dialog = new WF.SaveFileDialog() { Filter = PickFilenameConstants.AnyFilenameFilter, RestoreDirectory = true, ValidateNames = true, }; if (dialog.ShowDialog() != WF.DialogResult.OK) { return; } var data = new ProgressVM(MainWindow.Instance.Dispatcher, new HexDocumentDataSaver(doc, sel.Value.StartOffset, sel.Value.EndOffset, dialog.FileName)); var win = new ProgressDlg(); win.DataContext = data; win.Owner = MainWindow.Instance; win.Title = string.Format("Save Selection 0x{0:X}-0x{1:X}", sel.Value.StartOffset, sel.Value.EndOffset); var res = win.ShowDialog(); if (res != true) { return; } if (!data.WasError) { return; } MainWindow.Instance.ShowMessageBox(string.Format("An error occurred:\n\n{0}", data.ErrorMessage)); }
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.CopyVBArray(); }
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.CopyOffset(); }
protected override void Initialize(DnHexBox dnHexBox, MenuItem menuItem) { menuItem.IsChecked = dnHexBox.LowerCaseHex ?? HexSettings.Instance.LowerCaseHex; }
protected override bool IsEnabled(DnHexBox dnHexBox) { return dnHexBox.Selection != null; }
protected virtual bool IsEnabled(DnHexBox dnHexBox) { return IsVisible(dnHexBox); }
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.PasteUtf8(); }
protected override bool IsEnabled(DnHexBox dnHexBox) { return(CanExecute(dnHexBox)); }
protected abstract void Execute(DnHexBox dnHexBox);
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.CopyUIContents(); }
protected override bool IsVisible(DnHexBox dnHexBox) { return(true); }
internal static bool CanExecute(DnHexBox dnHexBox) { return(dnHexBox != null && GetBlobData(ClipboardUtils.GetData()) != null); }
protected override bool IsEnabled(DnHexBox dnHexBox) { return(dnHexBox.CanPasteUnicode()); }
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.PasteUnicode(); }
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.PasteUnicode(); }
protected abstract void Execute(DnHexBox dnHexBox);
internal static bool CanExecute(DnHexBox dnHexBox) { return dnHexBox != null && GetBlobData(ClipboardUtils.GetData()) != null; }
protected virtual void Initialize(DnHexBox dnHexBox, MenuItem menuItem) { }
protected override bool IsEnabled(DnHexBox dnHexBox) { return CanExecute(dnHexBox); }
protected virtual bool IsEnabled(DnHexBox dnHexBox) { return(IsVisible(dnHexBox)); }
protected override void Execute(DnHexBox dnHexBox) { Execute2(dnHexBox); }
protected abstract bool IsVisible(DnHexBox dnHexBox);
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.LowerCaseHex = !(dnHexBox.LowerCaseHex ?? HexSettings.Instance.LowerCaseHex); }
protected override void Execute(DnHexBox dnHexBox) { Execute2(dnHexBox); }
protected override void Execute(DnHexBox dnHexBox) { var data = new LocalSettingsVM(new LocalHexSettings(dnHexBox)); var win = new LocalSettingsDlg(); win.DataContext = data; win.Owner = MainWindow.Instance; if (win.ShowDialog() != true) return; data.CreateLocalHexSettings().CopyTo(dnHexBox); }
protected override void Initialize(DnHexBox dnHexBox, MenuItem menuItem) { menuItem.IsChecked = dnHexBox.ShowAscii ?? HexSettings.Instance.ShowAscii; }
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.CopyUnicodeString(); }
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.CopyVBArray(); }
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.CopyUIContents(); }
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.CopyUnicodeString(); }
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.PasteUtf8(); }
protected override bool IsEnabled(DnHexBox dnHexBox) { return(dnHexBox.Selection != null); }
protected override bool IsEnabled(DnHexBox dnHexBox) { return dnHexBox.CanPasteUnicode(); }
internal static bool CanExecute(DnHexBox dnHexBox) { return dnHexBox != null && dnHexBox.Document != null; }
internal static void Execute2(DnHexBox dnHexBox) { if (!CanExecute(dnHexBox)) return; var data = GetBlobData(ClipboardUtils.GetData()); if (data != null) dnHexBox.Paste(data); }
protected override void Initialize(DnHexBox dnHexBox, MenuItem menuItem) { menuItem.IsChecked = dnHexBox.LowerCaseHex ?? HexSettings.Instance.LowerCaseHex; }
protected override bool IsVisible(DnHexBox dnHexBox) { return true; }
protected override void Initialize(DnHexBox dnHexBox, MenuItem menuItem) { menuItem.IsChecked = dnHexBox.UseHexPrefix ?? HexSettings.Instance.UseHexPrefix; }
protected virtual void Initialize(DnHexBox dnHexBox, MenuItem menuItem) { }
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.ShowAscii = !(dnHexBox.ShowAscii ?? HexSettings.Instance.ShowAscii); }
protected abstract bool IsVisible(DnHexBox dnHexBox);
protected override void Initialize(DnHexBox dnHexBox, MenuItem menuItem) { menuItem.IsChecked = dnHexBox.ShowAscii ?? HexSettings.Instance.ShowAscii; }
protected override bool IsVisible(DnHexBox dnHexBox) { return CanExecute(dnHexBox); }
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.CopyOffset(); }
internal static void Execute2(DnHexBox dnHexBox) { if (!CanExecute(dnHexBox)) return; var data = new GoToOffsetVM(dnHexBox.PhysicalToVisibleOffset(dnHexBox.CaretPosition.Offset), dnHexBox.PhysicalToVisibleOffset(dnHexBox.StartOffset), dnHexBox.PhysicalToVisibleOffset(dnHexBox.EndOffset)); var win = new GoToOffsetDlg(); win.DataContext = data; win.Owner = MainWindow.Instance; if (dnHexBox.IsMemory) { win.Title = "Go to Address"; win.offsetLabel.Content = "_Address"; } else { win.Title = "Go to Offset"; win.offsetLabel.Content = "O_ffset"; } if (win.ShowDialog() != true) return; dnHexBox.CaretPosition = new HexBoxPosition(dnHexBox.VisibleToPhysicalOffset(data.OffsetVM.Value), dnHexBox.CaretPosition.Kind, 0); }
protected override void Execute(DnHexBox dnHexBox) { dnHexBox.LowerCaseHex = !(dnHexBox.LowerCaseHex ?? HexSettings.Instance.LowerCaseHex); }