Пример #1
0
        public void GetFileInfo()
        {
            string idsString = Request.QueryString["ids"].ToString();
            string fileName  = Request.QueryString["filename"].ToString();
            string SessionID = Request.QueryString["SessionID"].ToString();

            CMMLog.Debug(string.Format("ZIP打包下载入口GetFileInfo,接收参数。idsString:{0},fileName:{1},SessionID:{2}", idsString, fileName, SessionID));
            Sys_ModelFileBLL     bllFiles  = new Sys_ModelFileBLL();
            List <Sys_ModelFile> newsfiles = bllFiles.GetList(p => idsString.Contains(p.FileID)).ToList();

            CMMLog.Debug(string.Format("ZIP打包下载入口GetFileInfo,检索文件数。count:{0}", newsfiles.Count));
            if (!string.IsNullOrEmpty(SessionID))
            {
                List <Sys_ModelFile> list = null;
                if (HttpContext.Current.Session[SessionID] != null)
                {
                    list = HttpContext.Current.Session[SessionID] as List <Sys_ModelFile>;

                    for (int i = 0; i < list.Count; i++)
                    {
                        newsfiles.Add(list[i]);
                    }
                }
            }

            string path = Server.MapPath("/");

            if (newsfiles.Count > 0)
            {
                string curName = path + "Files/ZipTemp/" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".zip";
                ZipHelper.CreateZipFiles(newsfiles, path, curName, 5, 50);
                LoadFile(curName, fileName);
            }
        }
Пример #2
0
        public void CreateZipFile__Tester()
        {
            var tester = new ZipHelper();
            var path   = tester.CreateZipFiles(@"C:\Temp\ResultMedia\24344\", true);

            Assert.IsNotNullOrEmpty(path);
        }
Пример #3
0
        public void CreateZipFile_CreateToDestFolder_Tester()
        {
            var tester = new ZipHelper();

            tester.CreateZipFiles(@"C:\Temp\ResultMedia\24344", @"C:\Temp\ResultMedia\2344.zip");
        }