ZipArchive.AddAsync Method
Namespace: Rebex.IO.Compression
Assembly: Rebex.Zip.dll (version 7.0.9313)
AddAsync(String, String, TraversalMode, TransferMethod, ActionOnExistingFiles, Object)
Begins asynchronous Add operation. Adds specified local files or directories to a directory within the ZIP archive.
Declaration
public Task<ArchiveOperationResult> AddAsync(string sourcePathOrMask, string archiveDirectoryPath, TraversalMode mode, TransferMethod transferMethod, ActionOnExistingFiles defaultActionOnExistingFiles, object state = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | sourcePathOrMask | Path (with or without a mask) to an external (local) file or directory. |
| String | archiveDirectoryPath | Path to an archive directory where to add files. Null reference (Nothing in Visual Basic) means root. |
| TraversalMode | mode | Traversal mode. |
| TransferMethod | transferMethod | Specifies whether to copy or move source items. |
| ActionOnExistingFiles | defaultActionOnExistingFiles | Specifies the default behavior for files that already exist in the ZIP archive. |
| Object | state | An optional user-provided object that identifies this particular asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task<ArchiveOperationResult> | Operation result. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException | The specified path is empty or contains invalid characters. -or- Illegal use of wildcards in path. -or- Ambiguous usage of path and mode. -or- The system could not retrieve the absolute path. |
| ArgumentOutOfRangeException | The |
| InvalidOperationException | Archive is not opened for writing.
-or- |
| ObjectDisposedException | Archive was already disposed. |
| NotSupportedException | Path is in an invalid format. |
| PathTooLongException |
|
| SecurityException | The caller does not have the required permissions. |
| UnauthorizedAccessException | Access to the file is denied. |
| IOException | An I/O error occurred. |
| ZipException | Cannot perform the requested operation, or the operation was canceled (see ProblemType for detailed information). |
AddAsync(FileSet, String, TransferMethod, ActionOnExistingFiles, Object)
Begins asynchronous Add operation. Adds specified local files or directories to a directory within the ZIP archive.
Declaration
public Task<ArchiveOperationResult> AddAsync(FileSet set, string archiveDirectoryPath, TransferMethod transferMethod, ActionOnExistingFiles defaultActionOnExistingFiles, object state = null)
Parameters
| Type | Name | Description |
|---|---|---|
| FileSet | set | A filtering set which specifies external (local) files and directories to be added. |
| String | archiveDirectoryPath | Path to an archive directory where to add files. Null reference (Nothing in Visual Basic) means root. |
| TransferMethod | transferMethod | Specifies whether to copy or move source items. |
| ActionOnExistingFiles | defaultActionOnExistingFiles | Specifies the default behavior for files that already exist in the ZIP archive. |
| Object | state | An optional user-provided object that identifies this particular asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task<ArchiveOperationResult> | Operation result. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException | Base path of the set contains invalid characters -or- the system could not retrieve the absolute path. |
| ArgumentOutOfRangeException | The |
| InvalidOperationException | Archive is not opened for writing. -or- Base path of the set refers to the ZIP archive itself. |
| ObjectDisposedException | Archive was already disposed. |
| NotSupportedException | Path is in an invalid format. |
| PathTooLongException | Base path of the set exceeds the maximum length defined by system. -or- The target path is longer than 65.535 characters. |
| SecurityException | The caller does not have the required permissions. |
| UnauthorizedAccessException | Access to the file is denied. |
| IOException | An I/O error occurred. |
| ZipException | Cannot perform the requested operation, or the operation was canceled (see ProblemType for detailed information). |