Skip to content
Permalink
Browse files

Launcher error handling

  • Loading branch information
YellowberryHN committed Feb 8, 2020
1 parent aaa1ee4 commit 3ae77a67bc735ea6200e83fb0e10de297ab60867
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/launcher/MainForm.cs
@@ -34,10 +34,18 @@ private void DisplayMessage(string text, string origin = null, MessageBoxButtons

private void LoadConfig()
{
using (StreamReader r = new StreamReader("launcher.json"))
try
{
using (StreamReader r = new StreamReader("launcher.json"))
{
string json = r.ReadToEnd();
config = JsonConvert.DeserializeObject<Config>(json);
}
}
catch (FileNotFoundException)
{
string json = r.ReadToEnd();
config = JsonConvert.DeserializeObject<Config>(json);
MessageBox.Show("Config file is missing!");
System.Environment.Exit(1);
}
}

@@ -98,7 +106,7 @@ private class UserInfo
public string username;
}

private mainForm()
public mainForm()
{
InitializeComponent();

0 comments on commit 3ae77a6

Please sign in to comment.
You can’t perform that action at this time.