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:
|
Also thanks to:
|
||||||
* Akseli Virtanen (RAGEQUIT)
|
* Akseli Virtanen (RAGEQUIT)
|
||||||
* Andrew Riedi
|
* Andrew Riedi
|
||||||
|
* Andreas Beck (baxtor)
|
||||||
* Barnaby Smith (mvi)
|
* Barnaby Smith (mvi)
|
||||||
* Bellator
|
* Bellator
|
||||||
* Bugra Cuhadaroglu (BugraC)
|
* Bugra Cuhadaroglu (BugraC)
|
||||||
|
|||||||
@@ -49,11 +49,20 @@ namespace OpenRA.FileFormats
|
|||||||
// Parse the directory list
|
// Parse the directory list
|
||||||
s.Seek(TOCAddress, SeekOrigin.Begin);
|
s.Seek(TOCAddress, SeekOrigin.Begin);
|
||||||
BinaryReader TOCreader = new BinaryReader(s);
|
BinaryReader TOCreader = new BinaryReader(s);
|
||||||
|
|
||||||
|
var fileCountInDirs = new List<uint>();
|
||||||
|
// Parse directories
|
||||||
for (var i = 0; i < DirCount; i++)
|
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
|
// Parse directory header
|
||||||
var FileCount = reader.ReadUInt16();
|
var FileCount = reader.ReadUInt16();
|
||||||
@@ -63,10 +72,7 @@ namespace OpenRA.FileFormats
|
|||||||
|
|
||||||
// Skip to the end of the chunk
|
// Skip to the end of the chunk
|
||||||
reader.ReadBytes(ChunkSize - NameLength - 6);
|
reader.ReadBytes(ChunkSize - NameLength - 6);
|
||||||
|
return FileCount;
|
||||||
// Parse files
|
|
||||||
for (var i = 0; i < FileCount; i++)
|
|
||||||
ParseFile(reader);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint AccumulatedData = 0;
|
uint AccumulatedData = 0;
|
||||||
@@ -81,7 +87,8 @@ namespace OpenRA.FileFormats
|
|||||||
var FileName = new String(reader.ReadChars(NameLength));
|
var FileName = new String(reader.ReadChars(NameLength));
|
||||||
|
|
||||||
var hash = PackageEntry.HashFilename(FileName, PackageHashType.Classic);
|
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);
|
filenames.Add(FileName);
|
||||||
AccumulatedData += CompressedSize;
|
AccumulatedData += CompressedSize;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user