/// <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); } }
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)); }
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)); }
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); }
public override bool FileExists(string path) { return(VirtualFilesystem.GetFile(path) != null); }
/// <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); }
/// <exception cref="ArgumentException">Invalid path.</exception> public override string /*!*/ GetFullPath(string /*!*/ path) { return(VirtualFilesystem.NormalizePath(path)); }