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

            _networkSystem.Init();
            _networkSystem.StartListen();
        }
예제 #2
0
 public static string Serialize(GridServerSettings obj)
 {
     return(JsonConvert.SerializeObject(obj, Formatting.Indented));
 }