static DirectoryCache FindOrCreateDirectoryCache(DirectoryReference Directory)
		{
			DirectoryCache FoundDirectoryCache;
			if (!Directories.TryGetValue(Directory, out FoundDirectoryCache))
			{
				FoundDirectoryCache = new DirectoryCache(Directory);
				Directories.Add(Directory, FoundDirectoryCache);
			}
			return FoundDirectoryCache;
		}
Exemplo n.º 2
0
        static DirectoryCache FindOrCreateDirectoryCache(DirectoryReference Directory)
        {
            DirectoryCache FoundDirectoryCache;

            if (!Directories.TryGetValue(Directory, out FoundDirectoryCache))
            {
                FoundDirectoryCache = new DirectoryCache(Directory);
                Directories.Add(Directory, FoundDirectoryCache);
            }
            return(FoundDirectoryCache);
        }
Exemplo n.º 3
0
        static public IEnumerable <DirectoryReference> EnumerateDirectoriesRecursively(DirectoryReference Directory)
        {
            DirectoryCache FoundDirectoryCache = FindOrCreateDirectoryCache(Directory);

            foreach (DirectoryReference SubDirectory in FoundDirectoryCache.EnumerateDirectories())
            {
                yield return(SubDirectory);

                foreach (DirectoryReference ChildSubDirectory in EnumerateDirectoriesRecursively(SubDirectory))
                {
                    yield return(ChildSubDirectory);
                }
            }
        }
        public static bool FileExists( string FileFullPath )
        {
            string FileDirectory = Utils.CleanDirectorySeparators(Path.GetDirectoryName(FileFullPath));
            string DirectoriesKey = FileDirectory.ToLowerInvariant();

            DirectoryCache FoundDirectoryCache;
            if( !Directories.TryGetValue( DirectoriesKey, out FoundDirectoryCache ) )
            {
                // First time we've seen this directory.  Gather information about files.
                FoundDirectoryCache = new DirectoryCache( FileDirectory );
                Directories.Add( DirectoriesKey, FoundDirectoryCache );
            }

            // Try to find the file in this directory
            return FoundDirectoryCache.HasFile( FileFullPath );
        }
Exemplo n.º 5
0
        static public bool FileExists(string FileFullPath)
        {
            string FileDirectory  = Utils.CleanDirectorySeparators(Path.GetDirectoryName(FileFullPath));
            string DirectoriesKey = FileDirectory.ToLowerInvariant();

            DirectoryCache FoundDirectoryCache;

            if (!Directories.TryGetValue(DirectoriesKey, out FoundDirectoryCache))
            {
                // First time we've seen this directory.  Gather information about files.
                FoundDirectoryCache = new DirectoryCache(FileDirectory);
                Directories.Add(DirectoriesKey, FoundDirectoryCache);
            }

            // Try to find the file in this directory
            return(FoundDirectoryCache.HasFile(FileFullPath));
        }
Exemplo n.º 6
0
        static public IEnumerable <DirectoryReference> EnumerateDirectories(DirectoryReference Directory)
        {
            DirectoryCache FoundDirectoryCache = FindOrCreateDirectoryCache(Directory);

            return(FoundDirectoryCache.EnumerateDirectories());
        }
Exemplo n.º 7
0
        static public bool DirectoryExists(DirectoryReference Directory)
        {
            DirectoryCache FoundDirectoryCache = FindOrCreateDirectoryCache(Directory);

            return(FoundDirectoryCache.Exists);
        }
Exemplo n.º 8
0
        static public bool FileExists(FileReference File)
        {
            DirectoryCache FoundDirectoryCache = FindOrCreateDirectoryCache(File.Directory);

            return(FoundDirectoryCache.HasFile(File));
        }