Class ZipArchive
Inheritance
Namespace: Syncfusion.Compression.Zip
Assembly: Syncfusion.DocIO.UWP.dll
Syntax
public class ZipArchive : Object
Constructors
ZipArchive()
Declaration
public ZipArchive()
Properties
Count
Returns number of items inside archive. Read-only.
Declaration
public int Count { get; }
Property Value
Type |
---|
System.Int32 |
DefaultCompressionLevel
Gets / sets default compression level - compression level for new items. By default is equal to CompressionLevel.Best.
Declaration
public CompressionLevel DefaultCompressionLevel { get; set; }
Property Value
Type |
---|
CompressionLevel |
Item[Int32]
Returns single archive item from the collection. Read-only.
Declaration
public ZipArchiveItem this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Zero-based index of the item to return. |
Property Value
Type | Description |
---|---|
ZipArchiveItem | Single archive item from the collection. |
Item[String]
Returns item by its name. Null if item wasn't found. Read-only.
Declaration
public ZipArchiveItem this[string itemName] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | itemName |
Property Value
Type |
---|
ZipArchiveItem |
Items
Returns the items inside archive. Read-only.
Declaration
public ZipArchiveItem[] Items { get; }
Property Value
Type |
---|
ZipArchiveItem[] |
Methods
AddItem(ZipArchiveItem)
Adds existing item to the archive.
Declaration
public ZipArchiveItem AddItem(ZipArchiveItem item)
Parameters
Type | Name | Description |
---|---|---|
ZipArchiveItem | item | Item to add. |
Returns
Type | Description |
---|---|
ZipArchiveItem | Added item. |
AddItem(String, Stream)
Adds new item to the archive
Declaration
public ZipArchiveItem AddItem(string itemName, Stream data)
Parameters
Type | Name | Description |
---|---|---|
System.String | itemName | Item name to add. |
System.IO.Stream | data | Items data stream (can be null for empty files or folders). |
Returns
Type | Description |
---|---|
ZipArchiveItem | Item that has been added. |
AddItem(String, Stream, Boolean, FileAttributes)
Adds new item to the archive
Declaration
public ZipArchiveItem AddItem(string itemName, Stream data, bool bControlStream, FileAttributes attributes)
Parameters
Type | Name | Description |
---|---|---|
System.String | itemName | Item name to add. |
System.IO.Stream | data | Items data stream (can be null for empty files or folders). |
System.Boolean | bControlStream | Indicates whether ZipArchive is responsible for stream closing. |
Windows.Storage.FileAttributes | attributes | File attributes. |
Returns
Type | Description |
---|---|
ZipArchiveItem | Item that has been added. |
Clone()
Creates a copy of the current instance.
Declaration
public ZipArchive Clone()
Returns
Type | Description |
---|---|
ZipArchive | A copy of the current instance. |
Find(String)
Searches for the item with specified name.
Declaration
public int Find(string itemName)
Parameters
Type | Name | Description |
---|---|---|
System.String | itemName | Item to find. |
Returns
Type | Description |
---|---|
System.Int32 | Zero-based item index if found; -1 otherwise. |
Find(Regex)
Searches for the item with specified name.
Declaration
public int Find(Regex itemRegex)
Parameters
Type | Name | Description |
---|---|---|
System.Text.RegularExpressions.Regex | itemRegex | Regular expression that defines item to find. |
Returns
Type | Description |
---|---|
System.Int32 | Zero-based item index if found; -1 otherwise. |
Open(Stream)
Declaration
public void Open(Stream inFileStream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | inFileStream |
Open(Stream, Boolean)
Declaration
public void Open(Stream inFileStream, bool isControlStream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | inFileStream | |
System.Boolean | isControlStream |
ReadInt16(Stream)
Extracts Int16 value from the stream.
Declaration
public static short ReadInt16(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream to read data from. |
Returns
Type | Description |
---|---|
System.Int16 | Extracted value. |
ReadInt32(Stream)
Extracts Int32 value from the stream.
Declaration
public static int ReadInt32(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream to read data from. |
Returns
Type | Description |
---|---|
System.Int32 | Extracted value. |
RemoveAt(Int32)
Removes item at the specified position.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Item index to remove. |
RemoveItem(String)
Removes item from the archive.
Declaration
public void RemoveItem(string itemName)
Parameters
Type | Name | Description |
---|---|---|
System.String | itemName | Item name to remove. |
Save(Stream)
Declaration
public void Save(Stream outStream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | outStream |
Save(Stream, Boolean)
Declaration
public void Save(Stream outStream, bool createFilePath)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | outStream | |
System.Boolean | createFilePath |
Save(String, Boolean)
Saves archive into specified file.
Declaration
public void Save(string outputFileName, bool createFilePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | outputFileName | Output file name. |
System.Boolean | createFilePath | Indicates whether we should create full path to the file if it doesn't exist. |
UpdateItem(String, Stream, Boolean, FileAttributes)
Adds new item to the archive
Declaration
public void UpdateItem(string itemName, Stream data, bool bControlStream, FileAttributes attributes)
Parameters
Type | Name | Description |
---|---|---|
System.String | itemName | Item name to add. |
System.IO.Stream | data | Items data stream (can be null for empty files or folders). |
System.Boolean | bControlStream | Indicates whether ZipArchive is responsible for stream closing. |
Windows.Storage.FileAttributes | attributes | File attributes. |