private bool ResourceFileExists(string virtualPath) { Assembly assembly = Assembly.GetExecutingAssembly(); var resourcename = EmbeddedVirtualFile.GetResourceName(virtualPath); var result = resourcename != null && assembly.GetManifestResourceNames().Contains(resourcename); return(result); }
/// <summary> /// Gets a virtual file from the virtual file system. /// </summary> /// <param name="virtualPath">The path to the virtual file.</param> /// <returns>A descendent of the <see cref="System.Web.Hosting.VirtualFile"/> class that represents a file as an embedded resource.</returns> public override VirtualFile GetFile(string virtualPath) { if (base.FileExists(virtualPath)) return base.GetFile(virtualPath); string embeddedPath = this.GetEmbeddedPath(virtualPath); EmbeddedVirtualFile returnValue = null; if (this.TryGetEmbeddedPath(virtualPath, out embeddedPath)) returnValue = new EmbeddedVirtualFile(virtualPath, this.embeddedAssembly.GetManifestResourceStream(embeddedPath)); return returnValue; }