Make exception detection language agnostic

mfw windows
This commit is contained in:
pizzaboxer 2023-08-26 11:35:21 +01:00
parent 35253145cc
commit 0df4840873
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
3 changed files with 8 additions and 5 deletions

View File

@ -1396,9 +1396,9 @@ namespace Bloxstrap
UpdateProgressBar(); UpdateProgressBar();
// attempt download over HTTP // attempt download over HTTP
// this isn't actually that unsafe - signatures were established earlier over HTTPS // this isn't actually that unsafe - signatures were fetched earlier over HTTPS
// so we've already established that our signatures are legit, and that there's no MITM anyway // so we've already established that our signatures are legit, and that there's very likely no MITM anyway
if (ex.Message.Contains("The decryption operation failed")) if (ex.GetType() == typeof(IOException) && !packageUrl.StartsWith("http://"))
{ {
App.Logger.WriteLine(LOG_IDENT, "Retrying download over HTTP..."); App.Logger.WriteLine(LOG_IDENT, "Retrying download over HTTP...");
packageUrl = packageUrl.Replace("https://", "http://"); packageUrl = packageUrl.Replace("https://", "http://");

View File

@ -2,6 +2,7 @@
{ {
// https://learn.microsoft.com/en-us/windows/win32/msi/error-codes // https://learn.microsoft.com/en-us/windows/win32/msi/error-codes
// https://i-logic.com/serial/errorcodes.htm // https://i-logic.com/serial/errorcodes.htm
// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/705fb797-2175-4a90-b5a3-3918024b10b8
// just the ones that we're interested in // just the ones that we're interested in
public enum ErrorCode public enum ErrorCode
@ -9,6 +10,8 @@
ERROR_SUCCESS = 0, ERROR_SUCCESS = 0,
ERROR_INSTALL_USEREXIT = 1602, ERROR_INSTALL_USEREXIT = 1602,
ERROR_INSTALL_FAILURE = 1603, ERROR_INSTALL_FAILURE = 1603,
ERROR_CANCELLED = 1223 ERROR_CANCELLED = 1223,
CO_E_APPNOTFOUND = -2147221003
} }
} }

View File

@ -18,7 +18,7 @@ namespace Bloxstrap
{ {
// lmfao // lmfao
if (!ex.Message.Contains("Application not found")) if (ex.NativeErrorCode != (int)ErrorCode.CO_E_APPNOTFOUND)
throw; throw;
Process.Start(new ProcessStartInfo Process.Start(new ProcessStartInfo