예제 #1
0
        private IActionResult GetResult(string resourceName, string contentType)
        {
            var assembly = typeof(csscsrController).GetTypeInfo().Assembly;

            resourceName = resourceHelper.ResolveResourceIdentifier(resourceName);
            var resourceStream = assembly.GetManifestResourceStream(resourceName);

            if (resourceStream == null)
            {
                log.LogError("resource not found for " + resourceName);
                return(NotFound());
            }

            log.LogDebug("resource found for " + resourceName);

            return(new FileStreamResult(resourceStream, contentType));
        }
        private IActionResult GetResult(string resourceName, string contentType)
        {
            var assembly = typeof(FileManagerController).GetTypeInfo().Assembly;

            resourceName = _resourceHelper.ResolveResourceIdentifier(resourceName);
            var resourceStream = assembly.GetManifestResourceStream(resourceName);

            if (resourceStream == null)
            {
                _log.LogError("resource not found for " + resourceName);
                return(NotFound());
            }

            _log.LogDebug("resource found for " + resourceName);

            var status = ETagGenerator.AddEtagForStream(HttpContext, resourceStream);

            if (status != null)
            {
                return(status);
            }                                     //304

            return(new FileStreamResult(resourceStream, contentType));
        }