ZipArchive.AddFileAsync Method
Namespace: Rebex.IO.Compression
Assembly: Rebex.Zip.dll (version 7.0.9147)
AddFileAsync(String, String, Object)
Begins asynchronous AddFile operation. Adds the specified local file to the specified directory within the ZIP archive.
Declaration
public Task<ArchiveOperationResult> AddFileAsync(string sourceFilePath, string archivePath, object state = null)
Parameters
Type | Name | Description |
---|---|---|
String | sourceFilePath | Path to a local file to be added. |
String | archivePath | Path to a (non-existing) file archive item or path to a directory item ending with directory separator (typically ''). Null reference (Nothing in Visual Basic) means root. |
Object | state | An optional user-provided object that identifies this particular asynchronous operation. |
Returns
Type | Description |
---|---|
Task<Archive |
Operation result. |
Exceptions
Type | Condition |
---|---|
Argument |
|
Argument |
The specified path is empty or contains invalid characters. -or- The system could not retrieve the absolute path. |
Invalid |
Archive is not opened for writing.
-or- |
Object |
Archive was already disposed. |
Not |
Path is in an invalid format. |
Path |
|
Directory |
Part of the source path was not found. |
File |
The source file was not found. |
Security |
The caller does not have the required permissions. |
Unauthorized |
Access to the file is denied. |
IOException | An I/O error occurred. |
Zip |
Cannot perform the requested operation, or the operation was canceled
(see Problem |
AddFileAsync(String, String, ActionOnExistingFiles, Object)
Begins asynchronous AddFile operation. Adds the specified local file to the specified directory within the ZIP archive.
Declaration
public Task<ArchiveOperationResult> AddFileAsync(string sourceFilePath, string archivePath, ActionOnExistingFiles defaultActionOnExistingFiles, object state = null)
Parameters
Type | Name | Description |
---|---|---|
String | sourceFilePath | Path to a local file to be added. |
String | archivePath | Path to a (non-existing) file archive item or path to a directory item ending with directory separator (typically ''). Null reference (Nothing in Visual Basic) means root. |
Action |
defaultActionOnExistingFiles | Specifies the default behavior for files that already exists in the local directory. |
Object | state | An optional user-provided object that identifies this particular asynchronous operation. |
Returns
Type | Description |
---|---|
Task<Archive |
Operation result. |
Exceptions
Type | Condition |
---|---|
Argument |
|
Argument |
The specified path is empty or contains invalid characters. -or- The system could not retrieve the absolute path. |
Invalid |
Archive is not opened for writing.
-or- |
Object |
Archive was already disposed. |
Not |
Path is in an invalid format. |
Path |
|
Directory |
Part of the source path was not found. |
File |
The source file was not found. |
Security |
The caller does not have the required permissions. |
Unauthorized |
Access to the file is denied. |
IOException | An I/O error occurred. |
Zip |
Cannot perform the requested operation, or the operation was canceled
(see Problem |
AddFileAsync(Stream, String, Object)
Begins asynchronous AddFile operation. Adds data from the specified stream to the ZIP archive.
Declaration
public Task<ArchiveOperationResult> AddFileAsync(Stream inputStream, string archiveFilePath, object state = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | inputStream | Stream to read the data from. |
String | archiveFilePath | Absolute path to a (non-existing) file item within the ZIP archive. |
Object | state | An optional user-provided object that identifies this particular asynchronous operation. |
Returns
Type | Description |
---|---|
Task<Archive |
Operation result. |
Remarks
Note that only data following the current position of the input stream is compressed.
Exceptions
Type | Condition |
---|---|
Argument |
|
Argument |
|
Invalid |
Archive is not opened for writing.
-or- |
Object |
Archive was already disposed. |
Path |
|
IOException | An I/O error occurred. |
Zip |
Cannot perform the requested operation, or the operation was canceled
(see Problem |
AddFileAsync(Stream, String, ActionOnExistingFiles, Object)
Begins asynchronous AddFile operation. Adds data from the specified stream to the ZIP archive.
Declaration
public Task<ArchiveOperationResult> AddFileAsync(Stream inputStream, string archiveFilePath, ActionOnExistingFiles defaultActionOnExistingFiles, object state = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | inputStream | Stream to read the data from. |
String | archiveFilePath | Absolute path to a (non-existing) file item within the ZIP archive. |
Action |
defaultActionOnExistingFiles | Specifies the default behavior for files that already exists in the local directory. |
Object | state | An optional user-provided object that identifies this particular asynchronous operation. |
Returns
Type | Description |
---|---|
Task<Archive |
Operation result. |
Remarks
Note that only data following the current position of the input stream is compressed.
Exceptions
Type | Condition |
---|---|
Argument |
|
Argument |
|
Invalid |
Archive is not opened for writing.
-or- |
Object |
Archive was already disposed. |
Path |
|
IOException | An I/O error occurred. |
Zip |
Cannot perform the requested operation, or the operation was canceled
(see Problem |