From 39e0bd97402ca1e60e99cfa63e52af730d305fe1 Mon Sep 17 00:00:00 2001 From: Michael Green <84688932+michael-j-green@users.noreply.github.com> Date: Wed, 1 Mar 2023 12:34:28 +1100 Subject: [PATCH] =?UTF-8?q?refactor:=20check=20for=20the=20existance=20of?= =?UTF-8?q?=20a=20database=20upgrade=20script=20rather=20than=20swallow=20?= =?UTF-8?q?an=20error=20that=20it=20doesn=E2=80=99t=20exist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gaseous-tools/Database.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gaseous-tools/Database.cs b/gaseous-tools/Database.cs index 81ffa47..9f87e3c 100644 --- a/gaseous-tools/Database.cs +++ b/gaseous-tools/Database.cs @@ -81,7 +81,8 @@ namespace gaseous_tools string resourceName = "gaseous_tools.Database.MySQL.gaseous-" + i + ".sql"; string dbScript = ""; - try + string[] resources = Assembly.GetExecutingAssembly().GetManifestResourceNames(); + if (resources.Contains(resourceName)) { using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream)) @@ -115,9 +116,6 @@ namespace gaseous_tools } } } - } catch - { - break; } } break;