Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Core/ModuleInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,16 @@ private bool StreamsEqual(Stream s1, Stream s2)
const int bufLen = 1024;
byte[] bytes1 = new byte[bufLen];
byte[] bytes2 = new byte[bufLen];
for (int bytesChecked = 0; bytesChecked < s1.Length; )
int bytesChecked = 0;
while (true)
{
int bytesFrom1 = s1.Read(bytes1, 0, bufLen);
int bytesFrom2 = s2.Read(bytes2, 0, bufLen);
if (bytesFrom1 == 0 && bytesFrom2 == 0)
{
// Boths streams finished, all bytes are equal
return true;
}
if (bytesFrom1 != bytesFrom2)
{
// One ended early, not equal.
Expand All @@ -479,8 +485,6 @@ private bool StreamsEqual(Stream s1, Stream s2)
}
bytesChecked += bytesFrom1;
}
// Same bytes, they're equal.
return true;
}

/// <summary>
Expand Down