Exemplo n.º 1
0
        public ContentType(string type)
        {
            Guard.ArgumentNotNullOrEmptyString(type, "type");
            _type = type;

            var offset = 0;

            _mediaType = MailBnfHelper.ReadToken(_type, ref offset);
            if (string.IsNullOrEmpty(_mediaType))
            {
                throw new FormatException("Content type invalid");
            }
            offset++;
            _subType = MailBnfHelper.ReadToken(_type, ref offset);
            if (string.IsNullOrEmpty(_subType))
            {
                throw new FormatException("Content type invalid");
            }
            _parameters = Parse(type, offset);
        }