/// <summary> /// Default constructor. /// </summary> /// <param name="mediaType">Media type with subtype. For example <b>text/plain</b>.</param> /// <exception cref="ArgumentNullException">Is raised when <b>mediaType</b> is null reference.</exception> public MIME_h_ContentType(string mediaType) { if (mediaType == null) { throw new ArgumentNullException(mediaType); } string[] type_subtype = mediaType.Split(new char[] { '/', }, 2); if (type_subtype.Length == 2) { if (type_subtype[0] == "" || !MIME_Reader.IsToken(type_subtype[0])) { throw new ArgumentException("Invalid argument 'mediaType' value '" + mediaType + "', value must be token."); } if (type_subtype[1] == "" || !MIME_Reader.IsToken(type_subtype[1])) { throw new ArgumentException("Invalid argument 'mediaType' value '" + mediaType + "', value must be token."); } m_Type = type_subtype[0]; m_SubType = type_subtype[1]; } else { throw new ArgumentException("Invalid argument 'mediaType' value '" + mediaType + "'."); } m_pParameters = new MIME_h_ParameterCollection(this); m_IsModified = true; }
/// <summary> /// Default constructor. /// </summary> /// <param name="dispositionType">The disposition-type. Known values are in <see cref="MIME_DispositionTypes">MIME_DispositionTypes</see>.</param> /// <exception cref="ArgumentNullException">Is raised when <b>dispositionType</b> is null reference.</exception> /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception> public MIME_h_ContentDisposition(string dispositionType) { if(dispositionType == null){ throw new ArgumentNullException("dispositionType"); } if(dispositionType == string.Empty){ throw new ArgumentException("Argument 'dispositionType' value must be specified."); } m_DispositionType = dispositionType; m_pParameters = new MIME_h_ParameterCollection(this); m_IsModified = true; }
/// <summary> /// Default constructor. /// </summary> /// <param name="dispositionType">The disposition-type. Known values are in <see cref="MIME_DispositionTypes">MIME_DispositionTypes</see>.</param> /// <exception cref="ArgumentNullException">Is raised when <b>dispositionType</b> is null reference.</exception> /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception> public MIME_h_ContentDisposition(string dispositionType) { if (dispositionType == null) { throw new ArgumentNullException("dispositionType"); } if (dispositionType == string.Empty) { throw new ArgumentException("Argument 'dispositionType' value must be specified."); } m_DispositionType = dispositionType; m_pParameters = new MIME_h_ParameterCollection(this); m_IsModified = true; }
/// <summary> /// Internal parser constructor. /// </summary> private MIME_h_ContentType() { m_pParameters = new MIME_h_ParameterCollection(this); }
/// <summary> /// Internal parser constructor. /// </summary> private MIME_h_ContentDisposition() { m_pParameters = new MIME_h_ParameterCollection(this); }
/// <summary> /// Default constructor. /// </summary> /// <param name="mediaType">Media type with subtype. For example <b>text/plain</b>.</param> /// <exception cref="ArgumentNullException">Is raised when <b>mediaType</b> is null reference.</exception> public MIME_h_ContentType(string mediaType) { if(mediaType == null){ throw new ArgumentNullException(mediaType); } string[] type_subtype = mediaType.Split(new char[]{'/',},2); if(type_subtype.Length == 2){ if(type_subtype[0] == "" || !MIME_Reader.IsToken(type_subtype[0])){ throw new ArgumentException("Invalid argument 'mediaType' value '" + mediaType + "', value must be token."); } if(type_subtype[1] == "" || !MIME_Reader.IsToken(type_subtype[1])){ throw new ArgumentException("Invalid argument 'mediaType' value '" + mediaType + "', value must be token."); } m_Type = type_subtype[0]; m_SubType = type_subtype[1]; } else{ throw new ArgumentException("Invalid argument 'mediaType' value '" + mediaType + "'."); } m_pParameters = new MIME_h_ParameterCollection(this); m_IsModified = true; }