Skip to content

Commit 3a4a307

Browse files
committed
temp fix
1 parent c898b35 commit 3a4a307

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

UnityAsset.NET/BundleFile/BundleFile.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,30 @@ public sealed class BundleFile
4242

4343
private ArchiveFlags mask { get; set; }
4444

45-
public BundleFile(string path, bool original = false, string? key = null)
46-
: this(new FileStream(path, FileMode.Open, FileAccess.Read), original, key)
45+
public BundleFile(string path, string? key = null)
46+
: this(new FileStream(path, FileMode.Open, FileAccess.Read), key)
4747
{
4848
}
4949

50-
public BundleFile(Stream input, bool original = false, string? key = null)
50+
public BundleFile(Stream input, string? key = null)
5151
{
5252
using AssetReader reader = new AssetReader(input);
5353

5454
UnityCNKey = key;
5555

5656
Header = new Header(reader);
57+
ReadBundleWithHeader(reader, Header, key);
58+
}
59+
60+
public BundleFile(AssetReader reader,Header header, string? key = null)
61+
{
62+
UnityCNKey = key;
63+
Header = header;
64+
ReadBundleWithHeader(reader, header, key);
65+
}
66+
67+
private void ReadBundleWithHeader(AssetReader reader, Header header, string? key = null)
68+
{
5769
var version = ParseVersion();
5870

5971
if (version[0] < 2020 || //2020 and earlier

UnityAsset.NET/IO/AssetReader.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ public AssetReader(Stream stream, bool isBigEndian = true) : base(stream)
3131
StartPosition = stream.Position;
3232
}
3333

34+
public AssetReader(string filePath, bool isBigEndian = true) : base(new FileStream(filePath, FileMode.Open, FileAccess.Read))
35+
{
36+
buffer = new byte[8];
37+
BigEndian = isBigEndian;
38+
StartPosition = 0;
39+
}
40+
3441
public void AlignStream(int alignment)
3542
{
3643
var pos = Position;

0 commit comments

Comments
 (0)