예제 #1
0
        /// <summary>
        /// 解压文件
        /// </summary>
        /// <param name="objParame"></param>
        protected void UnZipFile(object objParame)
        {
            var parame   = (Dictionary <string, string>)objParame;
            var savePath = parame["SavePath"].Replace("\\", "/").Replace("//", "/");
            var fileUrl  = parame["FileUrl"].Replace("\\", "/").Replace("//", "/");
            var fileName = parame["FileName"].Replace("\\", "/").Replace("//", "/");
            var delay    = parame["Delay"];

            //将文件解压
            var zipDir = savePath + "/" + Path.GetFileNameWithoutExtension(fileUrl);

            try
            {
                ZipHelp.ExtractToDirectory(fileName, zipDir);

                //将文件解压后的文件夹中的图片转为GIF
                var fs = Directory.GetFiles(zipDir);
                GifHelp.ImageToGif(fs, zipDir + ".gif", int.Parse(delay));
            }
            catch (Exception ex)
            {
                AddErrorMsg(string.Format("解压文件{0}失败!\r\n{1}\r\n", fileName, ex.Message));
                HtmlHelp.SaveStringToTxt(ex.StackTrace + "\r\n", "Error.txt");
            }
            finally
            {
                Mut.DisposeUnZipThread();
            }
        }