Class ZipNameTransform
ZipNameTransform transforms names as per the Zip file naming convention.
Inheritance
Implements
Inherited Members
Namespace: ICSharpCode.SharpZipLib.Zip
Assembly: ICSharpCode.SharpZipLib.dll
Syntax
public class ZipNameTransform : INameTransform
Remarks
The use of absolute names is supported although its use is not valid according to Zip naming conventions, and should not be used if maximum compatability is desired.
Constructors
| Improve this Doc View SourceZipNameTransform()
Initialize a new instance of ZipNameTransform
Declaration
public ZipNameTransform()
ZipNameTransform(String)
Initialize a new instance of ZipNameTransform
Declaration
public ZipNameTransform(string trimPrefix)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | trimPrefix | The string to trim from the front of paths if found. |
Properties
| Improve this Doc View SourceTrimPrefix
Get/set the path prefix to be trimmed from paths if present.
Declaration
public string TrimPrefix { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
The prefix is trimmed before any conversion from a windows path is done.
Methods
| Improve this Doc View SourceIsValidName(String)
Test a name to see if it is a valid name for a zip entry.
Declaration
public static bool IsValidName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name to test. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns true if the name is a valid zip name; false otherwise. |
Remarks
Zip path names are actually in unix format, and should only contain relative paths if a path is present. This means that the path stored should not contain a drive or device letter, or a leading slash. All slashes should forward slashes '/'. An empty name is valid where the input comes from standard input. A null name is not considered valid.
IsValidName(String, Boolean)
Test a name to see if it is a valid name for a zip entry.
Declaration
public static bool IsValidName(string name, bool relaxed)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name to test. |
| System.Boolean | relaxed | If true checking is relaxed about windows file names and absolute paths. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns true if the name is a valid zip name; false otherwise. |
Remarks
Zip path names are actually in Unix format, and should only contain relative paths. This means that any path stored should not contain a drive or device letter, or a leading slash. All slashes should forward slashes '/'. An empty name is valid for a file where the input comes from standard input. A null name is not considered valid.
TransformDirectory(String)
Transform a windows directory name according to the Zip file naming conventions.
Declaration
public string TransformDirectory(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The directory name to transform. |
Returns
| Type | Description |
|---|---|
| System.String | The transformed name. |
TransformFile(String)
Transform a windows file name according to the Zip file naming conventions.
Declaration
public string TransformFile(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The file name to transform. |
Returns
| Type | Description |
|---|---|
| System.String | The transformed name. |