public HttpContentTypeField(string mediaType, string mediaSubtype, HttpFieldParameters parameters) : base("Content-Type", string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}/{1}{2}", (object)mediaType, (object)mediaSubtype, (object)parameters)) { this.MediaType = mediaType; this.MediaSubtype = mediaSubtype; this.Parameters = parameters; }
/// <summary> /// Creates a Content Type Field according to the given media type, media subtype and parameters. /// </summary> /// <param name="mediaType">The main type of the content of this HTTP message.</param> /// <param name="mediaSubtype">The subtype of the content of this HTTP message.</param> /// <param name="parameters">Parameters on the specific type.</param> public HttpContentTypeField(string mediaType, string mediaSubtype, HttpFieldParameters parameters) : base(FieldName, string.Format(CultureInfo.InvariantCulture, "{0}/{1}{2}", mediaType, mediaSubtype, parameters)) { MediaType = mediaType; MediaSubtype = mediaSubtype; Parameters = parameters; }
public bool Equals(HttpFieldParameters other) { if (other != null) { return(IDictionaryExtensions.DictionaryEquals <string, string>((IDictionary <string, string>) this._parameters, (IDictionary <string, string>)other._parameters)); } return(false); }
internal HttpContentTypeField(byte[] fieldValue) : base("Content-Type", (IList <byte>)fieldValue) { string @string = HttpRegex.GetString(fieldValue); Match match = HttpContentTypeField._regex.Match(@string); if (!match.Success) { return; } this.MediaType = Enumerable.First <Capture>(Enumerable.Cast <Capture>((IEnumerable)match.Groups["MediaType"].Captures)).Value; this.MediaSubtype = Enumerable.First <Capture>(Enumerable.Cast <Capture>((IEnumerable)match.Groups["MediaSubType"].Captures)).Value; this.Parameters = new HttpFieldParameters(MatchExtensions.GroupCapturesValues(match, "ParameterName"), MatchExtensions.GroupCapturesValues(match, "ParameterValue")); }
internal HttpContentTypeField(byte[] fieldValue) : base(FieldName, fieldValue) { string fieldValueString = HttpRegex.GetString(fieldValue); Match match = _regex.Match(fieldValueString); if (!match.Success) { return; } MediaType = match.Groups[MediaTypeGroupName].Captures.Cast <Capture>().First().Value; MediaSubtype = match.Groups[MediaSubTypeGroupName].Captures.Cast <Capture>().First().Value; Parameters = new HttpFieldParameters(match.GroupCapturesValues(HttpRegex.ParameterNameGroupName), match.GroupCapturesValues(HttpRegex.ParameterValueGroupName)); }
/// <summary> /// Two HTTP field parameters are equal if all of their parameters are equal. /// </summary> public bool Equals(HttpFieldParameters other) { return(other != null && _parameters.DictionaryEquals(other._parameters)); }