Example #1
0
 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}");
     }
 }
Example #2
0
 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}");
     }
 }
Example #3
0
        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();
            }
        }
Example #4
0
 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}");
     }
 }