diff --git a/.gitignore b/.gitignore index 3e759b75..63ed14cb 100644 --- a/.gitignore +++ b/.gitignore @@ -236,7 +236,7 @@ Generated_Code/ # to a newer Visual Studio version. Backup files are not needed, # because we have git ;-) _UpgradeReport_Files/ -Backup*/ +#Backup*/ UpgradeLog*.XML UpgradeLog*.htm ServiceFabricBackup/ diff --git a/FModel.sln b/FModel.sln index 945e05f0..fb6bcab7 100644 --- a/FModel.sln +++ b/FModel.sln @@ -1,37 +1,25 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 -VisualStudioVersion = 16.0.28803.202 +VisualStudioVersion = 16.0.28803.452 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FModel", "FModel\FModel.csproj", "{8FABCD3A-9D55-4B54-B237-B259D815DEB8}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FModel", "FModel\FModel.csproj", "{8AAB27BD-18D7-4164-8BBC-AB534D55D30F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8FABCD3A-9D55-4B54-B237-B259D815DEB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8FABCD3A-9D55-4B54-B237-B259D815DEB8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8FABCD3A-9D55-4B54-B237-B259D815DEB8}.Debug|x64.ActiveCfg = Debug|x64 - {8FABCD3A-9D55-4B54-B237-B259D815DEB8}.Debug|x64.Build.0 = Debug|x64 - {8FABCD3A-9D55-4B54-B237-B259D815DEB8}.Debug|x86.ActiveCfg = Debug|x86 - {8FABCD3A-9D55-4B54-B237-B259D815DEB8}.Debug|x86.Build.0 = Debug|x86 - {8FABCD3A-9D55-4B54-B237-B259D815DEB8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8FABCD3A-9D55-4B54-B237-B259D815DEB8}.Release|Any CPU.Build.0 = Release|Any CPU - {8FABCD3A-9D55-4B54-B237-B259D815DEB8}.Release|x64.ActiveCfg = Release|x64 - {8FABCD3A-9D55-4B54-B237-B259D815DEB8}.Release|x64.Build.0 = Release|x64 - {8FABCD3A-9D55-4B54-B237-B259D815DEB8}.Release|x86.ActiveCfg = Release|x86 - {8FABCD3A-9D55-4B54-B237-B259D815DEB8}.Release|x86.Build.0 = Release|x86 + {8AAB27BD-18D7-4164-8BBC-AB534D55D30F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8AAB27BD-18D7-4164-8BBC-AB534D55D30F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8AAB27BD-18D7-4164-8BBC-AB534D55D30F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8AAB27BD-18D7-4164-8BBC-AB534D55D30F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {3D4827DE-E5BC-4FA0-9D6B-6804C8F3BA96} + SolutionGuid = {42CA5618-EB78-4DDF-95A4-BD589CC52791} EndGlobalSection EndGlobal diff --git a/FModel/App.config b/FModel/App.config index c32c8ca7..89e07837 100644 --- a/FModel/App.config +++ b/FModel/App.config @@ -6,77 +6,77 @@ - + - + - + - - False - - + - - 0 - - - 1 - - - False - - - - - - 1 - - - 0 - - - False - - - False - - - - - - True - - - English - - - - - - - - - False - - - - - - 1 - - - 50,50,50 - - + Default - + + English + + + False + + + False + + + + + + 0 + + + 0 + + + 3 + + + 3 + + + {BundleName} - {Date} + + + False + + + + + + 0 + + + False + + + True + + + False + + + True + + + 21:32:43 + + + 29:161:242 + + True @@ -84,8 +84,8 @@ - - + + diff --git a/FModel/App.xaml b/FModel/App.xaml new file mode 100644 index 00000000..f780ac10 --- /dev/null +++ b/FModel/App.xaml @@ -0,0 +1,18 @@ + + + + + + + + + + + + diff --git a/FModel/App.xaml.cs b/FModel/App.xaml.cs new file mode 100644 index 00000000..f7652b44 --- /dev/null +++ b/FModel/App.xaml.cs @@ -0,0 +1,18 @@ +using FModel.Methods.MessageBox; +using System.Windows; + +namespace FModel +{ + /// + /// Logique d'interaction pour App.xaml + /// + public partial class App : Application + { + void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) + { + string errorMessage = string.Format("An unhandled exception occurred: {0}", e.Exception.Message); + DarkMessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error); + e.Handled = true; + } + } +} diff --git a/FModel/Commands/FModel_Commands.cs b/FModel/Commands/FModel_Commands.cs new file mode 100644 index 00000000..17503699 --- /dev/null +++ b/FModel/Commands/FModel_Commands.cs @@ -0,0 +1,12 @@ +using System.Windows.Input; + +namespace FModel.Commands +{ + static class FModel_Commands + { + public static readonly RoutedUICommand OpenSettings = new RoutedUICommand("Open Settings Window", "OpenSettings", typeof(MainWindow)); + public static readonly RoutedUICommand OpenSearch = new RoutedUICommand("Open Search Window", "OpenSearch", typeof(MainWindow)); + public static readonly RoutedUICommand OpenOutput = new RoutedUICommand("Open Output Folder", "OpenOutput", typeof(MainWindow)); + public static readonly RoutedUICommand MergeImages = new RoutedUICommand("Merge Images", "MergeImages", typeof(MainWindow)); + } +} diff --git a/FModel/Custom/JsonExtensions.cs b/FModel/Custom/JsonExtensions.cs deleted file mode 100644 index e8c1f48e..00000000 --- a/FModel/Custom/JsonExtensions.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; - -namespace FModel -{ - public static class JsonExtensions - { - public static List FindTokens(this JToken containerToken, string name) - { - List matches = new List(); - FindTokens(containerToken, name, matches); - return matches; - } - - private static void FindTokens(JToken containerToken, string name, List matches) - { - if (containerToken.Type == JTokenType.Object) - { - foreach (JProperty child in containerToken.Children()) - { - if (string.Equals(child.Name, name, StringComparison.CurrentCultureIgnoreCase)) - { - matches.Add(child.Value); - } - FindTokens(child.Value, name, matches); - } - } - else if (containerToken.Type == JTokenType.Array) - { - foreach (JToken child in containerToken.Children()) - { - FindTokens(child, name, matches); - } - } - } - } -} diff --git a/FModel/Custom/TypeAssistant.cs b/FModel/Custom/TypeAssistant.cs deleted file mode 100644 index c8519775..00000000 --- a/FModel/Custom/TypeAssistant.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Threading; - -namespace FModel -{ - public class TypeAssistant - { - public event EventHandler Idled = delegate { }; - public int WaitingMilliSeconds { get; set; } - Timer _waitingTimer; - - public TypeAssistant(int waitingMilliSeconds = 600) - { - WaitingMilliSeconds = waitingMilliSeconds; - _waitingTimer = new Timer(p => - { - Idled(this, EventArgs.Empty); - }); - } - public void TextChanged() - { - _waitingTimer.Change(WaitingMilliSeconds, Timeout.Infinite); - } - } -} diff --git a/FModel/DLLs/ScintillaNET FindReplaceDialog.dll b/FModel/DLLs/ScintillaNET FindReplaceDialog.dll deleted file mode 100644 index 45659b0f..00000000 Binary files a/FModel/DLLs/ScintillaNET FindReplaceDialog.dll and /dev/null differ diff --git a/FModel/DLLs/csharp-wick.dll b/FModel/DLLs/csharp-wick.dll deleted file mode 100644 index 48dc32a1..00000000 Binary files a/FModel/DLLs/csharp-wick.dll and /dev/null differ diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index f922844f..5c0df7d5 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -4,16 +4,34 @@ Debug AnyCPU - {8FABCD3A-9D55-4B54-B237-B259D815DEB8} + {8AAB27BD-18D7-4164-8BBC-AB534D55D30F} WinExe FModel FModel - v4.7.1 + v4.7.2 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 true true + + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true x64 @@ -24,259 +42,460 @@ DEBUG;TRACE prompt 4 + true - AnyCPU + x64 pdbonly true bin\Release\ TRACE prompt 4 + true + false - FModel.ico + Logo.ico FModel.Program - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - true - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - true - - - true - bin\x86\Debug\ - DEBUG;TRACE - full - x86 - prompt - MinimumRecommendedRules.ruleset - true - - - bin\x86\Release\ - TRACE - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset - true - - - ..\packages\Autoupdater.NET.Official.1.5.4\lib\net40\AutoUpdater.NET.dll + + ..\packages\Autoupdater.NET.Official.1.5.7\lib\net40\AutoUpdater.NET.dll - - False - DLLs\csharp-wick.dll + + ..\packages\HtmlAgilityPack.1.11.16\lib\Net45\HtmlAgilityPack.dll - - ..\packages\Cyotek.Windows.Forms.ColorPicker.1.7.2\lib\net35\Cyotek.Windows.Forms.ColorPicker.dll - - - ..\packages\HtmlAgilityPack.1.11.12\lib\Net45\HtmlAgilityPack.dll + + ..\packages\AvalonEdit.6.0.0\lib\net45\ICSharpCode.AvalonEdit.dll ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll + + ..\packages\Ookii.Dialogs.Wpf.1.1.0\lib\net45\Ookii.Dialogs.Wpf.dll + ..\packages\RestSharp.106.6.10\lib\net452\RestSharp.dll - - False - DLLs\ScintillaNET FindReplaceDialog.dll - - - ..\packages\jacobslusser.ScintillaNET.3.6.3\lib\net40\ScintillaNET.dll + + ..\packages\SkiaSharp.1.68.0\lib\net45\SkiaSharp.dll - - - - - - - - + - + + + + + + + + + 4.0 + + + + + + ..\packages\WriteableBitmapEx.1.6.3\lib\net40\WriteableBitmapEx.Wpf.dll + - - Form - - - MergeImages.cs - - - - - - Form - - - AESManager.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - Form - - - About.cs - - - Form - - - SearchFiles.cs - - - Form - - - Settings.cs - - - Form - - - UpdateModeSettings.cs - - - Form - - - MainWindow.cs - - - - - - - - - About.cs - - - AESManager.cs - - - MergeImages.cs - - - SearchFiles.cs - - - Settings.cs - - - UpdateModeSettings.cs - - - MainWindow.cs - - - ResXFileCodeGenerator + + MSBuild:Compile Designer - Resources.Designer.cs - - - - SettingsSingleFileGenerator - Settings.Designer.cs - + + + + AESManager.xaml + + + + + + + ColorPickerControl.xaml + + + + ColorPickerSwatch.xaml + + + ColorPickerWindow.xaml + + + ColorPickRow.xaml + + + SliderRow.xaml + + + FModel_About.xaml + + + FModel_CustomMB.xaml + + + FModel_ImagesMerger.xaml + + + FModel_SearchFiles.xaml + + + FModel_Settings.xaml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FindReplaceWindow.xaml + + + FindWindow.xaml + + + GiveByteWindow.xaml + + + HexBox.xaml + + + + HexEditor.xaml + + + HexViewer.xaml + + + ReplaceByteWindow.xaml + + + + + + + + + + + + + + + + + + + + + + + + + FindReplaceDialog.xaml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True True Resources.resx + + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + FModel_Main.xaml + Code + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + + + Code + True Settings.settings True + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + - - Always - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + False + Microsoft .NET Framework 4.7.2 %28x86 et x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -285,8 +504,11 @@ - - - - + + + + Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : {0}. + + + \ No newline at end of file diff --git a/FModel/FModel.ico b/FModel/FModel.ico deleted file mode 100644 index e2328d8a..00000000 Binary files a/FModel/FModel.ico and /dev/null differ diff --git a/FModel/FModel_Main.xaml b/FModel/FModel_Main.xaml new file mode 100644 index 00000000..c326a826 --- /dev/null +++ b/FModel/FModel_Main.xaml @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FModel/Forms/FModel_CustomMB.xaml.cs b/FModel/Forms/FModel_CustomMB.xaml.cs new file mode 100644 index 00000000..ca68b44d --- /dev/null +++ b/FModel/Forms/FModel_CustomMB.xaml.cs @@ -0,0 +1,234 @@ +using FModel.Methods.Utilities; +using System.Drawing; +using System.Windows; +using System.Windows.Media; + +namespace FModel.Forms +{ + /// + /// Logique d'interaction pour FModel_CustomMB.xaml + /// + internal partial class FModel_CustomMB : Window + { + internal string Caption + { + get + { + return Title; + } + set + { + Title = value; + } + } + + internal string Message + { + get + { + return TextBlock_Message.Text; + } + set + { + TextBlock_Message.Text = value; + } + } + + internal string OkButtonText + { + get + { + return Label_Ok.Content.ToString(); + } + set + { + Label_Ok.Content = value.TryAddKeyboardAccellerator(); + } + } + + internal string CancelButtonText + { + get + { + return Label_Cancel.Content.ToString(); + } + set + { + Label_Cancel.Content = value.TryAddKeyboardAccellerator(); + } + } + + internal string YesButtonText + { + get + { + return Label_Yes.Content.ToString(); + } + set + { + Label_Yes.Content = value.TryAddKeyboardAccellerator(); + } + } + + internal string NoButtonText + { + get + { + return Label_No.Content.ToString(); + } + set + { + Label_No.Content = value.TryAddKeyboardAccellerator(); + } + } + + public MessageBoxResult Result { get; set; } + + internal FModel_CustomMB(string message) + { + InitializeComponent(); + this.SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display); + + Message = message; + Image_MessageBox.Visibility = System.Windows.Visibility.Collapsed; + DisplayButtons(MessageBoxButton.OK); + } + + internal FModel_CustomMB(string message, string caption) + { + InitializeComponent(); + + Message = message; + Caption = caption; + Image_MessageBox.Visibility = System.Windows.Visibility.Collapsed; + DisplayButtons(MessageBoxButton.OK); + } + + internal FModel_CustomMB(string message, string caption, MessageBoxButton button) + { + InitializeComponent(); + + Message = message; + Caption = caption; + Image_MessageBox.Visibility = System.Windows.Visibility.Collapsed; + + DisplayButtons(button); + } + + internal FModel_CustomMB(string message, string caption, MessageBoxImage image) + { + InitializeComponent(); + + Message = message; + Caption = caption; + DisplayImage(image); + DisplayButtons(MessageBoxButton.OK); + } + + internal FModel_CustomMB(string message, string caption, MessageBoxButton button, MessageBoxImage image) + { + InitializeComponent(); + + Message = message; + Caption = caption; + Image_MessageBox.Visibility = System.Windows.Visibility.Collapsed; + + DisplayButtons(button); + DisplayImage(image); + } + + private void DisplayButtons(MessageBoxButton button) + { + switch (button) + { + case MessageBoxButton.OKCancel: + // Hide all but OK, Cancel + Button_OK.Visibility = System.Windows.Visibility.Visible; + Button_OK.Focus(); + Button_Cancel.Visibility = System.Windows.Visibility.Visible; + + Button_Yes.Visibility = System.Windows.Visibility.Collapsed; + Button_No.Visibility = System.Windows.Visibility.Collapsed; + break; + case MessageBoxButton.YesNo: + // Hide all but Yes, No + Button_Yes.Visibility = System.Windows.Visibility.Visible; + Button_Yes.Focus(); + Button_No.Visibility = System.Windows.Visibility.Visible; + + Button_OK.Visibility = System.Windows.Visibility.Collapsed; + Button_Cancel.Visibility = System.Windows.Visibility.Collapsed; + break; + case MessageBoxButton.YesNoCancel: + // Hide only OK + Button_Yes.Visibility = System.Windows.Visibility.Visible; + Button_Yes.Focus(); + Button_No.Visibility = System.Windows.Visibility.Visible; + Button_Cancel.Visibility = System.Windows.Visibility.Visible; + + Button_OK.Visibility = System.Windows.Visibility.Collapsed; + break; + default: + // Hide all but OK + Button_OK.Visibility = System.Windows.Visibility.Visible; + Button_OK.Focus(); + + Button_Yes.Visibility = System.Windows.Visibility.Collapsed; + Button_No.Visibility = System.Windows.Visibility.Collapsed; + Button_Cancel.Visibility = System.Windows.Visibility.Collapsed; + break; + } + } + + private void DisplayImage(MessageBoxImage image) + { + Icon icon; + + switch (image) + { + case MessageBoxImage.Exclamation: // Enumeration value 48 - also covers "Warning" + icon = SystemIcons.Exclamation; + break; + case MessageBoxImage.Error: // Enumeration value 16, also covers "Hand" and "Stop" + icon = SystemIcons.Hand; + break; + case MessageBoxImage.Information: // Enumeration value 64 - also covers "Asterisk" + icon = SystemIcons.Information; + break; + case MessageBoxImage.Question: + icon = SystemIcons.Question; + break; + default: + icon = SystemIcons.Information; + break; + } + + Image_MessageBox.Source = icon.ToImageSource(); + Image_MessageBox.Visibility = System.Windows.Visibility.Visible; + } + + private void Button_OK_Click(object sender, RoutedEventArgs e) + { + Result = MessageBoxResult.OK; + Close(); + } + + private void Button_Cancel_Click(object sender, RoutedEventArgs e) + { + Result = MessageBoxResult.Cancel; + Close(); + } + + private void Button_Yes_Click(object sender, RoutedEventArgs e) + { + Result = MessageBoxResult.Yes; + Close(); + } + + private void Button_No_Click(object sender, RoutedEventArgs e) + { + Result = MessageBoxResult.No; + Close(); + } + } +} diff --git a/FModel/Forms/FModel_ImagesMerger.xaml b/FModel/Forms/FModel_ImagesMerger.xaml new file mode 100644 index 00000000..e4bcd6db --- /dev/null +++ b/FModel/Forms/FModel_ImagesMerger.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/FModel/Forms/HexViewer/FindReplaceWindow.xaml.cs b/FModel/Forms/HexViewer/FindReplaceWindow.xaml.cs new file mode 100644 index 00000000..e3521307 --- /dev/null +++ b/FModel/Forms/HexViewer/FindReplaceWindow.xaml.cs @@ -0,0 +1,84 @@ +using System.IO; +using System.Windows; + +namespace WpfHexaEditor.Dialog +{ + /// + /// Logique d'interaction pour FindReplaceWindow.xaml + /// + public partial class FindReplaceWindow + { + private readonly HexEditor _parent; + + public FindReplaceWindow(HexEditor parent, byte[] findData = null) + { + InitializeComponent(); + + //Parent hexeditor for "binding" search + _parent = parent; + + InitializeMStream(FindHexEdit, findData); + InitializeMStream(ReplaceHexEdit); + } + + #region Events + private void ClearButton_Click(object sender, RoutedEventArgs e) => InitializeMStream(FindHexEdit); + private void ClearReplaceButton_Click(object sender, RoutedEventArgs e) => InitializeMStream(ReplaceHexEdit); + private void CloseButton_Click(object sender, RoutedEventArgs e) => Close(); + + private void FindAllButton_Click(object sender, RoutedEventArgs e) => + _parent?.FindAll(FindHexEdit.GetAllBytes(), HighlightMenuItem.IsChecked); + + private void FindFirstButton_Click(object sender, RoutedEventArgs e) => + _parent?.FindFirst(FindHexEdit.GetAllBytes(), 0, HighlightMenuItem.IsChecked); + + private void FindNextButton_Click(object sender, RoutedEventArgs e) => + _parent?.FindNext(FindHexEdit.GetAllBytes(), HighlightMenuItem.IsChecked); + + private void FindLastButton_Click(object sender, RoutedEventArgs e) => + _parent?.FindLast(FindHexEdit.GetAllBytes(), HighlightMenuItem.IsChecked); + + private void ReplaceButton_Click(object sender, RoutedEventArgs e) => + _parent?.ReplaceFirst(FindHexEdit.GetAllBytes(), ReplaceHexEdit.GetAllBytes(), + TrimMenuItem.IsChecked, HighlightMenuItem.IsChecked); + + private void ReplaceNextButton_Click(object sender, RoutedEventArgs e) => + _parent?.ReplaceNext(FindHexEdit.GetAllBytes(), ReplaceHexEdit.GetAllBytes(), + TrimMenuItem.IsChecked, HighlightMenuItem.IsChecked); + + private void ReplaceAllButton_Click(object sender, RoutedEventArgs e) => + _parent?.ReplaceAll(FindHexEdit.GetAllBytes(), ReplaceHexEdit.GetAllBytes(), + TrimMenuItem.IsChecked, HighlightMenuItem.IsChecked); + + private void ReplaceHexEdit_BytesDeleted(object sender, System.EventArgs e) => + InitializeMStream(ReplaceHexEdit, ReplaceHexEdit.GetAllBytes()); + + private void FindHexEdit_BytesDeleted(object sender, System.EventArgs e) => + InitializeMStream(FindHexEdit, FindHexEdit.GetAllBytes()); + + private void SettingButton_Click(object sender, RoutedEventArgs e) => SettingPopup.IsOpen = true; + + private void SettingMenuItem_Click(object sender, RoutedEventArgs e) => SettingPopup.IsOpen = false; + #endregion + + #region Methods + /// + /// Initialize stream and hexeditor + /// + private void InitializeMStream(HexEditor hexeditor, byte[] findData = null) + { + hexeditor.CloseProvider(); + + var ms = new MemoryStream(1); + + if (findData != null && findData.Length > 0) + foreach (byte b in findData) + ms.WriteByte(b); + else + ms.WriteByte(0); + + hexeditor.Stream = ms; + } + #endregion + } +} diff --git a/FModel/Forms/HexViewer/FindWindow.xaml b/FModel/Forms/HexViewer/FindWindow.xaml new file mode 100644 index 00000000..e6c67396 --- /dev/null +++ b/FModel/Forms/HexViewer/FindWindow.xaml @@ -0,0 +1,119 @@ + + + + + + +