[]
        
(Showing Draft Content)

C1.Zip.C1ZipEntryCollection.AddAsync

AddAsync Method

AddAsync(Stream, string, DateTime)

Asynchronous adds a stream to the current zip file.

Declaration
public Task AddAsync(Stream stream, string entryName, DateTime dateTime)
Parameters
Type Name Description
Stream stream

Stream that contains data for the new entry.

string entryName

Name to be used for the new entry.

DateTime dateTime

The date and time when the file was last modified.

Returns
Type Description
Task

AddAsync(Stream, string)

Asynchronous adds a stream to the current zip file.

Declaration
public Task AddAsync(Stream stream, string entryName)
Parameters
Type Name Description
Stream stream

Stream that contains data for the new entry.

string entryName

Name to be used for the new entry.

Returns
Type Description
Task

AddAsync(string)

Asynchronous adds an entry to the current zip file.

Declaration
public Task AddAsync(string fileName)
Parameters
Type Name Description
string fileName

Name of the file to add to the zip file.

Returns
Type Description
Task
Remarks

By default, the directory name is not stored in the zip file. To store a specific part of the directory name in the zip file, use the overloaded version of the Add method with a pathLevels parameter.

Examples

To create a zip archive use AddAsync(filePath) and AddAsync(stream):

AddAsync(string[])

Adds a list of entries to the current zip file.

Declaration
public Task AddAsync(string[] fileNames)
Parameters
Type Name Description
string[] fileNames

Array containing the file names of the entries to be added to the zip file.

Returns
Type Description
Task

AddAsync(string, int)

Asynchronous adds an entry to the current zip file.

Declaration
public Task AddAsync(string fileName, int pathLevels)
Parameters
Type Name Description
string fileName

Name of the file to add to the zip file.

int pathLevels

The number of path levels to be stored as the entry name.

Returns
Type Description
Task
Remarks

By default, path names are not stored in the zip file. For example, adding the file "c:\temp\samples\readme.txt" to the zip file will create an entry called "readme.txt".

The pathLevels parameter allows you to store one or more levels of the path in the entry name. For example, adding the file "c:\temp\samples\readme.txt" to the zip file with pathLevels=1 will create an entry called "samples\readme.txt".

AddAsync(string, string)

Asynchronous adds an entry to the current zip file.

Declaration
public Task AddAsync(string fileName, string entryName)
Parameters
Type Name Description
string fileName

Name of the file to add to the zip file.

string entryName

Name of the new entry as stored in the zip file.

Returns
Type Description
Task
Remarks

By default, entries in the zip file have the same name as the original (uncompressed) file. This method allows you to specify a different name, including a path for example.

AddAsync(string, string, DateTime)

Asynchronous adds an entry to the current zip file.

Declaration
public Task AddAsync(string fileName, string entryName, DateTime dateTime)
Parameters
Type Name Description
string fileName

Name of the file to add to the zip file.

string entryName

Name of the new entry as stored in the zip file.

DateTime dateTime

The date and time when the file was last modified.

Returns
Type Description
Task
Remarks

By default, entries in the zip file have the same name as the original (uncompressed) file. This method allows you to specify a different name, including a path for example.