Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="virtualFile"></param>
        /// <returns></returns>
        public bool FileExists(string virtualFile)
        {
            if (!virtualFile.EndsWith(EmbeddedResourceConstants.FILE_EXTENSION, StringComparison.InvariantCultureIgnoreCase))
            {
                return(false);
            }

            string resourceName = EmbeddedResourceHelper.GetResourceNameFromPath(virtualFile);

            return(EmbeddedResourceHelper.ResourceExists(resourceName));
        }
Beispiel #2
0
        public ActionResult GetSharedResource(string folder, string file)
        {
            string fileName       = file.TrimEnd(EmbeddedResourceConstants.FILE_EXTENSION);
            var    resourceStream = EmbeddedResourceHelper.GetResource(EmbeddedResourceConstants.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.virtualFile);

            return(EmbeddedResourceHelper.GetResource(resourceName));
        }