Exemplo n.º 1
0
        public static CactbotEventSourceConfig LoadConfig(IPluginConfig pluginConfig, RainbowMage.OverlayPlugin.ILogger logger)
        {
            var result = new CactbotEventSourceConfig();

            if (pluginConfig.EventSourceConfigs.ContainsKey("CactbotESConfig"))
            {
                var obj = pluginConfig.EventSourceConfigs["CactbotESConfig"];

                if (obj.TryGetValue("OverlayData", out JToken value))
                {
                    try {
                        result.OverlayData = value.ToObject <Dictionary <string, JToken> >();
                    } catch (Exception e) {
                        logger.Log(LogLevel.Error, "Failed to load OverlayData setting: {0}", e.ToString());
                    }
                }

                if (obj.TryGetValue("LastUpdateCheck", out value))
                {
                    try {
                        result.LastUpdateCheck = value.ToObject <DateTime>();
                    } catch (Exception e) {
                        logger.Log(LogLevel.Error, "Failed to load LastUpdateCheck setting: {0}", e.ToString());
                    }
                }
            }

            return(result);
        }
Exemplo n.º 2
0
 public override void LoadConfig(IPluginConfig config)
 {
     Config = CactbotEventSourceConfig.LoadConfig(config, logger);
     if (Config.OverlayData == null)
     {
         Config.OverlayData = new Dictionary <string, JToken>();
     }
 }