From c15b0c74e312ede60794f88e929c044bdc0d1054 Mon Sep 17 00:00:00 2001 From: "Chris Weermann (TGE)" Date: Fri, 10 Jul 2020 01:12:59 +0200 Subject: [PATCH] PAK: fix stream being closed after saving --- Source/Amicitia/Properties/AssemblyInfo.cs | 4 ++-- Source/Amicitia/ResourceWrappers/PAKFileSystemWrapper.cs | 2 +- Source/Amicitia/ResourceWrappers/ResourceWrapper.cs | 7 +++++++ Source/AmicitiaLibrary/AmicitiaLibrary.csproj | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Source/Amicitia/Properties/AssemblyInfo.cs b/Source/Amicitia/Properties/AssemblyInfo.cs index d007e65..481ed10 100644 --- a/Source/Amicitia/Properties/AssemblyInfo.cs +++ b/Source/Amicitia/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.9.3.0")] -[assembly: AssemblyFileVersion("1.9.3.0")] +[assembly: AssemblyVersion("1.9.4.0")] +[assembly: AssemblyFileVersion("1.9.4.0")] diff --git a/Source/Amicitia/ResourceWrappers/PAKFileSystemWrapper.cs b/Source/Amicitia/ResourceWrappers/PAKFileSystemWrapper.cs index 3102c98..f5615a5 100644 --- a/Source/Amicitia/ResourceWrappers/PAKFileSystemWrapper.cs +++ b/Source/Amicitia/ResourceWrappers/PAKFileSystemWrapper.cs @@ -22,7 +22,7 @@ protected override void Initialize() RegisterFileExportAction(SupportedFileType.PakArchiveFile, ( res, path ) => { - res.Save( path ); + res.Save().SaveToFile( false, path ); } ); RegisterFileReplaceAction( SupportedFileType.PakArchiveFile, ( res, path ) => { diff --git a/Source/Amicitia/ResourceWrappers/ResourceWrapper.cs b/Source/Amicitia/ResourceWrappers/ResourceWrapper.cs index f443b6b..af749de 100644 --- a/Source/Amicitia/ResourceWrappers/ResourceWrapper.cs +++ b/Source/Amicitia/ResourceWrappers/ResourceWrapper.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.CompilerServices; @@ -144,6 +145,7 @@ public bool NeedsRebuild protected ResourceWrapper(string text, TResource resource) : base(text) { + Console.WriteLine( $"{this}: Creating wrapper for {resource}" ); Resource = resource; FileType = SupportedFileManager.GetSupportedFileType(typeof(TResource)); @@ -564,6 +566,7 @@ private static SupportedFileType GetCorrectedSupportedFileType(int fileTypeIndex /// private void PopulateViewFully() { + Console.WriteLine( $"{this}: Populating view" ); if (mInitialized) Nodes.Clear(); @@ -654,6 +657,7 @@ private void RebuildResource() if (mRebuildAction != null) { + Console.WriteLine( $"{this}: Rebuilding" ); Resource = mRebuildAction.Invoke(this); SetRebuildFlag(Parent); } @@ -662,7 +666,10 @@ private void RebuildResource() public virtual void Dispose() { if ( Resource is IDisposable disposable ) + { + Console.WriteLine( $"{this}: Disposing" ); disposable.Dispose(); + } } } diff --git a/Source/AmicitiaLibrary/AmicitiaLibrary.csproj b/Source/AmicitiaLibrary/AmicitiaLibrary.csproj index d772a3d..8d71ea7 100644 --- a/Source/AmicitiaLibrary/AmicitiaLibrary.csproj +++ b/Source/AmicitiaLibrary/AmicitiaLibrary.csproj @@ -5,7 +5,7 @@ false Library for parsing Atlus game formats. Copyright © Atlus, TGE 2019 - 1.9.3.0 + 1.9.4.0 https://github.com/TGEnigma/Amicitia