Exemplo n.º 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());
            }
        }