Beispiel #1
0
 public LogicSettings(GlobalSettings settings)
 {
     _settings = settings;
 }
Beispiel #2
0
 public ClientSettings(GlobalSettings settings)
 {
     _settings = settings;
 }
Beispiel #3
0
        public static GlobalSettings Load(string path)
        {
            var fullPath = Directory.GetCurrentDirectory() + path;

            GlobalSettings settings = null;
            if (File.Exists(fullPath))
            {
                //if the file exists, load the settings
                var input = File.ReadAllText(fullPath);

                JsonSerializerSettings jsonSettings = new JsonSerializerSettings();
                jsonSettings.Converters.Add(new StringEnumConverter { CamelCaseText = true });
                jsonSettings.ObjectCreationHandling = ObjectCreationHandling.Replace;

                settings = JsonConvert.DeserializeObject<GlobalSettings>(input, jsonSettings);
            }
            else
            {
                settings = new GlobalSettings();
                settings.Save(path);
            }

            settings.Auth.Load(GetAuthPath(path));

            return settings;
        }