GetDefaultSettings() public static method

public static GetDefaultSettings ( ) : Settings
return Settings
Example #1
0
 /// <summary>
 /// Opens the server settings and loads them into the server
 /// </summary>
 public static void LoadSettings()
 {
     try
     {
         //If server config does not exist, create it and write the default settings
         if (!File.Exists(configFile))
         {
             SaveSettings(Settings.GetDefaultSettings());
         }
         string json = File.ReadAllText(configFile);
         //If config is empty, regenerate and read again
         if (string.IsNullOrWhiteSpace(json))
         {
             SaveSettings(Settings.GetDefaultSettings());
         }
         json          = File.ReadAllText(configFile);
         Server.Config = JsonConvert.DeserializeObject <Settings>(json);
     }
     catch (Exception ex)
     {
         throw; //TODO: Add some form of handling
     }
 }