Fixes issue #2216 InstallShield .Z package decompression
This commit is contained in:
1
AUTHORS
1
AUTHORS
@@ -12,6 +12,7 @@ The OpenRA developers are:
|
||||
Also thanks to:
|
||||
* Akseli Virtanen (RAGEQUIT)
|
||||
* Andrew Riedi
|
||||
* Andreas Beck (baxtor)
|
||||
* Barnaby Smith (mvi)
|
||||
* Bellator
|
||||
* Bugra Cuhadaroglu (BugraC)
|
||||
|
||||
@@ -49,11 +49,20 @@ namespace OpenRA.FileFormats
|
||||
// Parse the directory list
|
||||
s.Seek(TOCAddress, SeekOrigin.Begin);
|
||||
BinaryReader TOCreader = new BinaryReader(s);
|
||||
|
||||
var fileCountInDirs = new List<uint>();
|
||||
// Parse directories
|
||||
for (var i = 0; i < DirCount; i++)
|
||||
ParseDirectory(TOCreader);
|
||||
fileCountInDirs.Add(ParseDirectory(TOCreader));
|
||||
|
||||
// Parse files
|
||||
foreach (var fileCount in fileCountInDirs)
|
||||
for (var i = 0; i < fileCount; i++)
|
||||
ParseFile(reader);
|
||||
|
||||
}
|
||||
|
||||
void ParseDirectory(BinaryReader reader)
|
||||
uint ParseDirectory(BinaryReader reader)
|
||||
{
|
||||
// Parse directory header
|
||||
var FileCount = reader.ReadUInt16();
|
||||
@@ -63,10 +72,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
// Skip to the end of the chunk
|
||||
reader.ReadBytes(ChunkSize - NameLength - 6);
|
||||
|
||||
// Parse files
|
||||
for (var i = 0; i < FileCount; i++)
|
||||
ParseFile(reader);
|
||||
return FileCount;
|
||||
}
|
||||
|
||||
uint AccumulatedData = 0;
|
||||
@@ -81,7 +87,8 @@ namespace OpenRA.FileFormats
|
||||
var FileName = new String(reader.ReadChars(NameLength));
|
||||
|
||||
var hash = PackageEntry.HashFilename(FileName, PackageHashType.Classic);
|
||||
index.Add(hash, new PackageEntry(hash, AccumulatedData, CompressedSize));
|
||||
if(!index.ContainsKey(hash))
|
||||
index.Add(hash, new PackageEntry(hash,AccumulatedData, CompressedSize));
|
||||
filenames.Add(FileName);
|
||||
AccumulatedData += CompressedSize;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user