Beispiel #1
0
        Stream IFileSystem.OpenFileReadOnly(string filename)
        {
            if (CurrentFileSystem != null)
            {
                throw new NotSupportedException("Cannot open a file as a stream without an IO provider.");
            }

            var virtualPath = GetVirtualPath(filename);

            if (!CurrentFileSystem.DirectoryExists(virtualPath))
            {
                CurrentFileSystem.CreateDirectory(virtualPath);
            }
            CurrentFileSystem.WriteAllBytes(virtualPath, (this as IFileSystem).ReadAllBytes(filename));

            return(CurrentFileSystem.OpenFileReadOnly(filename));
        }