Skip to content

Commit 6587057

Browse files
committed
Fix File Count Calculation Bug
Signed-off-by: Nate DeSimone <[email protected]>
1 parent 4081e32 commit 6587057

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

EdkMingwInstaller/InstallWorker.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public int GetFileCount(string sourceDirectory)
219219
return fileCount;
220220
}
221221

222-
public void CopyDirectory(string source, string destination, int CurrentCount, Action<int> ReportProgress, Func<bool> CancelPending)
222+
public void CopyDirectory(string source, string destination, ref int CurrentCount, Action<int> ReportProgress, Func<bool> CancelPending)
223223
{
224224
byte[] buffer = new byte[0x100000]; //1 MB
225225
int bytesRead = 0;
@@ -287,7 +287,7 @@ public void CopyDirectory(string source, string destination, int CurrentCount, A
287287
}
288288
}
289289
string destinationDir = Path.Combine(destination, SubDir.Name);
290-
CopyDirectory(SubDir.FullName, destinationDir, CurrentCount, ReportProgress, CancelPending);
290+
CopyDirectory(SubDir.FullName, destinationDir, ref CurrentCount, ReportProgress, CancelPending);
291291
}
292292
}
293293

@@ -442,10 +442,11 @@ public void PerformInstall(Action<bool, bool> ReportComplete, Action<int> Report
442442
//
443443
int CompletionPercent = 0;
444444
int LastCompletionPercent = 0;
445+
int CurrentCount = 0;
445446
InstallLogger.Log(string.Format("Copying files..."));
446447
int FileCount = GetFileCount(sourcePath);
447448
CreateInstallDirectory(installPath);
448-
CopyDirectory(sourcePath, installPath, 0, delegate(int CurrentFileCount)
449+
CopyDirectory(sourcePath, installPath, ref CurrentCount, delegate(int CurrentFileCount)
449450
{
450451
CompletionPercent = (CurrentFileCount * 100) / FileCount;
451452
if (CompletionPercent > LastCompletionPercent)

0 commit comments

Comments
 (0)