Exemple #1
0
        public void Init()
        {
            if (!File.Exists(SettingFileName))
            {
                Settings = GridWorkerSettings.Defaults;
                File.WriteAllText(SettingFileName, GridWorkerSettings.Serialize(Settings));
            }
            else
            {
                try {
                    Settings = GridWorkerSettings.Deserialize(File.ReadAllText(SettingFileName));
                } catch (Exception e) {
                    Settings = GridWorkerSettings.Defaults;
                    Logger.Error($"Unable to read settings from '{SettingFileName}', loading defaults", e);
                }
            }

            _networkSystem.Init();
        }
Exemple #2
0
 public static string Serialize(GridWorkerSettings obj)
 {
     return(JsonConvert.SerializeObject(obj, Formatting.Indented));
 }