Bricklayer.Server.Settings.GetDefaultSettings C# (CSharp) Метод

GetDefaultSettings() публичный статический Метод

public static GetDefaultSettings ( ) : Settings
Результат Settings
        public static Settings GetDefaultSettings()
        {
            return new Settings()
            {
                Sleep = 1,
                Port = Common.GlobalSettings.DefaultPort,
                MaxPlayers = 8,
                Name = "Bricklayer Server",
                Decription = "A Bricklayer Server running on the default configuration.\nPlease edit your Message Of The Day in the config file!",
                Intro = "Welcome to $Name!\nWe currently have $Online player(s) in $Rooms room(s).\n\nServer News:\n-\n-\n-\n\nServer Rules:\n-\n-\n-\n\n\n\n\n...",
            };
        }

Usage 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
     }
 }