Bracket.Hosting.ZipArchiveDirectory.DirectoryExists C# (CSharp) Méthode

DirectoryExists() public méthode

public DirectoryExists ( string path ) : bool
path string
Résultat bool
        public bool DirectoryExists(string path)
        {
            path = RemoveRoot(path);
            foreach (ZipEntry entry in _storage.Entries)
            {
                string normalizedEntry = VirtualFileUtils.NormalizePath(entry.FileName);
                if (entry.IsDirectory && String.Compare(normalizedEntry, path, true) == 0)
                    return true;
                if (normalizedEntry.Length > path.Length && normalizedEntry.StartsWith(path,StringComparison.CurrentCultureIgnoreCase))
                    return true;
            }
            return false;
        }

Usage Example

 public void DirectoryExistsShouldNotFindFiles()
 {
     //Given
     var dir = new ZipArchiveDirectory("Fresh.zip");
     //when
     bool wasFound = dir.DirectoryExists("Fresh/README.txt");
     //then
     Assert.IsFalse(wasFound);
 }
All Usage Examples Of Bracket.Hosting.ZipArchiveDirectory::DirectoryExists