Show / Hide Table of Contents

Class WindowsNameTransform

WindowsNameTransform transforms ZipFile names to windows compatible ones.

Inheritance
System.Object
WindowsNameTransform
Implements
INameTransform
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ICSharpCode.SharpZipLib.Zip
Assembly: ICSharpCode.SharpZipLib.dll
Syntax
public class WindowsNameTransform : INameTransform

Constructors

| Improve this Doc View Source

WindowsNameTransform()

Initialise a default instance of WindowsNameTransform

Declaration
public WindowsNameTransform()
| Improve this Doc View Source

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 Source

AllowParentTraversal

Allow parent directory traversal in file paths (e.g. ../file)

Declaration
public bool AllowParentTraversal { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

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
| Improve this Doc View Source

Replacement

Gets or set the character to replace invalid characters during transformations.

Declaration
public char Replacement { get; set; }
Property Value
Type Description
System.Char
| Improve this Doc View Source

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 Source

IsValidName(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.

| Improve this Doc View Source

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

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

Implements

INameTransform
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2000-2022 SharpZipLib Contributors