Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2216 InstallShield .Z package decompression #3342

Merged
merged 1 commit into from
May 26, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 14 additions & 7 deletions OpenRA.FileFormats/Filesystem/InstallShieldPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,20 @@ public InstallShieldPackage(string filename, int priority)
// 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();
Expand All @@ -63,10 +72,7 @@ void ParseDirectory(BinaryReader reader)

// 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;
Expand All @@ -81,7 +87,8 @@ void ParseFile(BinaryReader reader)
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;

Expand Down