public void LoadConfig(GatewayConfig config) { try { config.To(this); HttpServer.Log(BeetleX.EventArgs.LogType.Info, $"Gateway load config success"); } catch (Exception e_) { HttpServer.Log(BeetleX.EventArgs.LogType.Error, $"Gateway load config error {e_.Message}"); } }
public void SaveConfig() { try { GatewayConfig.SaveConfig(this); HttpServer.Log(BeetleX.EventArgs.LogType.Info, $"Gateway save config success"); } catch (Exception e_) { HttpServer.Log(BeetleX.EventArgs.LogType.Error, $"Gateway save config error {e_.Message}"); } }
public static void SaveConfig(Gateway gateway) { GatewayConfig config = new GatewayConfig(); config.From(gateway); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(CONFIG_FILE, false, Encoding.UTF8)) { string configData = Newtonsoft.Json.JsonConvert.SerializeObject(config); writer.Write(configData); writer.Flush(); } }
public void LoadConfig() { try { var config = GatewayConfig.LoadConfig(); if (config != null) { LoadConfig(config); } } catch (Exception e_) { HttpServer.Log(BeetleX.EventArgs.LogType.Error, $"Gateway load config error {e_.Message}"); } }