コード例 #1
0
 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;
 }
コード例 #2
0
 /// <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;
 }
コード例 #3
0
 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);
 }
コード例 #4
0
        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"));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
 /// <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));
 }