示例#1
0
        /// <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);
        }
示例#2
0
        /// <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();
            }
        }
示例#3
0
 /// <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);
     }
 }