コード例 #1
0
 private void ZipperAddFile(System.IO.Compression.ZipArchive zipper, dodSON.Core.FileStorage.ICompressedFileStoreItem item)
 {
     // create new zip item
     zipper.CreateEntryFromFile(item.OriginalFilename, item.RootFilename, (item.CompressionStrategy == CompressionStorageStrategy.Compress) ?
                                CompressionLevel.Optimal :
                                CompressionLevel.NoCompression);
 }
コード例 #2
0
        private void ZipperUpdateFile(System.IO.Compression.ZipArchive zipper, dodSON.Core.FileStorage.ICompressedFileStoreItem item)
        {
            // find existing zip item
            var entry = zipper.Entries.FirstOrDefault((e) => { return(e.FullName.Equals(item.RootFilename, StringComparison.InvariantCultureIgnoreCase)); });

            if (entry != null)
            {
                // delete entry
                entry.Delete();
                // add (new) entry
                ZipperAddFile(zipper, item);
            }
        }