Bricklayer.Client.Settings.GetDefaultSettings C# (CSharp) Method

GetDefaultSettings() public static method

public static GetDefaultSettings ( ) : Settings
return Settings
        public static Settings GetDefaultSettings()
        {
            return new Settings()
            {
                ContentPack = "Default",
                Resolution = new Microsoft.Xna.Framework.Point(900,600),
                Username = "Guest",
                Color = 40,
                UseVSync = false,
            };
        }

Usage Example

Beispiel #1
0
        /// <summary>
        /// Opens the settings file and loads the values
        /// </summary>
        public static void LoadSettings(Game game)
        {
            try
            {
                Settings settings;
                //If config does not exist, create it and write the default settings
                if (!File.Exists(configFile))
                {
                    SaveAndApplyDefault(game);
                    return;
                }
                string json = File.ReadAllText(configFile);
                //If config is empty, regenerate it
                if (string.IsNullOrWhiteSpace(json))
                {
                    SaveAndApplyDefault(game);
                    return;
                }
                settings = JsonConvert.DeserializeObject <Settings>(json);
                ApplySettings(settings, game);
            }
            catch (Exception ex)
            {
#if DEBUG
                throw ex;
#else
                System.Windows.Forms.MessageBox.Show(ex.Message + "\nTry deleting your config file!", game.Window.Title + " Configuration Error");
                //Default fallback settings
                ApplySettings(Settings.GetDefaultSettings(), game);
#endif
            }
        }
All Usage Examples Of Bricklayer.Client.Settings::GetDefaultSettings