private void SaveAsMenu_Click(object sender, RoutedEventArgs e) { var fileDialog = new SaveFileDialog(); if (fileDialog.ShowDialog() != null) { HexEdit.SubmitChanges(fileDialog.FileName, true); } }
private void CTableTBLDefaultASCIIButton_Click(object sender, RoutedEventArgs e) { Application.Current.MainWindow.Cursor = Cursors.Wait; HexEdit.TypeOfCharacterTable = CharacterTableType.TblFile; HexEdit.LoadDefaultTbl(); Application.Current.MainWindow.Cursor = null; }
private void CTableTblDefaultEBCDICButton_Click(object sender, RoutedEventArgs e) { Application.Current.MainWindow.Cursor = Cursors.Wait; HexEdit.TypeOfCharacterTable = CharacterTableType.TblFile; HexEdit.LoadDefaultTbl(DefaultCharacterTableType.EbcdicWithSpecialChar); Application.Current.MainWindow.Cursor = null; }
public Shell() { this.WindowState = WindowState.Maximized; InitializeComponent(); //Cuz xaml designer doesn't support generic type;We have to set the some bindings(valuetuple) in codebehind :(; HexEdit.SetBinding(DrawedHexEditor.CustomBackgroundBlocksProperty, new Binding(nameof(HexEdit.CustomBackgroundBlocks))); //CustomBackgroundBlocks = "{Binding CustomBackgroundBlocks}" //(this.DataContext as ShellViewModel).FileEditor = HexEdit; }
private void CloseFile() { if (FileTab.SelectedIndex == -1) { return; } HexEdit.CloseProvider(); FileTab.Items.RemoveAt(FileTab.SelectedIndex); }
public AddByteCommand(HexEdit hexEdit, long offset, byte data, bool overwrite, int inputIndex, int wordIndex, int wordSize) : base(hexEdit) { Overwrite = overwrite; _offset = offset; _data = data; hexEdit.Buffer.GetBytes(offset, 1, _oldData); _inputIndex = inputIndex; _wordIndex = wordIndex; _wordSize = wordSize; }
private void button2_Click(object sender, RoutedEventArgs e) { if (Findtextbox.Text != "") { HexEdit.FindLast(Findtextbox.Text); } else { MessageBox.Show("Enter string to find"); } }
private void CopyToStreamButton_Click(object sender, RoutedEventArgs e) { MemoryStream ms = new MemoryStream(); HexEdit.CopyToStream(ms, true); //ms.Position = 0; //File.WriteAllBytes(@"c:\test\test.exe", ms.ToArray()); MessageBox.Show(ByteConverters.BytesToString(ms.ToArray())); }
private void CTableTBLDefaultASCIIButton_Click(object sender, RoutedEventArgs e) { Application.Current.MainWindow.Cursor = Cursors.Wait; HexEdit.TypeOfCharacterTable = CharacterTableType.TBLFile; HexEdit.LoadDefaultTBL(WPFHexaEditor.Core.CharacterTable.DefaultCharacterTableType.ASCII); CTableASCIIButton.IsChecked = false; CTableTBLButton.IsChecked = false; CTableTBLDefaultASCIIButton.IsChecked = true; Application.Current.MainWindow.Cursor = null; }
private void SetPositionButton_Click(object sender, RoutedEventArgs e) { long position = 0; if (long.TryParse(PositionText.Text, out position)) { HexEdit.SetPosition(position, 1); } else { MessageBox.Show("Enter long value."); } }
private void GOPosition_Click(object sender, RoutedEventArgs e) { if (long.TryParse(PositionText.Text, out var position)) { HexEdit.SetPosition(position, 1); } else { MessageBox.Show("Enter long value."); } ViewMenu.IsSubmenuOpen = false; }
private void GOHexPosition_Click(object sender, RoutedEventArgs e) { var(success, position) = ByteConverters.HexLiteralToLong(PositionHexText.Text); if (success && position > 0) { HexEdit.SetPosition(position, 1); } else { MessageBox.Show("Enter hexa value."); } ViewMenu.IsSubmenuOpen = false; }
/// <summary> /// Button_Click_Ok /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click_Ok(object sender, RoutedEventArgs e) { try { DialogResult = true; FocusMessage = new byte[HexEdit.Stream.Length]; HexEdit.SubmitChanges(); FocusMessage = HexEdit.Stream.ToArray(); } catch (Exception ex) { _logger.Error(String.Format("Exception in {0} {1}", LST.GetCurrentMethod(), ex.Message)); } Close(); }
private void UpdateSetting(SettingEnum setting) { switch (setting) { case SettingEnum.HeaderVisibility: HexEdit.HeaderVisibility = !Settings.Default.HeaderVisibility ? Visibility.Collapsed : Visibility.Visible; Settings.Default.HeaderVisibility = HexEdit.HeaderVisibility == Visibility.Visible; break; case SettingEnum.ReadOnly: HexEdit.ReadOnlyMode = Settings.Default.ReadOnly; HexEdit.ClearAllChange(); HexEdit.RefreshView(); break; } }
private void CTableTBLButton_Click(object sender, RoutedEventArgs e) { var fileDialog = new OpenFileDialog(); if (fileDialog.ShowDialog() != null) { if (File.Exists(fileDialog.FileName)) { Application.Current.MainWindow.Cursor = Cursors.Wait; HexEdit.LoadTblFile(fileDialog.FileName); HexEdit.TypeOfCharacterTable = CharacterTableType.TblFile; CTableAsciiButton.IsChecked = false; CTableTblButton.IsChecked = true; CTableTblDefaultAsciiButton.IsChecked = false; Application.Current.MainWindow.Cursor = null; } } }
public FindDialogViewModel(Window dialog, MainViewModel mainViewModel) : base(dialog) { _mainViewModel = mainViewModel; SearchCommand = new DelegateCommand(() => { byte[] bytes; if (IsBytesSearch) { bytes = HexEdit.GetBytes(0, (int)HexEdit.Size); } else { Encoding encoding; if (IsAscii) { encoding = Encoding.ASCII; } else if (IsUTF8) { encoding = Encoding.UTF8; } else { encoding = Encoding.Unicode; } bytes = encoding.GetBytes(SearchString); } // initiate search var files = IsSearchFile ? Enumerable.Range(0, 1).Select(_ => _mainViewModel.SelectedFile) : _mainViewModel.OpenFiles; _finder = new ByteFinder(files, bytes, ByteFinderOptions.FromStart); RaisePropertyChanged(nameof(FindResults)); }, () => IsStringSearch && !string.IsNullOrEmpty(SearchString) || IsBytesSearch && HexEdit?.Size > 0) .ObservesProperty(() => IsStringSearch).ObservesProperty(() => IsBytesSearch).ObservesProperty(() => SearchString); GoToFindLocationCommand = new DelegateCommand <FindResultViewModel>(result => { _mainViewModel.SelectedFile = result.OpenFile; result.Editor.CaretOffset = result.Offset; }, result => result != null); }
private void CTableTBLButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); if (fileDialog.ShowDialog() != null) { if (File.Exists(fileDialog.FileName)) { Application.Current.MainWindow.Cursor = Cursors.Wait; HexEdit.LoadTBLFile(fileDialog.FileName); HexEdit.TypeOfCharacterTable = CharacterTable.TBLFile; CTableASCIIButton.IsChecked = false; CTableTBLButton.IsChecked = true; Application.Current.MainWindow.Cursor = null; } //else // MessageBox.Show("File not found!", Settings.Default.ApplicationName, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void UpdateSetting(SettingEnum setting) { switch (setting) { case SettingEnum.HeaderVisibility: if (!Settings.Default.HeaderVisibility) { HexEdit.HeaderVisibility = Visibility.Collapsed; } else { HexEdit.HeaderVisibility = Visibility.Visible; } Settings.Default.HeaderVisibility = HexEdit.HeaderVisibility == Visibility.Visible; break; case SettingEnum.ScrollVisibility: if (!Settings.Default.ScrollVisibility) { HexEdit.VerticalScrollBarVisibility = Visibility.Collapsed; } else { HexEdit.VerticalScrollBarVisibility = Visibility.Visible; } Settings.Default.ScrollVisibility = HexEdit.VerticalScrollBarVisibility == Visibility.Visible; break; case SettingEnum.ReadOnly: HexEdit.ReadOnlyMode = Settings.Default.ReadOnly; HexEdit.ClearAllChange(); HexEdit.RefreshView(); break; } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { HexEdit.CloseProvider(); Settings.Default.Save(); }
private void CloseFileMenu_Click(object sender, RoutedEventArgs e) => HexEdit.CloseProvider();
private void SelectAllButton_Click(object sender, RoutedEventArgs e) => HexEdit.SelectAll();
private void DeleteBookmark_Click(object sender, RoutedEventArgs e) => HexEdit.ClearScrollMarker(ScrollMarker.Bookmark);
private void FindAllSelection_Click(object sender, RoutedEventArgs e) => HexEdit.FindAllSelection(true);
private void UndoMenu_Click(object sender, RoutedEventArgs e) => HexEdit.Undo();
private void SetBookMarkButton_Click(object sender, RoutedEventArgs e) => HexEdit.SetBookMark();
private void HighlightSelectionClick(object sender, RoutedEventArgs e) { HexEdit.HighlightCurrentSelection(); }
private void HighlightBrushClick(object sender, RoutedEventArgs e) { HexEdit.HighlightCurrentSelection((sender as MenuItem).Background); }
private void DeleteSelectionMenu_Click(object sender, RoutedEventArgs e) => HexEdit.DeleteSelection();
private void CopyStringMenu_Click(object sender, RoutedEventArgs e) => HexEdit.CopyToClipboard();
private void CopyHexaMenu_Click(object sender, RoutedEventArgs e) => HexEdit.CopyToClipboard(CopyPasteMode.HexaString);