Esempio n. 1
0
        /// <summary>
        /// The file exists.
        /// </summary>
        /// <param name="virtualPath">
        /// The virtual path.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool FileExists(string virtualPath)
        {
            if (!virtualPath.EndsWith(EmbeddedResource.FILE_EXTENSION, StringComparison.InvariantCultureIgnoreCase))
            {
                return(false);
            }

            string resourceName = EmbeddedResourceHelper.GetResourceNameFromPath(virtualPath);

            return(EmbeddedResourceHelper.ResourceExists(resourceName));
        }
Esempio n. 2
0
        public ActionResult GetSharedResource(string folder, string file)
        {
            string fileName       = file.TrimEnd(EmbeddedResource.FILE_EXTENSION);
            var    resourceStream = EmbeddedResourceHelper.GetResource(EmbeddedResource.RESOURCE_PREFIX + folder + "." + fileName);

            if (resourceStream != null)
            {
                return(new FileStreamResult(resourceStream, GetMimeType(fileName)));;
            }

            return(this.HttpNotFound());
        }
        /// <summary>
        /// When overridden in a derived class, returns a read-only stream to the virtual resource.
        /// </summary>
        /// <returns>
        /// A read-only stream to the virtual file.
        /// </returns>
        public Stream Open()
        {
            string resourceName = EmbeddedResourceHelper.GetResourceNameFromPath(this.virtualPath);

            return(EmbeddedResourceHelper.GetResource(resourceName));
        }