2using System.Collections.Generic;
4using System.Threading.Tasks;
68 if (
string.Compare(FileExtension,
"dsn",
true) == 0)
91 FileExtension =
"dsn";
95 FileExtension =
string.Empty;
110 public Task<object>
DecodeAsync(
string ContentType,
byte[] Data, Encoding Encoding, KeyValuePair<string, string>[] Fields, Uri BaseUri)
113 List<string[]> Sections =
new List<string[]>();
114 List<string> Section =
new List<string>();
116 foreach (
string Row
in Dsn.Replace(
"\r\n",
"\n").Replace(
"\r",
"\n").Split(
'\n'))
118 if (
string.IsNullOrEmpty(Row))
120 if (Section.Count > 0)
122 Sections.Add(Section.ToArray());
128 if (Row[0] <=
' ' && Section.Count > 0)
129 Section[Section.Count - 1] += Row;
135 if (Section.Count > 0)
137 Sections.Add(Section.ToArray());
143 int i, c = Sections.Count;
155 for (i = 1; i < c; i++)
159 return Task.FromResult<
object>(
new DeliveryStatus(Dsn, PerMessage, PerRecipients));
Helps with parsing of commong data types.
static string GetString(byte[] Data, Encoding DefaultEncoding)
Gets a string from its binary representation, taking any Byte Order Mark (BOM) into account.
Decodes Delivery Status information, as defined in RFC 3464:
Task< object > DecodeAsync(string ContentType, byte[] Data, Encoding Encoding, KeyValuePair< string, string >[] Fields, Uri BaseUri)
Decodes an object.
DeliveryStatusDecoder()
Decodes Delivery Status information, as defined in RFC 3464:
bool TryGetContentType(string FileExtension, out string ContentType)
Tries to get the content type of an item, given its file extension.
string[] FileExtensions
Supported file extensions.
bool Decodes(string ContentType, out Grade Grade)
If the decoder decodes an object with a given content type.
const string ContentType
message/delivery-status
bool TryGetFileExtension(string ContentType, out string FileExtension)
Tries to get the file extension of an item, given its Content-Type.
string[] ContentTypes
Supported content types.
Delivery Status information, as defined in RFC 3464:
Information fields for the message.
Information fields for one recipient.
Basic interface for Internet Content decoders. A class implementing this interface and having a defau...