Example #1
0
        static public void SaveCacheInfo(ScrapBaseInfo pInfo)
        {
            if (pInfo == null || pInfo.image == null)
            {
                return;
            }

            try
            {
                var tFolderName = pInfo.GetFolderName();
                if (!Directory.Exists(tFolderName))
                {
                    Directory.CreateDirectory(tFolderName);
                }

                var tPath = Path.Combine(tFolderName, pInfo.GetFileName());
                Serialize(pInfo, tPath);

                tPath = Path.Combine(tFolderName, pInfo.weightInfo.GetFileName());
                if (!File.Exists(tPath))
                {
                    Serialize(pInfo.weightInfo, tPath);
                }

                MyConsole.WriteLine("缓存图片成功. {0}", pInfo.ToString());
            }
            catch (Exception ex)
            {
                MyConsole.WriteLine("缓存图片失败. {0}\n{1}", pInfo.ToString(), ex.ToString());
            }
        }
Example #2
0
 static public void DeleteCacheInfo(ScrapBaseInfo pInfo)
 {
     try
     {
         var tPath = pInfo.GetFolderName();
         if (Directory.Exists(tPath))
         {
             Directory.Delete(tPath, true);
         }
         MyConsole.WriteLine("删除图片成功. {0}", pInfo.ToString());
     }
     catch (Exception ex)
     {
         MyConsole.WriteLine("删除图片失败. {0}\n{1|", pInfo.ToString(), ex.ToString());
     }
 }