Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Commit 32da28b

Browse files
committed
1 parent 41c2c42 commit 32da28b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

LibBundle/LibBundle.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>net5.0</TargetFramework>
55
<Authors>aianlinb</Authors>
66
<Copyright>Copyright © 2020-2021 aianlinb.</Copyright>
7-
<AssemblyVersion>2.4.4.0</AssemblyVersion>
7+
<AssemblyVersion>2.4.6.0</AssemblyVersion>
88
<Platforms>x64</Platforms>
99
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
1010
</PropertyGroup>

LibBundle/Records/BundleRecord.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ public virtual void SaveWithRecompression(string newPath = null, string original
107107
if (newPath == null && originalPath == null && Bundle.path == null)
108108
throw new ArgumentNullException();
109109
var data = Bundle.Read(originalPath);
110+
data.SetLength(validSize);
111+
data.Position = validSize;
110112
foreach (var d in FileToAdd) {
111113
d.Key.Offset = (int)data.Position;
112114
data.Write(d.Value, 0, d.Key.Size);
@@ -120,11 +122,12 @@ public virtual byte[] SaveWithRecompression(BinaryReader br, long? Offset = null
120122
Read(br, Offset);
121123
var data = Bundle.Read(br);
122124
data.SetLength(validSize);
125+
data.Position = validSize;
123126
foreach (var (f, b) in FileToAdd) {
124127
f.Offset = (int)data.Position;
125128
data.Write(b, 0, f.Size);
126129
}
127-
UncompressedSize = (int)data.Length;
130+
UncompressedSize = validSize = (int)data.Length;
128131
var result = Bundle.Save(data);
129132
FileToAdd.Clear();
130133
data.Close();

0 commit comments

Comments
 (0)