コード例 #1
0
        public HttpResponseMessage DownloadEmbeddedFilePath(string fileTypeKey, string suffix, string fileName)
        {
            var fileType = SymbolLogic<FileTypeSymbol>.ToSymbol(fileTypeKey);

            var virtualFile = new EmbeddedFilePathEntity(fileType)
            {
                Suffix = suffix,
                FileName = fileName
            };

            var pair = FileTypeLogic.FileTypes.GetOrThrow(fileType).GetPrefixPair(virtualFile);

            var fullPhysicalPath = Path.Combine(pair.PhysicalPrefix, suffix);
            
            return GetHttpReponseMessage(File.OpenRead(fullPhysicalPath), fullPhysicalPath);
        }
コード例 #2
0
ファイル: FileController.cs プロジェクト: mapacheL/extensions
        public FileResult DownloadEmbedded(Lite<FileTypeSymbol> lite, string suffix, string fileName)
        {
            var virtualFile = new EmbeddedFilePathEntity(lite.Retrieve())
            {
                Suffix = suffix,
                FileName = fileName
            };

            var pair = FileTypeLogic.FileTypes.GetOrThrow(lite.Retrieve()).GetPrefixPair(virtualFile);

            var fullPhysicalPath = Path.Combine(pair.PhysicalPrefix, suffix);

            return new FilePathResult(fullPhysicalPath, MimeMapping.GetMimeMapping(fullPhysicalPath)) { FileDownloadName = fileName };
        }