Esempio n. 1
0
        public override Stream OpenRead(string relativePath)
        {
            if (File.Exists(relativePath))
            {
                return(DoOpen(relativePath, FileAccess.Read));
            }

            VirtualFileStorageDriver d = FindDriverForPath(relativePath);

            if (d != null)
            {
                return(d.OpenRead(relativePath.Substring(d.RootPath.Length)));
            }
            throw new FileNotFoundException("File not found.", RootPath + relativePath);
        }
Esempio n. 2
0
        public Stream OpenRead(string fullPath)
        {
            if (String.IsNullOrWhiteSpace(fullPath))
            {
                throw new ArgumentException();
            }
            fullPath = FileUtil.NormalizePathSeparator(fullPath, false);

            // Early test: if it is a file, we shortcut the process.
            if (File.Exists(fullPath))
            {
                return(_root.DoOpen(fullPath, FileAccess.Read));
            }

            VirtualFileStorageDriver closestDriver = FindClosestDriver(fullPath);

            return(closestDriver.OpenRead(fullPath.Substring(closestDriver.RootPath.Length)));
        }