From cbf0891ba467ebec2dd40e9b34eb1f2d6379d7dd Mon Sep 17 00:00:00 2001 From: ItsTheSky Date: Thu, 9 Apr 2026 17:09:01 +0200 Subject: [PATCH] feat: added AvaloniaEdit for the text editor with basic highlight an line count, better "about" dialog and adde textmate --- .../bin/Debug/net8.0/GsaEditor.Core.dll | Bin 13312 -> 13312 bytes .../bin/Debug/net8.0/GsaEditor.Core.pdb | Bin 14956 -> 14956 bytes .../net8.0/GsaEditor.Core.AssemblyInfo.cs | 2 +- .../GsaEditor.Core.AssemblyInfoInputs.cache | 2 +- .../obj/Debug/net8.0/GsaEditor.Core.dll | Bin 13312 -> 13312 bytes .../obj/Debug/net8.0/GsaEditor.Core.pdb | Bin 14956 -> 14956 bytes .../obj/Debug/net8.0/ref/GsaEditor.Core.dll | Bin 7680 -> 7680 bytes .../Debug/net8.0/refint/GsaEditor.Core.dll | Bin 7680 -> 7680 bytes GsaEditor/App.axaml | 1 + GsaEditor/GsaEditor.csproj | 2 + GsaEditor/ViewModels/MainWindowViewModel.cs | 26 +- GsaEditor/Views/MainWindow.axaml | 14 +- GsaEditor/Views/MainWindow.axaml.cs | 65 ++++ .../Debug/net8.0/AvaloniaEdit.TextMate.dll | Bin 0 -> 23040 bytes GsaEditor/bin/Debug/net8.0/AvaloniaEdit.dll | Bin 0 -> 674816 bytes GsaEditor/bin/Debug/net8.0/GsaEditor.Core.dll | Bin 13312 -> 13312 bytes GsaEditor/bin/Debug/net8.0/GsaEditor.Core.pdb | Bin 14956 -> 14956 bytes .../bin/Debug/net8.0/GsaEditor.deps.json | 144 +++++++++ GsaEditor/bin/Debug/net8.0/GsaEditor.dll | Bin 81408 -> 84480 bytes GsaEditor/bin/Debug/net8.0/GsaEditor.exe | Bin 151552 -> 151552 bytes GsaEditor/bin/Debug/net8.0/GsaEditor.pdb | Bin 44572 -> 45548 bytes GsaEditor/bin/Debug/net8.0/Onigwrap.dll | Bin 0 -> 12288 bytes .../Debug/net8.0/TextMateSharp.Grammars.dll | Bin 0 -> 6567936 bytes GsaEditor/bin/Debug/net8.0/TextMateSharp.dll | Bin 0 -> 115712 bytes .../linux-arm64/native/libonigwrap.so | Bin 0 -> 534272 bytes .../linux-musl-arm64/native/libonigwrap.so | Bin 0 -> 529904 bytes .../linux-musl-x64/native/libonigwrap.so | Bin 0 -> 546528 bytes .../runtimes/linux-x64/native/libonigwrap.so | Bin 0 -> 546936 bytes .../runtimes/osx/native/libonigwrap.dylib | Bin 0 -> 1071912 bytes .../runtimes/win-arm64/native/libonigwrap.dll | Bin 0 -> 489472 bytes .../runtimes/win-x64/native/libonigwrap.dll | Bin 0 -> 521728 bytes .../runtimes/win-x86/native/libonigwrap.dll | Bin 0 -> 534016 bytes .../net8.0/Avalonia/Resources.Inputs.cache | 2 +- .../obj/Debug/net8.0/Avalonia/references | 5 + GsaEditor/obj/Debug/net8.0/Avalonia/resources | Bin 14798 -> 14928 bytes .../Debug/net8.0/GsaEditor.AssemblyInfo.cs | 2 +- .../net8.0/GsaEditor.AssemblyInfoInputs.cache | 2 +- .../obj/Debug/net8.0/GsaEditor.assets.cache | Bin 24632 -> 29360 bytes .../GsaEditor.csproj.AssemblyReference.cache | Bin 14222 -> 16477 bytes .../GsaEditor.csproj.CoreCompileInputs.cache | 2 +- .../GsaEditor.csproj.FileListAbsolute.txt | 13 + GsaEditor/obj/Debug/net8.0/GsaEditor.dll | Bin 81408 -> 84480 bytes GsaEditor/obj/Debug/net8.0/GsaEditor.pdb | Bin 44572 -> 45548 bytes GsaEditor/obj/Debug/net8.0/apphost.exe | Bin 151552 -> 151552 bytes GsaEditor/obj/Debug/net8.0/ref/GsaEditor.dll | Bin 16896 -> 16896 bytes .../obj/Debug/net8.0/refint/GsaEditor.dll | Bin 16896 -> 16896 bytes .../obj/GsaEditor.csproj.nuget.dgspec.json | 8 + GsaEditor/obj/GsaEditor.csproj.nuget.g.props | 1 + .../obj/GsaEditor.csproj.nuget.g.targets | 2 + GsaEditor/obj/project.assets.json | 280 ++++++++++++++++++ GsaEditor/obj/project.nuget.cache | 8 +- 51 files changed, 564 insertions(+), 17 deletions(-) create mode 100644 GsaEditor/bin/Debug/net8.0/AvaloniaEdit.TextMate.dll create mode 100644 GsaEditor/bin/Debug/net8.0/AvaloniaEdit.dll create mode 100644 GsaEditor/bin/Debug/net8.0/Onigwrap.dll create mode 100644 GsaEditor/bin/Debug/net8.0/TextMateSharp.Grammars.dll create mode 100644 GsaEditor/bin/Debug/net8.0/TextMateSharp.dll create mode 100644 GsaEditor/bin/Debug/net8.0/runtimes/linux-arm64/native/libonigwrap.so create mode 100644 GsaEditor/bin/Debug/net8.0/runtimes/linux-musl-arm64/native/libonigwrap.so create mode 100644 GsaEditor/bin/Debug/net8.0/runtimes/linux-musl-x64/native/libonigwrap.so create mode 100644 GsaEditor/bin/Debug/net8.0/runtimes/linux-x64/native/libonigwrap.so create mode 100644 GsaEditor/bin/Debug/net8.0/runtimes/osx/native/libonigwrap.dylib create mode 100644 GsaEditor/bin/Debug/net8.0/runtimes/win-arm64/native/libonigwrap.dll create mode 100644 GsaEditor/bin/Debug/net8.0/runtimes/win-x64/native/libonigwrap.dll create mode 100644 GsaEditor/bin/Debug/net8.0/runtimes/win-x86/native/libonigwrap.dll diff --git a/GsaEditor.Core/bin/Debug/net8.0/GsaEditor.Core.dll b/GsaEditor.Core/bin/Debug/net8.0/GsaEditor.Core.dll index 4b60a8dc1bfbb5ed2802ebdacef9616107784ede..7e45f4aeef9c9d318ca05c826c68eade174f8fbe 100644 GIT binary patch delta 821 zcmXYvO=uHA6vyA}uC!td361B@oXmfTZE0v&(=ek*9ysVb%DO_Cs0+C^^BP11-=%%F`?#gyO} zv{L}6uAPL(u4=lkZi$+5K~<4 zy4>w>y(`GvKCcIYOxfW58@&G$*LMV&`-9i}f~eFLAZ$w_$eLur4kQzHAeHMXVS1eF zajuuRUKV6-g}W8z(!tny8#m+bz98!XiSH%IlyP3Gf=ns#x-7_)Ca*i3ea@fK3Yb)j zl!v2AAAeC)@!OHo$95IK`cIFOHUI47HzGfVNqS&tH#G1d$I}86 zXBUcKfdgqUpn&v{OOSy)&KA-E8;5~?F0>$v-5%0G#l|id6KKSIb-Z-+`lqM-uysIs G#?XH>;H?_~ delta 683 zcmXYvO=uHA6vyApByC#LrK0^vO>38c(eAo#M6k_45_4(A(h9+}>LDc_0u`%R{6N7C zh*;>M%exd0notV%AZQo#*a{-vJb9DSf`WKypnFtsJqR84}Z0|}-MWRf?T@+tBu z@;UN(O_dfXEvOV5y(ebmW|Zz|svh99m!>j8c*DAWQp>p(E#*R)^Vy~J ztGgZD%NN(*@9761*MxTbV;$kmv7pcX&9H1AN5eU1G}WGZG&x>zUa)HzIw>|B^q=~| egbOXW>soj-gK|!>E%*P;C9}c7)4R-fTmJ#qUa`*r diff --git a/GsaEditor.Core/bin/Debug/net8.0/GsaEditor.Core.pdb b/GsaEditor.Core/bin/Debug/net8.0/GsaEditor.Core.pdb index 5b9285ba1d9377422851ac1149f3d77a7cd0ec85..3abb27e709606229316ad5178a18a214bfb9eb08 100644 GIT binary patch delta 69 zcmV-L0J{I|bnJAHd=&1x6gI~jTThD?VR9lWRuRZ2bi1*T&kG=B1g(RZ7OBH04V>WR bLm@khl1f8&SY$q2$B2eF0bWkCe+=y{Bmf;y delta 69 zcmV-L0J{I|bnJAHd=w6WZ~vuMzfXn>c#N$yi8|%R9tip1)GnSD`ON*xTW bLB^{u<%N>;c=e5+K(tadPq$>Ve+=y{)0ZOp diff --git a/GsaEditor.Core/obj/Debug/net8.0/GsaEditor.Core.AssemblyInfo.cs b/GsaEditor.Core/obj/Debug/net8.0/GsaEditor.Core.AssemblyInfo.cs index dfdd656..44a6762 100644 --- a/GsaEditor.Core/obj/Debug/net8.0/GsaEditor.Core.AssemblyInfo.cs +++ b/GsaEditor.Core/obj/Debug/net8.0/GsaEditor.Core.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("GsaEditor.Core")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d6d621dc92b3083d8e47827baa0ccf59d5b0a4c4")] [assembly: System.Reflection.AssemblyProductAttribute("GsaEditor.Core")] [assembly: System.Reflection.AssemblyTitleAttribute("GsaEditor.Core")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/GsaEditor.Core/obj/Debug/net8.0/GsaEditor.Core.AssemblyInfoInputs.cache b/GsaEditor.Core/obj/Debug/net8.0/GsaEditor.Core.AssemblyInfoInputs.cache index 222b3db..f61127c 100644 --- a/GsaEditor.Core/obj/Debug/net8.0/GsaEditor.Core.AssemblyInfoInputs.cache +++ b/GsaEditor.Core/obj/Debug/net8.0/GsaEditor.Core.AssemblyInfoInputs.cache @@ -1 +1 @@ -68387796343863a0e5c11cd0f612a1b364816551cf5816c6d556d410439a3710 +27416b735d6b5e6056e4f76966d345ebebb5a18e412e4170cdbcf381f9ab7092 diff --git a/GsaEditor.Core/obj/Debug/net8.0/GsaEditor.Core.dll b/GsaEditor.Core/obj/Debug/net8.0/GsaEditor.Core.dll index 4b60a8dc1bfbb5ed2802ebdacef9616107784ede..7e45f4aeef9c9d318ca05c826c68eade174f8fbe 100644 GIT binary patch delta 821 zcmXYvO=uHA6vyA}uC!td361B@oXmfTZE0v&(=ek*9ysVb%DO_Cs0+C^^BP11-=%%F`?#gyO} zv{L}6uAPL(u4=lkZi$+5K~<4 zy4>w>y(`GvKCcIYOxfW58@&G$*LMV&`-9i}f~eFLAZ$w_$eLur4kQzHAeHMXVS1eF zajuuRUKV6-g}W8z(!tny8#m+bz98!XiSH%IlyP3Gf=ns#x-7_)Ca*i3ea@fK3Yb)j zl!v2AAAeC)@!OHo$95IK`cIFOHUI47HzGfVNqS&tH#G1d$I}86 zXBUcKfdgqUpn&v{OOSy)&KA-E8;5~?F0>$v-5%0G#l|id6KKSIb-Z-+`lqM-uysIs G#?XH>;H?_~ delta 683 zcmXYvO=uHA6vyApByC#LrK0^vO>38c(eAo#M6k_45_4(A(h9+}>LDc_0u`%R{6N7C zh*;>M%exd0notV%AZQo#*a{-vJb9DSf`WKypnFtsJqR84}Z0|}-MWRf?T@+tBu z@;UN(O_dfXEvOV5y(ebmW|Zz|svh99m!>j8c*DAWQp>p(E#*R)^Vy~J ztGgZD%NN(*@9761*MxTbV;$kmv7pcX&9H1AN5eU1G}WGZG&x>zUa)HzIw>|B^q=~| egbOXW>soj-gK|!>E%*P;C9}c7)4R-fTmJ#qUa`*r diff --git a/GsaEditor.Core/obj/Debug/net8.0/GsaEditor.Core.pdb b/GsaEditor.Core/obj/Debug/net8.0/GsaEditor.Core.pdb index 5b9285ba1d9377422851ac1149f3d77a7cd0ec85..3abb27e709606229316ad5178a18a214bfb9eb08 100644 GIT binary patch delta 69 zcmV-L0J{I|bnJAHd=&1x6gI~jTThD?VR9lWRuRZ2bi1*T&kG=B1g(RZ7OBH04V>WR bLm@khl1f8&SY$q2$B2eF0bWkCe+=y{Bmf;y delta 69 zcmV-L0J{I|bnJAHd=w6WZ~vuMzfXn>c#N$yi8|%R9tip1)GnSD`ON*xTW bLB^{u<%N>;c=e5+K(tadPq$>Ve+=y{)0ZOp diff --git a/GsaEditor.Core/obj/Debug/net8.0/ref/GsaEditor.Core.dll b/GsaEditor.Core/obj/Debug/net8.0/ref/GsaEditor.Core.dll index 4c7eb2e8ece5cd53d4aa7b1449d0714f76eb4f10..3b897f711616492fd670165f9d47b9bf46ba17de 100644 GIT binary patch delta 492 zcmZWmze`(D6#h}iKemY5TYo&lH9!f23v$I4oU(YL>GPUUZv2Xg*xdHoGN56 z9*07q6{Ld@O5x$2sa*=yty9szz)f)Lc@LaChx46#zw@2T;hxT7XYuG`bmRD4zt^3n zL@$KQU_~Rj0#=GQ{ z2>D`O<&|x!rs@=pZa7{^)k~(nU9Q!gn&-Mo>zzu&R6OODb(wD_a!l#e@EiG%2Rq`xaPh_@WX(uY&MNh^514Ija*#H0l delta 375 zcmZp$X|S2l!4h`(^vQ`mGK^^xSBCS61TZl8GXOyX149J!L`7kq1_lNmApZwYRA#aw zlg{KwMt{bf$txMv86!4dWYlL8cv_XEv&z8SW5e&m0uvn^sx}L92GD9}QbjD<`NCQ}8 z0hnA27GDe!pB&F4t~#BOnGvK*nGvL38O(NI1exFr7I6lNOrFit$v&NN0Si#gW^G}3~ZC%OKDHelb#IJ6T%5J4-|eG2H;?s HXuu8tHDzDa diff --git a/GsaEditor.Core/obj/Debug/net8.0/refint/GsaEditor.Core.dll b/GsaEditor.Core/obj/Debug/net8.0/refint/GsaEditor.Core.dll index 4c7eb2e8ece5cd53d4aa7b1449d0714f76eb4f10..3b897f711616492fd670165f9d47b9bf46ba17de 100644 GIT binary patch delta 492 zcmZWmze`(D6#h}iKemY5TYo&lH9!f23v$I4oU(YL>GPUUZv2Xg*xdHoGN56 z9*07q6{Ld@O5x$2sa*=yty9szz)f)Lc@LaChx46#zw@2T;hxT7XYuG`bmRD4zt^3n zL@$KQU_~Rj0#=GQ{ z2>D`O<&|x!rs@=pZa7{^)k~(nU9Q!gn&-Mo>zzu&R6OODb(wD_a!l#e@EiG%2Rq`xaPh_@WX(uY&MNh^514Ija*#H0l delta 375 zcmZp$X|S2l!4h`(^vQ`mGK^^xSBCS61TZl8GXOyX149J!L`7kq1_lNmApZwYRA#aw zlg{KwMt{bf$txMv86!4dWYlL8cv_XEv&z8SW5e&m0uvn^sx}L92GD9}QbjD<`NCQ}8 z0hnA27GDe!pB&F4t~#BOnGvK*nGvL38O(NI1exFr7I6lNOrFit$v&NN0Si#gW^G}3~ZC%OKDHelb#IJ6T%5J4-|eG2H;?s HXuu8tHDzDa diff --git a/GsaEditor/App.axaml b/GsaEditor/App.axaml index b28a7e1..16df790 100644 --- a/GsaEditor/App.axaml +++ b/GsaEditor/App.axaml @@ -5,5 +5,6 @@ + diff --git a/GsaEditor/GsaEditor.csproj b/GsaEditor/GsaEditor.csproj index fd5035f..4baa241 100644 --- a/GsaEditor/GsaEditor.csproj +++ b/GsaEditor/GsaEditor.csproj @@ -23,6 +23,8 @@ All + + diff --git a/GsaEditor/ViewModels/MainWindowViewModel.cs b/GsaEditor/ViewModels/MainWindowViewModel.cs index 0ba3ee6..fad9cbd 100644 --- a/GsaEditor/ViewModels/MainWindowViewModel.cs +++ b/GsaEditor/ViewModels/MainWindowViewModel.cs @@ -1,4 +1,5 @@ using System.Collections.ObjectModel; +using System.Reflection; using System.Text; using Avalonia.Controls; using Avalonia.Media.Imaging; @@ -627,14 +628,24 @@ public partial class MainWindowViewModel : ViewModelBase [RelayCommand] private void SaveEdit() { - if (SelectedNode?.Entry == null || PreviewText == null) return; + if (SelectedNode?.Entry == null) return; + + // Get the current text from the AvaloniaEdit editor via the window + string? editorText = null; + if (_window is GsaEditor.Views.MainWindow mainWindow) + { + editorText = mainWindow.GetEditorText(); + } + + if (editorText == null) editorText = PreviewText ?? string.Empty; var entry = SelectedNode.Entry; - var newData = Encoding.UTF8.GetBytes(PreviewText); + var newData = Encoding.UTF8.GetBytes(editorText); entry.SetData(newData, entry.IsCompressed); IsDirty = true; IsEditingText = false; + PreviewText = editorText; var entryVm = new EntryViewModel(entry); entryVm.OnModified = () => { IsDirty = true; NotifyStatusChanged(); }; @@ -660,8 +671,17 @@ public partial class MainWindowViewModel : ViewModelBase private async Task ShowAbout() { if (_window == null) return; + + var appVersion = Assembly.GetExecutingAssembly().GetName().Version; + var versionStr = appVersion != null ? $"{appVersion.Major}.{appVersion.Minor}.{appVersion.Build}" : "1.0.0"; + var avaloniaVersion = typeof(Avalonia.Application).Assembly.GetName().Version; + var avaloniaStr = avaloniaVersion != null ? $"{avaloniaVersion.Major}.{avaloniaVersion.Minor}.{avaloniaVersion.Build}" : "unknown"; + await Dialogs.ShowMessageAsync(_window, "About GsaEditor", - "GsaEditor v1.0\n\nGSA Archive Viewer & Editor\nBuilt with Avalonia UI"); + $"GsaEditor v{versionStr}\n\n" + + $"GSA Archive Viewer & Editor\n" + + $"By Develter Innovation (Nicolas RACOT)\n\n" + + $"Built with Avalonia UI v{avaloniaStr}"); } // ========================================================================= diff --git a/GsaEditor/Views/MainWindow.axaml b/GsaEditor/Views/MainWindow.axaml index 58d2f87..935ba7d 100644 --- a/GsaEditor/Views/MainWindow.axaml +++ b/GsaEditor/Views/MainWindow.axaml @@ -3,6 +3,7 @@ xmlns:vm="using:GsaEditor.ViewModels" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:aedit="https://github.com/avaloniaui/avaloniaedit" mc:Ignorable="d" d:DesignWidth="1100" d:DesignHeight="700" x:Class="GsaEditor.Views.MainWindow" x:CompileBindings="False" @@ -199,13 +200,12 @@