Class WindowsNameTransform
WindowsNameTransform transforms ZipFile names to windows compatible ones.
Inheritance
Implements
Inherited Members
Namespace: ICSharpCode.SharpZipLib.Zip
Assembly: ICSharpCode.SharpZipLib.dll
Syntax
public class WindowsNameTransform : INameTransform
Constructors
| Improve this Doc View SourceWindowsNameTransform()
Initialise a default instance of WindowsNameTransform
Declaration
public WindowsNameTransform()
WindowsNameTransform(String, Boolean)
Initialises a new instance of WindowsNameTransform
Declaration
public WindowsNameTransform(string baseDirectory, bool allowParentTraversal = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseDirectory | |
System.Boolean | allowParentTraversal | Allow parent directory traversal in file paths (e.g. ../file) |
Properties
| Improve this Doc View SourceAllowParentTraversal
Allow parent directory traversal in file paths (e.g. ../file)
Declaration
public bool AllowParentTraversal { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
BaseDirectory
Gets or sets a value containing the target directory to prefix values with.
Declaration
public string BaseDirectory { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Replacement
Gets or set the character to replace invalid characters during transformations.
Declaration
public char Replacement { get; set; }
Property Value
Type | Description |
---|---|
System.Char |
TrimIncomingPaths
Gets or sets a value indicating whether paths on incoming values should be removed.
Declaration
public bool TrimIncomingPaths { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceIsValidName(String)
Test a name to see if it is a valid name for a windows filename as extracted from a Zip archive.
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
The filename isnt a true windows path in some fundamental ways like no absolute paths, no rooted paths etc.
MakeValidName(String, Char)
Force a name to be valid by replacing invalid characters with a fixed value
Declaration
public static string MakeValidName(string name, char replacement)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name to make valid |
System.Char | replacement | The replacement character to use for any invalid characters. |
Returns
Type | Description |
---|---|
System.String | Returns a valid name |
TransformDirectory(String)
Transform a Zip directory name to a windows directory name.
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 Zip format file name to a windows style one.
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. |