refactor: check for the existance of a database upgrade script rather than swallow an error that it doesn’t exist

This commit is contained in:
Michael Green
2023-03-01 12:34:28 +11:00
parent 85726ada7a
commit 39e0bd9740

View File

@@ -81,7 +81,8 @@ namespace gaseous_tools
string resourceName = "gaseous_tools.Database.MySQL.gaseous-" + i + ".sql"; string resourceName = "gaseous_tools.Database.MySQL.gaseous-" + i + ".sql";
string dbScript = ""; string dbScript = "";
try string[] resources = Assembly.GetExecutingAssembly().GetManifestResourceNames();
if (resources.Contains(resourceName))
{ {
using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream)) using (StreamReader reader = new StreamReader(stream))
@@ -115,9 +116,6 @@ namespace gaseous_tools
} }
} }
} }
} catch
{
break;
} }
} }
break; break;