using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BestHTTP.Forms { /// /// This class represents a HTTP Form's field. /// public class HTTPFieldData { /// /// The form's field. /// public string Name { get; set; } /// /// Filename of the field. Optional. /// public string FileName { get; set; } /// /// Mime-type of the field. Optional /// public string MimeType { get; set; } /// /// Encoding of the data. Optional /// public Encoding Encoding { get; set; } /// /// The field's textual data. /// public string Text { get; set; } /// /// The field's binary data. /// public byte[] Binary { get; set; } /// /// Will return with the binary data, or if it's not present the textual data will be decoded to binary. /// public byte[] Payload { get { if (Binary != null) return Binary; if (Encoding == null) Encoding = Encoding.UTF8; return Binary = Encoding.GetBytes(Text); } } } }