Skip to content

Commit

Permalink
Added progress
Browse files Browse the repository at this point in the history
  • Loading branch information
uholeschak committed Dec 23, 2024
1 parent d187ee2 commit af1930d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Tools/ApkUncompress2/ApkUncompressCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,27 @@ public bool UncompressDLL(string fileName)
return retVal;
}

public bool UncompressFromAPK_IndividualElfFiles(ZipFile apk, string filePath, string outputPath)
public bool UncompressFromAPK_IndividualElfFiles(ZipFile apk, string filePath, string outputPath, ProgressDelegate? progressDelegate = null)
{
bool result = true;
int extractedCount = 0;
long entryCount = apk.Count;
long itemIndex = 0;

foreach (ZipEntry entry in apk)
{
if (progressDelegate != null)
{
if (entryCount > 0)
{
if (!progressDelegate((int) ((itemIndex * 100) / entryCount)))
{
return false;
}
}
}

itemIndex++;
if (!entry.IsFile)
{
continue;
Expand Down Expand Up @@ -345,7 +359,7 @@ public bool UncompressFromAPK(string filePath, string outputDir, ProgressDelegat
{
FileStream fs = File.OpenRead(filePath);
zf = new ZipFile(fs);
if (UncompressFromAPK_IndividualElfFiles(zf, filePath, outputDir))
if (UncompressFromAPK_IndividualElfFiles(zf, filePath, outputDir, progressDelegate))
{
return true;
}
Expand Down

0 comments on commit af1930d

Please sign in to comment.