Пример #1
0
        public StorageFileStreamResult DownloadFile(StorageAccount storageAccount, string url)
        {
            if (storageAccount == null)
            {
                throw new ArgumentNullException("storageAccount");
            }
            if (string.IsNullOrEmpty(url))
            {
                throw new ArgumentNullException("url");
            }

            IStoragePlugin plugin = GetStoragePlugin(storageAccount.StoragePluginId);

            if (plugin == null)
            {
                throw new StoragePluginNotFoundException(storageAccount.StoragePluginId);
            }

            var streamResult = plugin.GetFileStream(url, storageAccount.Id);

            streamResult.FileStream = _streamFactory.MakeDownloadStream(streamResult.FileStream);
            return(streamResult);
        }