System.IO.Compression.ZipFile.Open C# (CSharp) Méthode

Open() private méthode

private Open ( string archiveFileName, ZipArchiveMode mode ) : ZipArchive
archiveFileName string
mode ZipArchiveMode
Résultat ZipArchive
        public static ZipArchive Open(string archiveFileName, ZipArchiveMode mode)
        {
            return Open(archiveFileName, mode, entryNameEncoding: null);
        }

Same methods

ZipFile::Open ( string archiveFileName, ZipArchiveMode mode, Encoding entryNameEncoding ) : ZipArchive

Usage Example

        public static void ZipTo(string archiveFilename, ZipFileInfo[] toArchiveFiles)
        {
            var zip = Zip.Open(archiveFilename, ZipArchiveMode.Create);

            foreach (var file in toArchiveFiles)
            {
                var filename = file.InArchiveFilename;
                if (String.IsNullOrEmpty(filename))
                {
                    filename = Path.GetFileName(file.SourceFilepath);
                }
                zip.CreateEntryFromFile(file.SourceFilepath, filename, CompressionLevel.Optimal);
            }
            // Dispose of the object when we are done
            zip.Dispose();
        }
All Usage Examples Of System.IO.Compression.ZipFile::Open