/// <summary>
        /// 加载插件设置
        /// </summary>
        public static void Load()
        {
			filePath = Directory.GetCurrentDirectory() + @"\Plugins\KanColleCacher.ini";

			if (!File.Exists(filePath))
			{
				var path = Path.Combine(
						Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
						"grabacr.net",
						"KanColleViewer",
						"KanColleCacher.ini"
						);
				if (File.Exists(path))
					filePath = path;
			}

			if (File.Exists(filePath))
			{
				var _Parser = ConfigParser.ReadIniFile(filePath);
				Current = _Parser.DeserializeObject<Settings>("Settings");

				try
				{
					Directory.CreateDirectory(Current.CacheFolder);
				}
				catch (Exception ex)
				{
					Current.CacheFolder = Directory.GetCurrentDirectory() + @"\MyCache";
					Log.Exception(ex.InnerException, ex, "设置文件中CacheFolder不存在,试图创建时发生异常");
				}
			}
			else
			{
				//设置文件丢失
			}

			Current = Current ?? new Settings();
        }
Example #2
0
 public CacheCore()
 {
     set = Settings.Current;
     //VersionChecker.Load();
     myCacheFolder = set.CacheFolder;
 }