-
Notifications
You must be signed in to change notification settings - Fork 5
/
BlobResource.cs
71 lines (66 loc) · 2.36 KB
/
BlobResource.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//using System;
//using System.Collections.Generic;
//using System.Diagnostics;
//using System.IO;
//using System.Text;
//using System.Threading.Tasks;
//using Microsoft.Bot.Builder.Dialogs.Declarative.Resources;
//namespace Iciclecreek.Bot.Builder.Dialogs.Database.AzureStorage
//{
// /// <summary>
// /// Class which represents a file as a resource.
// /// </summary>
// public class BlobResource : Resource
// {
// private Task<byte[]> contentTask;
// /// <summary>
// /// Initializes a new instance of the <see cref="FileResource"/> class.
// /// </summary>
// /// <param name="url">path to file.</param>
// public BlobResource(Blob)
// {
// this.FullName = url;
// this.Id = Path.GetFileName(url);
// }
// /// <summary>
// /// Open a stream to the resource.
// /// </summary>
// /// <returns>Stream for accesssing the content of the resource.</returns>
// public override async Task<Stream> OpenStreamAsync()
// {
// if (contentTask == null)
// {
// this.contentTask = Task.Run(async () =>
// {
// Trace.TraceInformation($"Loading {this.Id}");
// var fileInfo = new FileInfo(this.FullName);
// Stream stream = null;
// try
// {
// stream = File.OpenRead(this.FullName);
// var buffer = new byte[fileInfo.Length];
// await stream.ReadAsync(buffer, 0, (int)fileInfo.Length).ConfigureAwait(false);
// return buffer;
// }
// finally
// {
// if (stream != null)
// {
// stream.Close();
// }
// }
// });
// }
// var content = await contentTask.ConfigureAwait(false);
// return new MemoryStream(content);
// }
// /// <summary>
// /// Returns a string that represents the current object.
// /// </summary>
// /// <returns>A string that represents the current object.</returns>
// public override string ToString()
// {
// return this.Id;
// }
// }
//}