Show / Hide Table of Contents

Class ZipNameTransform

ZipNameTransform transforms names as per the Zip file naming convention.

Inheritance
System.Object
ZipNameTransform
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 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 Source

ZipNameTransform()

Initialize a new instance of ZipNameTransform

Declaration
public ZipNameTransform()
| Improve this Doc View Source

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 Source

TrimPrefix

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 Source

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

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

Implements

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