Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
BlobContent.cs
1using System;
3
5{
10 {
11 private readonly Uri uri;
12 private readonly byte[] encoded;
13 private readonly string contentType;
14 private readonly Dictionary<string, object>? metaData;
15
23 public BlobContent(Uri Uri, byte[] Encoded, string ContentType,
24 Dictionary<string, object>? MetaData)
25 {
26 this.uri = Uri;
27 this.encoded = Encoded;
28 this.contentType = ContentType;
29 this.metaData = MetaData;
30 }
31
36 public Dictionary<string, object> Encode()
37 {
38 Dictionary<string, object> Result = new Dictionary<string, object>
39 {
40 { "uri", this.uri.OriginalString },
41 { "blob", Convert.ToBase64String(this.encoded) }
42 };
43
44 if (!string.IsNullOrEmpty(this.contentType))
45 Result["mimeType"] = this.contentType;
46
47 if (!(this.metaData is null))
48 Result["_meta"] = this.metaData;
49
50 return Result;
51 }
52 }
53}
BlobContent(Uri Uri, byte[] Encoded, string ContentType, Dictionary< string, object >? MetaData)
BLOB resource content
Definition: BlobContent.cs:23
Dictionary< string, object > Encode()
Encodes a resource content.
Definition: BlobContent.cs:36