Пример #1
0
        /// <summary>
        /// 客户端下载使用。压缩文件,并返回压缩文件的路径
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static bool ZipOperation(DataTable dt, string filePath)
        {
            if (dt == null || dt.Rows.Count <= 0 || !dt.Columns.Contains("signnamepicpath"))
            {
                return(false);
            }
            List <string> defaultSignnamePics = new List <string>();

            foreach (DataRow row in dt.Rows)
            {
                string defaultSignnamePicDir = Common.DefaultSignnameImgDownload();
                string relativePath          = row["SIGNNAMEPICPATH"].ToString();
                if (relativePath.IndexOf('/') == 0)
                {
                    relativePath = relativePath.Substring(1, relativePath.Length - 1);
                }
                string signnamePicPath = Path.Combine(defaultSignnamePicDir, relativePath);
                defaultSignnamePics.Add(signnamePicPath);
            }
            CompressHelper.Zip(defaultSignnamePics, filePath);
            return(true);
        }