4using System.Threading.Tasks;
32 "application/x-zip-compressed"
83 public Task<ContentResponse>
DecodeAsync(
string ContentType,
byte[] Data, Encoding Encoding,
84 KeyValuePair<string, string>[] Fields, Uri BaseUri,
ICodecProgress Progress)
97 switch (FileExtension.ToLower())
104 ContentType =
string.Empty;
117 switch (ContentType.ToLower())
124 FileExtension =
string.Empty;
159 public Task<ContentResponse>
EncodeAsync(
object Object, Encoding Encoding,
ICodecProgress Progress, params
string[] AcceptedContentTypes)
162 return Task.FromResult(
new ContentResponse(
new ArgumentException(
"Unable to encode object, or content type not accepted.", nameof(Object))));
169 return Task.FromResult(
new ContentResponse(
new ArgumentException(
"Unable to encode object of type " + (Object?.GetType()?.FullName) +
".", nameof(Object))));
171 return Task.FromResult(
new ContentResponse(ContentType, Object, Data));
Contains information about a response to a content request.
Static class managing encoding and decoding of internet content.
static bool IsAccepted(string ContentType, params string[] AcceptedContentTypes)
Checks if a given content type is acceptable.
ZIP File encoder/decoder.
bool TryGetFileExtension(string ContentType, out string FileExtension)
Tries to get the file extension of an item, given its Content-Type.
static readonly string[] ZipFileContentTypes
ZIP File content types.
string[] ContentTypes
Supported content types.
bool Decodes(string ContentType, out Grade Grade)
If the decoder decodes an object with a given content type.
bool Encodes(object Object, out Grade Grade, params string[] AcceptedContentTypes)
If the encoder encodes a given object.
const string DefaultContentType
application/zip
static readonly string[] ZipFileFileExtensions
Plain text file extensions.
bool TryGetContentType(string FileExtension, out string ContentType)
Tries to get the content type of an item, given its file extension.
ZipCodec()
ZIP File encoder/decoder.
Task< ContentResponse > DecodeAsync(string ContentType, byte[] Data, Encoding Encoding, KeyValuePair< string, string >[] Fields, Uri BaseUri, ICodecProgress Progress)
Decodes an object.
string[] FileExtensions
Supported file extensions.
Task< ContentResponse > EncodeAsync(object Object, Encoding Encoding, ICodecProgress Progress, params string[] AcceptedContentTypes)
Encodes an object.
byte[] Binary
Binary representation of ZIP file.
Interface for reporting progress about an encoding or decoding.
Basic interface for Internet Content decoders. A class implementing this interface and having a defau...
Basic interface for Internet Content encoders. A class implementing this interface and having a defau...