4using System.Threading.Tasks;
40 private string contentType =
null;
41 private string name =
null;
42 private string fileName =
null;
43 private string transferEncoding =
null;
44 private string id =
null;
45 private string description =
null;
46 private byte[] raw =
null;
47 private byte[] transferDecoded =
null;
48 private object decoded =
null;
49 private int? size =
null;
50 private DateTimeOffset? creationDate =
null;
51 private DateTimeOffset? modificationDate =
null;
58 get => this.contentType;
59 set => this.contentType = value;
67 get => this.disposition;
68 set => this.disposition = value;
77 set => this.name = value;
86 set => this.fileName = value;
96 get => this.transferEncoding;
97 set => this.transferEncoding = value;
106 set => this.raw = value;
115 get => this.transferDecoded;
116 set => this.transferDecoded = value;
126 set => this.decoded = value;
135 set => this.id = value;
143 get => this.description;
144 set => this.description = value;
153 set => this.size = value;
161 get => this.creationDate;
162 set => this.creationDate = value;
170 get => this.modificationDate;
171 set => this.modificationDate = value;
177 if (!
string.IsNullOrEmpty(this.name))
179 else if (!
string.IsNullOrEmpty(this.fileName))
180 return this.fileName;
182 return base.ToString();
185 internal async Task AssertEncoded()
187 if (!(this.raw is
null))
190 if (this.transferDecoded is
null)
195 this.transferDecoded = P.
Encoded;
200 if (this.raw is
null)
202 this.raw = Encoding.ASCII.GetBytes(Convert.ToBase64String(
this.transferDecoded));
203 this.transferEncoding =
"base64";
212 public static Task<EmbeddedContent>
Encode(
object Content)
214 return Encode(Content, Encoding.UTF8);
223 public static async Task<EmbeddedContent>
Encode(
object Content, Encoding Encoding)
232 Raw = Encoded.Encoded
Contains information about a response to a content request.
byte[] Encoded
Encoded object.
string ContentType
Internet Content-Type of encoded object.
void AssertOk()
Asserts response is OK.
Static class managing encoding and decoding of internet content.
static Task< ContentResponse > EncodeAsync(object Object, Encoding Encoding, params string[] AcceptedContentTypes)
Encodes an object.
Represents content embedded in other content.
string FileName
Filename of embedded object.
ContentDisposition Disposition
Disposition of embedded object.
string Name
Name of embedded object.
string Description
Content-Description of embedded object, if defined.
DateTimeOffset? CreationDate
Creation-Date of content, if available.
string ContentType
Content-Type of embedded object.
object Decoded
Decoded body of embedded object. ContentType defines how TransferDecoded is transformed into Decoded.
static async Task< EmbeddedContent > Encode(object Content, Encoding Encoding)
Encodes an object into an embedded content.
override string ToString()
int? Size
Size of content, if available.
byte[] TransferDecoded
Transformed body of embedded object. TransferEncoding defines how Raw is transformed into TransferDec...
static Task< EmbeddedContent > Encode(object Content)
Encodes an object into an embedded content.
byte[] Raw
Raw, untransformed body of embedded object.
string TransferEncoding
Content Transfer Encoding of embedded object, if defined. Affects how Raw is transformed into Transfe...
string ID
Content-ID of embedded object, if defined.
DateTimeOffset? ModificationDate
Modification-Date of content, if available.
ContentDisposition
Content disposition