Rebex
Products Downloads Buy Support Contact
Show / Hide Table of Contents

ZipArchive.Add Method

Namespace: Rebex.IO.Compression
Assembly: Rebex.Zip.dll (version 7.0.9147)

Add(String)

Adds specified local files or directories to the ZIP archive.

Declaration
public ArchiveOperationResult Add(string sourcePathOrMask)
Parameters
Type Name Description
String sourcePathOrMask

Path (with or without a mask) to an external (local) file or directory.

Returns
Type Description
ArchiveOperationResult

Operation result.

Exceptions
Type Condition
ArgumentNullException

sourcePathOrMask is null.

ArgumentException

The specified path is empty or contains invalid characters. -or- Illegal use of wildcards in path. -or- The system could not retrieve the absolute path.

InvalidOperationException

Archive is not opened for writing. -or- sourcePathOrMask refers to the ZIP archive itself.

ObjectDisposedException

Archive was already disposed.

NotSupportedException

Path is in an invalid format.

PathTooLongException

sourcePathOrMask exceeds the maximum length defined by system.

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).

Add(FileSet)

Adds specified local files or directories to the ZIP archive.

Declaration
public ArchiveOperationResult Add(FileSet set)
Parameters
Type Name Description
FileSet set

A filtering set which specifies external (local) files and directories to be added.

Returns
Type Description
ArchiveOperationResult

Operation result.

Exceptions
Type Condition
ArgumentNullException

set is null.

ArgumentException

Base path of the set contains invalid characters -or- the system could not retrieve the absolute path.

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.

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).

Add(String, String)

Adds specified local files or directories to a directory within the ZIP archive.

Declaration
public ArchiveOperationResult Add(string sourcePathOrMask, string archiveDirectoryPath)
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.

Returns
Type Description
ArchiveOperationResult

Operation result.

Exceptions
Type Condition
ArgumentNullException

sourcePathOrMask is null.

ArgumentException

The specified path is empty or contains invalid characters. -or- Illegal use of wildcards in path. -or- The system could not retrieve the absolute path.

InvalidOperationException

Archive is not opened for writing. -or- sourcePathOrMask refers to the ZIP archive itself.

ObjectDisposedException

Archive was already disposed.

NotSupportedException

Path is in an invalid format.

PathTooLongException

sourcePathOrMask 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).

Add(FileSet, String)

Adds specified local files or directories to a directory within the ZIP archive.

Declaration
public ArchiveOperationResult Add(FileSet set, string archiveDirectoryPath)
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.

Returns
Type Description
ArchiveOperationResult

Operation result.

Exceptions
Type Condition
ArgumentNullException

set is null.

ArgumentException

Base path of the set contains invalid characters -or- the system could not retrieve the absolute path.

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).

Add(String, String, TraversalMode)

Adds specified local files or directories to a directory within the ZIP archive.

Declaration
public ArchiveOperationResult Add(string sourcePathOrMask, string archiveDirectoryPath, TraversalMode mode)
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.

Returns
Type Description
ArchiveOperationResult

Operation result.

Exceptions
Type Condition
ArgumentNullException

sourcePathOrMask is null.

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 mode specified an invalid value.

InvalidOperationException

Archive is not opened for writing. -or- sourcePathOrMask refers to the ZIP archive itself.

ObjectDisposedException

Archive was already disposed.

NotSupportedException

Path is in an invalid format.

PathTooLongException

sourcePathOrMask 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).

Add(String, String, TraversalMode, TransferMethod, ActionOnExistingFiles)

Adds specified local files or directories to a directory within the ZIP archive.

Declaration
public ArchiveOperationResult Add(string sourcePathOrMask, string archiveDirectoryPath, TraversalMode mode, TransferMethod transferMethod, ActionOnExistingFiles defaultActionOnExistingFiles)
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.

Returns
Type Description
ArchiveOperationResult

Operation result.

Exceptions
Type Condition
ArgumentNullException

sourcePathOrMask is null.

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 mode or transferMethod or defaultActionOnExistingFiles specified an invalid value.

InvalidOperationException

Archive is not opened for writing. -or- sourcePathOrMask refers to the ZIP archive itself.

ObjectDisposedException

Archive was already disposed.

NotSupportedException

Path is in an invalid format.

PathTooLongException

sourcePathOrMask 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).

Add(FileSet, String, TransferMethod, ActionOnExistingFiles)

Adds specified local files or directories to a directory within the ZIP archive.

Declaration
public ArchiveOperationResult Add(FileSet set, string archiveDirectoryPath, TransferMethod transferMethod, ActionOnExistingFiles defaultActionOnExistingFiles)
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.

Returns
Type Description
ArchiveOperationResult

Operation result.

Exceptions
Type Condition
ArgumentNullException

set is null.

ArgumentException

Base path of the set contains invalid characters -or- the system could not retrieve the absolute path.

ArgumentOutOfRangeException

The transferMethod or defaultActionOnExistingFiles specified an invalid value.

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).

Add(String, String, String)

Adds specified local files or directories to a directory within the specified ZIP archive.

Declaration
public static ArchiveOperationResult Add(string zipFilePath, string sourcePathOrMask, string archiveDirectoryPath)
Parameters
Type Name Description
String zipFilePath

Path to a ZIP archive.

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.

Returns
Type Description
ArchiveOperationResult

Operation result.

Remarks

The ZIP archive file doesn't have to exist.

Add(String, String, String, TraversalMode, TransferMethod, ActionOnExistingFiles)

Adds specified local files or directories to a directory within the specified ZIP archive.

Declaration
public static ArchiveOperationResult Add(string zipFilePath, string sourcePathOrMask, string archiveDirectoryPath, TraversalMode mode, TransferMethod transferMethod, ActionOnExistingFiles defaultActionOnExistingFiles)
Parameters
Type Name Description
String zipFilePath

Path to a ZIP archive.

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.

Returns
Type Description
ArchiveOperationResult

Operation result.

Remarks

The ZIP archive file doesn't have to exist.

In This Article
  • Add(String)
  • Add(FileSet)
  • Add(String, String)
  • Add(FileSet, String)
  • Add(String, String, TraversalMode)
  • Add(String, String, TraversalMode, TransferMethod, ActionOnExistingFiles)
  • Add(FileSet, String, TransferMethod, ActionOnExistingFiles)
  • Add(String, String, String)
  • Add(String, String, String, TraversalMode, TransferMethod, ActionOnExistingFiles)
© REBEX ČR s.r.o. Back to top
Privacy policy
Manage cookies