mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-06-23 23:00:23 -07:00
debug packages not downloading properly over http
This commit is contained in:
parent
680f6dfda3
commit
63b91efe39
@ -1365,9 +1365,11 @@ namespace Bloxstrap
|
|||||||
_totalDownloadedBytes += bytesRead;
|
_totalDownloadedBytes += bytesRead;
|
||||||
UpdateProgressBar();
|
UpdateProgressBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MD5Hash.FromStream(fileStream) != package.Signature)
|
string hash = MD5Hash.FromStream(fileStream);
|
||||||
throw new Exception("Signature does not match!");
|
|
||||||
|
if (hash != package.Signature)
|
||||||
|
throw new ChecksumFailedException($"Failed to verify download of {packageUrl}\n\nGot signature: {hash}\n\nPackage has been downloaded to {packageLocation}\n\nPlease send the file shown above in a bug report.");
|
||||||
|
|
||||||
App.Logger.WriteLine(LOG_IDENT, $"Finished downloading! ({totalBytesRead} bytes total)");
|
App.Logger.WriteLine(LOG_IDENT, $"Finished downloading! ({totalBytesRead} bytes total)");
|
||||||
break;
|
break;
|
||||||
@ -1377,12 +1379,12 @@ namespace Bloxstrap
|
|||||||
App.Logger.WriteLine(LOG_IDENT, $"An exception occurred after downloading {totalBytesRead} bytes. ({i}/{maxTries})");
|
App.Logger.WriteLine(LOG_IDENT, $"An exception occurred after downloading {totalBytesRead} bytes. ({i}/{maxTries})");
|
||||||
App.Logger.WriteException(LOG_IDENT, ex);
|
App.Logger.WriteException(LOG_IDENT, ex);
|
||||||
|
|
||||||
|
if (i >= maxTries || ex.GetType() == typeof(ChecksumFailedException))
|
||||||
|
throw;
|
||||||
|
|
||||||
if (File.Exists(packageLocation))
|
if (File.Exists(packageLocation))
|
||||||
File.Delete(packageLocation);
|
File.Delete(packageLocation);
|
||||||
|
|
||||||
if (i >= maxTries)
|
|
||||||
throw;
|
|
||||||
|
|
||||||
_totalDownloadedBytes -= totalBytesRead;
|
_totalDownloadedBytes -= totalBytesRead;
|
||||||
UpdateProgressBar();
|
UpdateProgressBar();
|
||||||
|
|
||||||
|
15
Bloxstrap/Exceptions/ChecksumFailedException.cs
Normal file
15
Bloxstrap/Exceptions/ChecksumFailedException.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bloxstrap.Exceptions
|
||||||
|
{
|
||||||
|
internal class ChecksumFailedException : Exception
|
||||||
|
{
|
||||||
|
public ChecksumFailedException(string message) : base(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user