From 455125576a416ebdd585c7c58b2c616d6fd2ae56 Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Sat, 25 Dec 2021 01:17:01 -0500 Subject: [PATCH] its 1am idk man, I did some things. Patch Generator WIP --- .gitattributes | 1 + Patcher/PatcherUtils/PatchHelper.cs | 3 +- .../Patcher/PatchClient/PatchClient.csproj | 1 + Patcher/_port/Patcher/PatchClient/Program.cs | 1 - .../ViewModels/MainWindowViewModel.cs | 2 +- .../ViewModels/MessageViewModel.cs | 3 +- .../ViewModels/PatcherViewModel.cs | 6 +- .../PatchClient/ViewModels/ViewModelBase.cs | 6 +- .../PatchClient/Views/MessageView.axaml.cs | 1 - .../PatchClient/Views/PatcherView.axaml.cs | 1 - .../PatchGenerator/Assets/Styles.axaml | 70 ++++++++++++- .../AttachedProperties/RandomBoolAttProp.cs | 24 +++++ .../CustomControls/FolderSelector.axaml | 38 +++++++ .../CustomControls/FolderSelector.axaml.cs | 69 +++++++++++++ .../Helpers/PatchItemDefinitions.cs | 16 +++ .../PatchGenerator/Models/GenStartupArgs.cs | 61 +++++++++++ .../PatchGenerator/Models/PatchGenInfo.cs | 66 ++++++++++++ .../PatchGenerator/Models/PatchItem.cs | 40 ++++++++ .../PatchGenerator - Backup.csproj | 43 ++++++++ .../PatchGenerator/PatchGenerator.csproj | 13 ++- .../_port/Patcher/PatchGenerator/Program.cs | 1 - .../Patcher/PatchGenerator/Resources/7za.exe | Bin 0 -> 739840 bytes .../PatchGenerator/Resources/PatchClient.exe | 3 + .../PatchGenerator/Resources/xdelta3.exe | Bin 0 -> 624463 bytes .../ViewModels/OptionsViewModel.cs | 27 ++++- .../ViewModels/PatchGenerationViewModel.cs | 97 +++++++++++++++++- .../ViewModels/ViewModelBase.cs | 3 - .../PatchGenerator/Views/OptionsView.axaml | 26 ++++- .../PatchGenerator/Views/OptionsView.axaml.cs | 1 - .../Views/PatchGenerationView.axaml | 66 +++++++++++- .../Views/PatchGenerationView.axaml.cs | 15 ++- .../Patcher/PatcherUtils/LazyOperations.cs | 9 +- .../_port/Patcher/PatcherUtils/PatchHelper.cs | 33 +++--- 33 files changed, 691 insertions(+), 55 deletions(-) create mode 100644 .gitattributes create mode 100644 Patcher/_port/Patcher/PatchGenerator/AttachedProperties/RandomBoolAttProp.cs create mode 100644 Patcher/_port/Patcher/PatchGenerator/CustomControls/FolderSelector.axaml create mode 100644 Patcher/_port/Patcher/PatchGenerator/CustomControls/FolderSelector.axaml.cs create mode 100644 Patcher/_port/Patcher/PatchGenerator/Helpers/PatchItemDefinitions.cs create mode 100644 Patcher/_port/Patcher/PatchGenerator/Models/GenStartupArgs.cs create mode 100644 Patcher/_port/Patcher/PatchGenerator/Models/PatchGenInfo.cs create mode 100644 Patcher/_port/Patcher/PatchGenerator/Models/PatchItem.cs create mode 100644 Patcher/_port/Patcher/PatchGenerator/PatchGenerator - Backup.csproj create mode 100644 Patcher/_port/Patcher/PatchGenerator/Resources/7za.exe create mode 100644 Patcher/_port/Patcher/PatchGenerator/Resources/PatchClient.exe create mode 100644 Patcher/_port/Patcher/PatchGenerator/Resources/xdelta3.exe diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..93c4578 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +/Patcher/_port/Patcher/PatchGenerator/Resources/PatchClient.exe filter=lfs diff=lfs merge=lfs -text diff --git a/Patcher/PatcherUtils/PatchHelper.cs b/Patcher/PatcherUtils/PatchHelper.cs index 29395de..2d34e18 100644 --- a/Patcher/PatcherUtils/PatchHelper.cs +++ b/Patcher/PatcherUtils/PatchHelper.cs @@ -58,8 +58,7 @@ namespace PatcherUtils if(File.Exists(decodedPath)) { - File.Delete(SourceFilePath); - File.Move(decodedPath, SourceFilePath); + File.Move(decodedPath, SourceFilePath, true); } } diff --git a/Patcher/_port/Patcher/PatchClient/PatchClient.csproj b/Patcher/_port/Patcher/PatchClient/PatchClient.csproj index 183610d..55eb282 100644 --- a/Patcher/_port/Patcher/PatchClient/PatchClient.csproj +++ b/Patcher/_port/Patcher/PatchClient/PatchClient.csproj @@ -2,6 +2,7 @@ WinExe net6.0 + true enable diff --git a/Patcher/_port/Patcher/PatchClient/Program.cs b/Patcher/_port/Patcher/PatchClient/Program.cs index 97aec7c..bc1e0c4 100644 --- a/Patcher/_port/Patcher/PatchClient/Program.cs +++ b/Patcher/_port/Patcher/PatchClient/Program.cs @@ -1,5 +1,4 @@ using Avalonia; -using Avalonia.Controls.ApplicationLifetimes; using Avalonia.ReactiveUI; using System; diff --git a/Patcher/_port/Patcher/PatchClient/ViewModels/MainWindowViewModel.cs b/Patcher/_port/Patcher/PatchClient/ViewModels/MainWindowViewModel.cs index 206c971..f56e6b7 100644 --- a/Patcher/_port/Patcher/PatchClient/ViewModels/MainWindowViewModel.cs +++ b/Patcher/_port/Patcher/PatchClient/ViewModels/MainWindowViewModel.cs @@ -10,7 +10,7 @@ namespace PatchClient.ViewModels { public ICommand CloseCommand => ReactiveCommand.Create(() => { - if(Application.Current.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktopApp) + if (Application.Current.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktopApp) { desktopApp.MainWindow.Close(); } diff --git a/Patcher/_port/Patcher/PatchClient/ViewModels/MessageViewModel.cs b/Patcher/_port/Patcher/PatchClient/ViewModels/MessageViewModel.cs index 9819b19..4eecaf2 100644 --- a/Patcher/_port/Patcher/PatchClient/ViewModels/MessageViewModel.cs +++ b/Patcher/_port/Patcher/PatchClient/ViewModels/MessageViewModel.cs @@ -1,5 +1,4 @@ -using Avalonia; -using ReactiveUI; +using ReactiveUI; namespace PatchClient.ViewModels { diff --git a/Patcher/_port/Patcher/PatchClient/ViewModels/PatcherViewModel.cs b/Patcher/_port/Patcher/PatchClient/ViewModels/PatcherViewModel.cs index 8bc9b3c..ba3046b 100644 --- a/Patcher/_port/Patcher/PatchClient/ViewModels/PatcherViewModel.cs +++ b/Patcher/_port/Patcher/PatchClient/ViewModels/PatcherViewModel.cs @@ -1,12 +1,12 @@ using Avalonia; using PatchClient.Models; using PatcherUtils; +using ReactiveUI; using Splat; using System; -using ReactiveUI; +using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; -using System.Collections.ObjectModel; namespace PatchClient.ViewModels { @@ -63,7 +63,7 @@ namespace PatchClient.ViewModels foreach (LineItem item in AdditionalLineItems) { - if(initLineItemProgress) + if (initLineItemProgress) { if (item.ItemValue <= 0) continue; diff --git a/Patcher/_port/Patcher/PatchClient/ViewModels/ViewModelBase.cs b/Patcher/_port/Patcher/PatchClient/ViewModels/ViewModelBase.cs index 9e4534b..ae56d9e 100644 --- a/Patcher/_port/Patcher/PatchClient/ViewModels/ViewModelBase.cs +++ b/Patcher/_port/Patcher/PatchClient/ViewModels/ViewModelBase.cs @@ -1,9 +1,5 @@ -using ReactiveUI; -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; using PatchClient.Models; +using ReactiveUI; namespace PatchClient.ViewModels { diff --git a/Patcher/_port/Patcher/PatchClient/Views/MessageView.axaml.cs b/Patcher/_port/Patcher/PatchClient/Views/MessageView.axaml.cs index 1c00245..dab0189 100644 --- a/Patcher/_port/Patcher/PatchClient/Views/MessageView.axaml.cs +++ b/Patcher/_port/Patcher/PatchClient/Views/MessageView.axaml.cs @@ -1,4 +1,3 @@ -using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; diff --git a/Patcher/_port/Patcher/PatchClient/Views/PatcherView.axaml.cs b/Patcher/_port/Patcher/PatchClient/Views/PatcherView.axaml.cs index 10c659a..d8ad362 100644 --- a/Patcher/_port/Patcher/PatchClient/Views/PatcherView.axaml.cs +++ b/Patcher/_port/Patcher/PatchClient/Views/PatcherView.axaml.cs @@ -1,4 +1,3 @@ -using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; diff --git a/Patcher/_port/Patcher/PatchGenerator/Assets/Styles.axaml b/Patcher/_port/Patcher/PatchGenerator/Assets/Styles.axaml index 41b1c96..432b248 100644 --- a/Patcher/_port/Patcher/PatchGenerator/Assets/Styles.axaml +++ b/Patcher/_port/Patcher/PatchGenerator/Assets/Styles.axaml @@ -2,7 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="using:PatchGenerator.CustomControls"> - + @@ -12,18 +12,49 @@ +