public static CleanName ( string name ) : string | ||
name | string | The name to clean |
Результат | string |
public static string CleanName(string name)
{
if (name == null) {
return string.Empty;
}
if (Path.IsPathRooted(name)) {
// NOTE:
// for UNC names... \\machine\share\zoom\beet.txt gives \zoom\beet.txt
name = name.Substring(Path.GetPathRoot(name).Length);
}
name = name.Replace(@"\", "/");
while ((name.Length > 0) && (name[0] == '/')) {
name = name.Remove(0, 1);
}
return name;
}
internal ZipEntry(string name, int versionRequiredToExtract, int madeByInfo, CompressionMethod method) { this.externalFileAttributes = -1; this.method = CompressionMethod.Deflated; this.zipFileIndex = -1L; base..ctor(); if (name == null) { throw new ArgumentNullException("name"); } if (name.Length > 65535) { throw new ArgumentException("Name is too long", "name"); } if (versionRequiredToExtract != 0 && versionRequiredToExtract < 10) { throw new ArgumentOutOfRangeException("versionRequiredToExtract"); } this.DateTime = DateTime.Now; this.name = ZipEntry.CleanName(name); this.versionMadeBy = (ushort)madeByInfo; this.versionToExtract = (ushort)versionRequiredToExtract; this.method = method; }