Пример #1
0
        private static void AddThumbnailToZip(MFBImageInfo mfbii, ZipArchive zip, string szFolder)
        {
            if (mfbii is null)
            {
                throw new ArgumentNullException(nameof(mfbii));
            }
            if (zip is null)
            {
                throw new ArgumentNullException(nameof(zip));
            }
            if (szFolder is null)
            {
                throw new ArgumentNullException(nameof(szFolder));
            }

            string imgPath = System.Web.Hosting.HostingEnvironment.MapPath(mfbii.PathThumbnail);

            if (!File.Exists(imgPath))
            {
                mfbii.DeleteFromDB();   // clean up an orphan
                return;
            }

            // No need to add an S3PDF to the zip file; it's just a placeholder file on the disk, and it can
            // potentially have a duplicate name with another PDF as well.
            if (mfbii.ImageType != MFBImageInfo.ImageFileType.S3PDF)
            {
                zip.CreateEntryFromFile(imgPath, szFolder + "\\" + mfbii.ThumbnailFile);
            }
        }