aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Transport/Web/StorageBlobDownloader.cs
diff options
context:
space:
mode:
authorMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
committerMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
commit00a491d93733d4625ad329b2ba8237f445364b3f (patch)
tree4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/Tango.Transport/Web/StorageBlobDownloader.cs
parent124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff)
downloadTango-00a491d9.tar.gz
Tango-00a491d9.zip
merge
Diffstat (limited to 'Software/Visual_Studio/Tango.Transport/Web/StorageBlobDownloader.cs')
-rw-r--r--Software/Visual_Studio/Tango.Transport/Web/StorageBlobDownloader.cs27
1 files changed, 6 insertions, 21 deletions
diff --git a/Software/Visual_Studio/Tango.Transport/Web/StorageBlobDownloader.cs b/Software/Visual_Studio/Tango.Transport/Web/StorageBlobDownloader.cs
index dfbd9f93a..603463823 100644
--- a/Software/Visual_Studio/Tango.Transport/Web/StorageBlobDownloader.cs
+++ b/Software/Visual_Studio/Tango.Transport/Web/StorageBlobDownloader.cs
@@ -9,33 +9,30 @@ using Tango.Core.IO;
namespace Tango.Transport.Web
{
- public class StorageBlobDownloader : IWebFileDownloader
+ public class StorageBlobDownloader : IDisposable
{
private bool _disposed;
private FileStreamWrapper _stream;
private long _fileSize;
- private String _fileName;
public CloudBlockBlob Blob { get; private set; }
- public String Address { get; private set; }
-
- public event EventHandler<WebFileDownloaderProgressEventArgs> Progress;
+ public event EventHandler<StorageBlobProgressEventArgs> Progress;
public StorageBlobDownloader(CloudBlockBlob blob, String fileName)
{
Blob = blob;
- _fileName = fileName;
+ _stream = new FileStreamWrapper(fileName, FileMode.Create, OnProgress);
}
public StorageBlobDownloader(String blobAddress, String fileName) : this(new CloudBlockBlob(new Uri(blobAddress)), fileName)
{
- Address = blobAddress;
+
}
private void OnProgress(long current)
{
- Progress?.Invoke(this, new WebFileDownloaderProgressEventArgs()
+ Progress?.Invoke(this, new StorageBlobProgressEventArgs()
{
Current = current,
Total = _fileSize,
@@ -52,8 +49,6 @@ namespace Tango.Transport.Web
await Blob.FetchAttributesAsync();
_fileSize = Blob.Properties.Length;
- _stream = new FileStreamWrapper(_fileName, FileMode.Create, OnProgress);
-
await Blob.DownloadToStreamAsync(_stream);
Dispose();
}
@@ -63,18 +58,8 @@ namespace Tango.Transport.Web
if (!_disposed)
{
_disposed = true;
-
- if (_stream != null)
- {
- _stream.Dispose();
- }
+ _stream.Dispose();
}
}
-
- public async Task<long> GetFileSize()
- {
- await Blob.FetchAttributesAsync();
- return Blob.Properties.Length;
- }
}
}