From 0356930a5c39517b6a0907a9201304b7c0bdb3fc Mon Sep 17 00:00:00 2001 From: Bluzume <39113159+KuromeSan@users.noreply.github.com> Date: Mon, 14 Mar 2022 11:33:07 +1300 Subject: [PATCH] Add error handling --- HorseIsleServer/N00BS/Program.cs | 20 ++++++++++++------- .../N00BS/RegisterForm.Designer.cs | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/HorseIsleServer/N00BS/Program.cs b/HorseIsleServer/N00BS/Program.cs index 0d3aed7..888104b 100644 --- a/HorseIsleServer/N00BS/Program.cs +++ b/HorseIsleServer/N00BS/Program.cs @@ -89,10 +89,14 @@ namespace HISP } // Start Web Server - cs = new ContentServer(); - string[] fileList = Directory.GetFiles(Path.Combine(baseDir, "client"), "*", SearchOption.AllDirectories); - foreach (string file in fileList) - addToList(file); + try{ + cs = new ContentServer(); + string[] fileList = Directory.GetFiles(Path.Combine(baseDir, "client"), "*", SearchOption.AllDirectories); + foreach (string file in fileList) + addToList(file); + }catch(Exception as e){ + MessageBox.Show("Web server failed to start: "+e.Message, "Error starting web server", MessageBoxButtons.OK, MessageBoxIcon.Error); + } IncrementProgress(); @@ -138,13 +142,15 @@ namespace HISP Item.DoSpecialCases(); IncrementProgress(); - + try{ GameServer.StartServer(); + }catch(Exception as e){ + MessageBox.Show("Horse Isle server failed to start: "+e.Message, "Error starting web server", MessageBoxButtons.OK, MessageBoxIcon.Error); + } IncrementProgress(); lfrm.DialogResult = DialogResult.OK; - startForm.Wait(); - + SystemTrayIcon stry = new SystemTrayIcon(); stry.ShowDialog(); diff --git a/HorseIsleServer/N00BS/RegisterForm.Designer.cs b/HorseIsleServer/N00BS/RegisterForm.Designer.cs index a15d4be..1ffd80a 100644 --- a/HorseIsleServer/N00BS/RegisterForm.Designer.cs +++ b/HorseIsleServer/N00BS/RegisterForm.Designer.cs @@ -207,7 +207,7 @@ this.MinimizeBox = false; this.MinimumSize = new System.Drawing.Size(365, 280); this.Name = "RegisterForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultLocation; this.Text = "Create Account"; this.Load += new System.EventHandler(this.RegisterForm_Load); this.ResumeLayout(false);