4using System.Threading.Tasks;
79 KeyValuePair<string, string>[] Fields, Uri BaseUri,
ICodecProgress Progress)
94 if (
string.Compare(FileExtension,
"csv",
true) == 0)
117 FileExtension =
"csv";
121 FileExtension =
string.Empty;
136 (Object is
string[][] || Object is
IMatrix))
156 public Task<ContentResponse>
EncodeAsync(
object Object, Encoding Encoding,
161 if (Object is
string[][] Records)
166 return Task.FromResult(
new ContentResponse(
new ArgumentException(
"Unable to encode as CSV.", nameof(Object))));
168 if (Encoding is
null)
169 Encoding = Encoding.UTF8;
Helps with common CSV-related tasks. (CSV=Comma Separated Values)
static string[][] Parse(string Csv)
Parses a CSV string.
static string Encode(string[][] Records)
Encodes records as a Comma-separated values string.
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.
bool Encodes(object Object, out Grade Grade, params string[] AcceptedContentTypes)
If the encoder encodes a given object.
bool TryGetContentType(string FileExtension, out string ContentType)
Tries to get the content type of an item, given its file extension.
bool Decodes(string ContentType, out Grade Grade)
If the decoder decodes an object with a given content type.
string[] FileExtensions
Supported file extensions.
Task< ContentResponse > EncodeAsync(object Object, Encoding Encoding, ICodecProgress Progress, params string[] AcceptedContentTypes)
Encodes an object.
Task< ContentResponse > DecodeAsync(string ContentType, byte[] Data, Encoding Encoding, KeyValuePair< string, string >[] Fields, Uri BaseUri, ICodecProgress Progress)
Decodes an object.
string[] ContentTypes
Supported content types.
static readonly string[] CsvContentTypes
CSV content types.
bool TryGetFileExtension(string ContentType, out string FileExtension)
Tries to get the file extension of an item, given its Content-Type.
static readonly string[] CsvFileExtensions
CSV content types.
const string ContentType
Content-Type for CSV files.
Static class managing binary representations of strings.
static string GetString(byte[] Data, int Offset, int Count, Encoding DefaultEncoding)
Gets a string from its binary representation, taking any Byte Order Mark (BOM) into account.
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...
Basic interface for matrices.