Пример #1
0
 /// <summary>
 /// Convert a string path to a Uri
 /// </summary>
 /// <param name="path">relative or absolute path</param>
 /// <returns>normalized URI</returns>
 private Uri /*!*/ PathToUri(string /*!*/ path)
 {
     try {
         return(new Uri(VirtualFilesystem.NormalizePath(path), UriKind.RelativeOrAbsolute));
     } catch (UriFormatException e) {
         throw new ArgumentException("The specified path is invalid", e);
     }
 }
Пример #2
0
 public override Stream OpenInputFileStream(string path, FileMode mode, FileAccess access, FileShare share)
 {
     if (mode != FileMode.Open || access != FileAccess.Read)
     {
         throw new IOException(
                   string.Format("can only read files from the {0}",
                                 VirtualFilesystem.Name()
                                 )
                   );
     }
     return(OpenInputFileStream(path));
 }
Пример #3
0
        public override Assembly LoadAssemblyFromPath(string path)
        {
            Stream stream = VirtualFilesystem.GetFile(path);

            if (stream == null)
            {
                throw new FileNotFoundException(
                          string.Format("could not find assembly: {0} (check the {1})",
                                        path, VirtualFilesystem.Name()
                                        )
                          );
            }
            return(new AssemblyPart().Load(stream));
        }
Пример #4
0
        public override Stream OpenInputFileStream(string path)
        {
            Stream result = VirtualFilesystem.GetFile(GetFullPath(path));

            if (result == null)
            {
                throw new IOException(
                          String.Format("file {0} not found (check the {1})",
                                        path, VirtualFilesystem.Name()
                                        )
                          );
            }
            return(result);
        }
Пример #5
0
 public override bool FileExists(string path)
 {
     return(VirtualFilesystem.GetFile(path) != null);
 }
Пример #6
0
 /// <summary>
 /// Executes "action" in the context of the "storageUnit".
 /// </summary>
 /// <param name="xapFile"></param>
 /// <param name="action"></param>
 public void UsingStorageUnit(object storageUnit, Action action)
 {
     VirtualFilesystem.UsingStorageUnit(storageUnit, action);
 }
Пример #7
0
 /// <exception cref="ArgumentException">Invalid path.</exception>
 public override string /*!*/ GetFullPath(string /*!*/ path)
 {
     return(VirtualFilesystem.NormalizePath(path));
 }