Class ZipPackage
Represents the ZipPackage class.
Inherited Members
Namespace: Telerik.WinForms.Spreadsheet.Zip
Assembly: Telerik.WinControls.RadSpreadsheet.dll
Syntax
public class ZipPackage : ZipArchive, IDisposable, INotifyPropertyChanged
Properties
FileName
Gets the file name for the ZipPackage.
Declaration
public string FileName { get; }
Property Value
System.String
|
ZipPackageEntries
Gets the collection of entries that are currently in the zip archive.
Declaration
public IList<ZipPackageEntry> ZipPackageEntries { get; }
Property Value
System.Collections.Generic.IList<ZipPackageEntry>
|
Exceptions
System.NotSupportedException
The zip archive does not support reading. |
System.ObjectDisposedException
The zip archive has been disposed. |
InvalidDataException
The zip archive is corrupt, and its entries cannot be retrieved. |
Methods
Add(IEnumerable<String>)
Adds the files from the passed IEnumerable of file names in the ZipPackage.
Declaration
public void Add(IEnumerable<string> fileNames)
Parameters
System.Collections.Generic.IEnumerable<System.String>
fileNames
|
Add(IEnumerable<String>, CompressionType)
Adds the files from the passed IEnumerable of file names in the ZipPackage.
Declaration
public void Add(IEnumerable<string> fileNames, CompressionType compressionType)
Parameters
System.Collections.Generic.IEnumerable<System.String>
fileNames
|
CompressionType
compressionType
|
Add(String)
Adds a file with the passed file name in the ZipPackage.
Declaration
public void Add(string fileName)
Parameters
System.String
fileName
File name. |
Add(String, String)
Adds a file with the passed file name in the ZipPackage and associates it with the passed file name in zip.
Declaration
public void Add(string fileName, string fileNameInZip)
Parameters
System.String
fileName
|
System.String
fileNameInZip
|
Add(String, String, DateTime)
Adds a file with the passed file name in the ZipPackage, associates it with the passed file name in zip and sets a date time for the entry.
Declaration
public void Add(string fileName, string fileNameInZip, DateTime dateTime)
Parameters
System.String
fileName
|
System.String
fileNameInZip
|
System.DateTime
dateTime
|
Add(String, String, DateTime, CompressionType)
Adds a file with the passed file name in the ZipPackage, associates it with the passed file name in zip and sets a date time for the entry.
Declaration
public void Add(string fileName, string fileNameInZip, DateTime dateTime, CompressionType compressionType)
Parameters
System.String
fileName
|
System.String
fileNameInZip
|
System.DateTime
dateTime
|
CompressionType
compressionType
|
Add(String, String, CompressionType)
Adds a file with the passed file name in the ZipPackage and associates it with the passed file name in zip.
Declaration
public void Add(string fileName, string fileNameInZip, CompressionType compressionType)
Parameters
System.String
fileName
|
System.String
fileNameInZip
|
CompressionType
compressionType
|
Add(String, CompressionType)
Adds a file with the passed file name in the ZipPackage.
Declaration
public void Add(string fileName, CompressionType compressionType)
Parameters
System.String
fileName
|
CompressionType
compressionType
|
AddStream(Stream, String)
Adds a stream in the ZipPackage and associates it with the passed file name in zip.
Declaration
public void AddStream(Stream stream, string fileNameInZip)
Parameters
System.IO.Stream
stream
Stream. |
System.String
fileNameInZip
File name in zip archive. |
AddStream(Stream, String, CompressionType)
Adds a stream in the ZipPackage and associates it with the passed file name in zip.
Declaration
public void AddStream(Stream stream, string fileNameInZip, CompressionType compressionType)
Parameters
System.IO.Stream
stream
Stream. |
System.String
fileNameInZip
File name in zip archive. |
CompressionType
compressionType
Compression type. |
AddStream(Stream, String, ZipCompression, DateTime)
Adds a stream in the ZipPackage, compresses it with the passed compress method, associates it with the passed file name in zip and sets a date time for the entry.
Declaration
public void AddStream(Stream stream, string fileNameInZip, ZipCompression method, DateTime dateTime)
Parameters
System.IO.Stream
stream
Stream. |
System.String
fileNameInZip
File name in zip archive. |
ZipCompression
method
Compression level. |
System.DateTime
dateTime
Date and time of file. |
AddStream(Stream, String, ZipCompression, DateTime, CompressionType)
Adds a stream in the ZipPackage and associates it with the passed file name in zip.
Declaration
public void AddStream(Stream stream, string fileNameInZip, ZipCompression method, DateTime dateTime, CompressionType compressionType)
Parameters
System.IO.Stream
stream
Stream. |
System.String
fileNameInZip
File name in zip archive. |
ZipCompression
method
Compression level. |
System.DateTime
dateTime
Date and time of file. |
CompressionType
compressionType
Compression type. |
Close(Boolean)
Closes the ZipPackage.
Declaration
public void Close(bool closeStream)
Parameters
System.Boolean
closeStream
If the parameter is set to true then closes the file. |
Create(Stream)
This method is used to create a ZipPackage from a stream.
Declaration
public static ZipPackage Create(Stream stream)
Parameters
System.IO.Stream
stream
Stream. |
Returns
ZipPackage
ZipPackage instance. |
CreateFile(String)
This method is used to create a ZipPackage with the passed file name.
Declaration
public static ZipPackage CreateFile(string fileName)
Parameters
System.String
fileName
File name. |
Returns
ZipPackage
ZipPackage instance. |
IndexOf(String)
Gets the index of the entry in the list of entries of the ZipPackage.
Declaration
public int IndexOf(string fileNameInZip)
Parameters
System.String
fileNameInZip
File name in zip archive. |
Returns
System.Int32
Index of entry or -1 when the entry is not found. |
IsZipFile(Stream)
Checks whether the stream that represents a zip file is actually a zip file.
Declaration
public static bool IsZipFile(Stream stream)
Parameters
System.IO.Stream
stream
Stream. |
Returns
System.Boolean
True if the stream represents a zip file. |
IsZipFile(String)
Checks whether the file with the passed file name is actually a zip file.
Declaration
public static bool IsZipFile(string fileName)
Parameters
System.String
fileName
File name. |
Returns
System.Boolean
True if the file represents a zip file. |
Open(Stream)
Opens zip archive from the Stream.
Declaration
public static ZipPackage Open(Stream stream)
Parameters
System.IO.Stream
stream
Stream. |
Returns
ZipPackage
ZipPackage instance. |
OpenFile(String, FileAccess)
This method is used to open a ZipPackage with the passed file name.
Declaration
public static ZipPackage OpenFile(string fileName, FileAccess access)
Parameters
System.String
fileName
File name. |
System.IO.FileAccess
access
File access. |
Returns
ZipPackage
ZipPackage instance. |
RemoveEntry(ZipPackageEntry)
Removes the passed entry from the ZipPackage.
Declaration
public void RemoveEntry(ZipPackageEntry zipPackageEntry)
Parameters
ZipPackageEntry
zipPackageEntry
|