/// <summary> /// 設定を読み込みます。 /// </summary> private void LoadConfig() { try { Config = PluginConfig.LoadXml(this.PluginDirectory, GetConfigPath()); if (Config.ScreenShotSavePath == "" || Config.ScreenShotSavePath == null) { Config.ScreenShotSavePath = DefaultScreenShotPath; } } catch (Exception e) { // 設定ファイルが存在しない、もしくは破損している場合は作り直す Logger.Log(LogLevel.Warning, "LoadConfig: {0}", e); Logger.Log(LogLevel.Info, "LoadConfig: Creating new configuration."); Config = new PluginConfig(); Config.SetDefaultOverlayConfigs(this.PluginDirectory); if (Config.ScreenShotSavePath == "" || Config.ScreenShotSavePath == null) { Config.ScreenShotSavePath = DefaultScreenShotPath; } } Directory.CreateDirectory(Config.ScreenShotSavePath); }
private void LoadConfig() { try { Config = PluginConfig.LoadXml(GetConfigPath()); } catch (Exception e) { Log(LogLevel.Warning, "LoadConfig: {0}", e); Log(LogLevel.Info, "LoadConfig: Creating new configuration."); Config = new PluginConfig(); } finally { if (string.IsNullOrWhiteSpace(Config.MiniParseOverlay.Url)) { Config.MiniParseOverlay.Url = new Uri(Path.Combine(pluginDirectory, "resources", "miniparse.html")).ToString(); } if (string.IsNullOrWhiteSpace(Config.SpellTimerOverlay.Url)) { Config.SpellTimerOverlay.Url = new Uri(Path.Combine(pluginDirectory, "resources", "spelltimer.html")).ToString(); } } }
/// <summary> /// 設定を読み込みます。 /// </summary> private void LoadConfig() { var found = true; try { Config = PluginConfig.LoadJson(GetConfigPath()); } catch (FileNotFoundException) { Config = null; found = false; } catch (Exception e) { Config = null; Logger.Log(LogLevel.Error, "LoadConfig: {0}", e); } if (!found) { try { Config = PluginConfig.LoadXml(PluginDirectory, GetConfigPath(true)); } catch (Exception e) { // 設定ファイルが存在しない、もしくは破損している場合は作り直す Logger.Log(LogLevel.Warning, "LoadConfig: {0}", e); Config = null; } } if (Config == null) { Logger.Log(LogLevel.Info, "LoadConfig: Creating new configuration."); Config = new PluginConfig(); Config.SetDefaultOverlayConfigs(PluginDirectory); } Registry.Register(Config); Registry.Register <IPluginConfig>(Config); foreach (var es in Registry.EventSources) { es.LoadConfig(Config); es.Start(); } }
/// <summary> /// 設定を読み込みます。 /// </summary> private void LoadConfig() { try { Config = PluginConfig.LoadXml(this.PluginDirectory, GetConfigPath()); } catch (Exception e) { // 設定ファイルが存在しない、もしくは破損している場合は作り直す Logger.Log(LogLevel.Warning, "LoadConfig: {0}", e); Logger.Log(LogLevel.Info, "LoadConfig: Creating new configuration."); Config = new PluginConfig(); Config.SetDefaultOverlayConfigs(this.PluginDirectory); } }