Adds the specified file to the root directory of the ZIP archive.
Namespace:
Rebex.IO.Compression
Assembly:
Rebex.Zip (in Rebex.Zip.dll)
Syntax
| Visual Basic |
|---|
Public Function AddFile ( _ sourceFilePath As String _ ) As ArchiveOperationResult |
| C# |
|---|
public ArchiveOperationResult AddFile( string sourceFilePath ) |
Parameters
- sourceFilePath
- Type: System..::..String
Path to a local file to be added.
Return Value
Operation result.
Exceptions
| Exception | Condition |
|---|---|
| System..::..ArgumentNullException | sourceFilePath is null. |
| System..::..ArgumentException | The specified path is empty or contains invalid characters. -or- The system could not retrieve the absolute path. |
| System..::..InvalidOperationException | Archive is not opened for writing. -or- sourceFilePath refers to the ZIP archive itself. |
| System..::..ObjectDisposedException | Archive was already disposed. |
| System..::..NotSupportedException | Path is in an invalid format. |
| System.IO..::..PathTooLongException | sourceFilePath exceed the maximum length defined by system. |
| System.IO..::..DirectoryNotFoundException | Part of the specified path was not found. |
| System.IO..::..FileNotFoundException | The specified file path was not found. |
| System.Security..::..SecurityException | The caller does not have the required permissions. |
| System..::..UnauthorizedAccessException | Access to the file is denied. |
| System.IO..::..IOException | An I/O error occurred. |
| Rebex.IO.Compression..::..ZipException | Cannot perform the requested operation, or the operation was canceled (see ProblemType for detailed information). |