Add proper error message for failed checksum on package download

This commit is contained in:
pizzaboxer 2024-06-30 22:57:13 +04:00
parent 460ff56279
commit b2cfeeb7af
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
4 changed files with 46 additions and 6 deletions

View File

@ -159,7 +159,13 @@ namespace Bloxstrap
if (connectionResult is not null)
{
Logger.WriteException(LOG_IDENT, connectionResult);
Frontend.ShowConnectivityDialog("Roblox", Bloxstrap.Resources.Strings.Bootstrapper_Connectivity_Preventing, connectionResult);
Frontend.ShowConnectivityDialog(
Bloxstrap.Resources.Strings.Dialog_Connectivity_UnableToConnect,
Bloxstrap.Resources.Strings.Bootstrapper_Connectivity_Preventing,
connectionResult
);
return;
}

View File

@ -154,7 +154,7 @@ namespace Bloxstrap
else if (ex.GetType() == typeof(AggregateException))
ex = ex.InnerException!;
Frontend.ShowConnectivityDialog("Roblox", message, ex);
Frontend.ShowConnectivityDialog(Strings.Dialog_Connectivity_UnableToConnect, message, ex);
App.Terminate(ErrorCode.ERROR_CANCELLED);
}
@ -1461,7 +1461,7 @@ namespace Bloxstrap
string hash = MD5Hash.FromStream(fileStream);
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.");
throw new ChecksumFailedException($"Failed to verify download of {packageUrl}\n\nExpected hash: {package.Signature}\nGot hash: {hash}");
App.Logger.WriteLine(LOG_IDENT, $"Finished downloading! ({totalBytesRead} bytes total)");
break;
@ -1471,7 +1471,17 @@ namespace Bloxstrap
App.Logger.WriteLine(LOG_IDENT, $"An exception occurred after downloading {totalBytesRead} bytes. ({i}/{maxTries})");
App.Logger.WriteException(LOG_IDENT, ex);
if (i >= maxTries || ex.GetType() == typeof(ChecksumFailedException))
if (ex.GetType() == typeof(ChecksumFailedException))
{
Frontend.ShowConnectivityDialog(
Strings.Dialog_Connectivity_UnableToDownload,
String.Format(Strings.Dialog_Connectivity_UnableToDownloadReason, "[https://github.com/pizzaboxer/bloxstrap/wiki/Bloxstrap-is-unable-to-download-Roblox](https://github.com/pizzaboxer/bloxstrap/wiki/Bloxstrap-is-unable-to-download-Roblox)"),
ex
);
App.Terminate(ErrorCode.ERROR_CANCELLED);
}
else if (i >= maxTries)
throw;
if (File.Exists(packageLocation))

View File

@ -622,7 +622,7 @@ namespace Bloxstrap.Resources {
}
/// <summary>
/// Looks up a localized string similar to Bloxstrap is unable to connect to {0}.
/// Looks up a localized string similar to Bloxstrap is unable to connect to Roblox.
/// </summary>
public static string Dialog_Connectivity_UnableToConnect {
get {
@ -630,6 +630,24 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Bloxstrap is unable to download Roblox.
/// </summary>
public static string Dialog_Connectivity_UnableToDownload {
get {
return ResourceManager.GetString("Dialog.Connectivity.UnableToDownload", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Roblox cannot be downloaded at this time. Please read the following help page for more information: {0}.
/// </summary>
public static string Dialog_Connectivity_UnableToDownloadReason {
get {
return ResourceManager.GetString("Dialog.Connectivity.UnableToDownloadReason", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copy log contents.
/// </summary>

View File

@ -310,7 +310,7 @@ Click for more information</value>
<value>Connectivity error</value>
</data>
<data name="Dialog.Connectivity.UnableToConnect" xml:space="preserve">
<value>Bloxstrap is unable to connect to {0}</value>
<value>Bloxstrap is unable to connect to Roblox</value>
</data>
<data name="Dialog.Exception.CopyLogContents" xml:space="preserve">
<value>Copy log contents</value>
@ -1061,4 +1061,10 @@ Scroll for more languages.</value>
<data name="Menu.FastFlags.Presets.DisableTerrainTextures.Title" xml:space="preserve">
<value>Disable terrain textures</value>
</data>
<data name="Dialog.Connectivity.UnableToDownload" xml:space="preserve">
<value>Bloxstrap is unable to download Roblox</value>
</data>
<data name="Dialog.Connectivity.UnableToDownloadReason" xml:space="preserve">
<value>Roblox cannot be downloaded at this time. Please read the following help page for more information: {0}</value>
</data>
</root>