mirror of
https://gitlab.com/Syroot/Worms.git
synced 2025-05-05 11:19:29 +03:00
Archive
: Ensure o call private directory directly while loading and saving.
This commit is contained in:
parent
b89ea5d7e9
commit
f8b1b84f21
@ -93,7 +93,7 @@ namespace Syroot.Worms
|
|||||||
if (!stream.CanSeek)
|
if (!stream.CanSeek)
|
||||||
throw new ArgumentException("Stream requires to be seekable.", nameof(stream));
|
throw new ArgumentException("Stream requires to be seekable.", nameof(stream));
|
||||||
|
|
||||||
Clear();
|
_entries.Clear();
|
||||||
using BinaryStream reader = new BinaryStream(stream, encoding: Encoding.ASCII, leaveOpen: true);
|
using BinaryStream reader = new BinaryStream(stream, encoding: Encoding.ASCII, leaveOpen: true);
|
||||||
|
|
||||||
// Read the header.
|
// Read the header.
|
||||||
@ -123,7 +123,7 @@ namespace Syroot.Worms
|
|||||||
int length = reader.ReadInt32();
|
int length = reader.ReadInt32();
|
||||||
string name = reader.ReadString(StringCoding.ZeroTerminated);
|
string name = reader.ReadString(StringCoding.ZeroTerminated);
|
||||||
using (reader.TemporarySeek(offset, SeekOrigin.Begin))
|
using (reader.TemporarySeek(offset, SeekOrigin.Begin))
|
||||||
Add(name, reader.ReadBytes(length));
|
_entries.Add(name, reader.ReadBytes(length));
|
||||||
} while (nextEntryOffset != 0);
|
} while (nextEntryOffset != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ namespace Syroot.Worms
|
|||||||
|
|
||||||
// Write the data and build the hash table and file entries.
|
// Write the data and build the hash table and file entries.
|
||||||
List<HashTableEntry>[] hashTable = new List<HashTableEntry>[_hashSize];
|
List<HashTableEntry>[] hashTable = new List<HashTableEntry>[_hashSize];
|
||||||
foreach (KeyValuePair<string, byte[]> item in this)
|
foreach (KeyValuePair<string, byte[]> item in _entries)
|
||||||
{
|
{
|
||||||
HashTableEntry entry = new HashTableEntry()
|
HashTableEntry entry = new HashTableEntry()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user