示例#1
0
        // Token: 0x06000187 RID: 391 RVA: 0x00006F78 File Offset: 0x00005178
        public sealed override MimeNode Clone()
        {
            AddressHeader addressHeader = new AddressHeader(base.Name, base.HeaderId);

            this.CopyTo(addressHeader);
            return(addressHeader);
        }
示例#2
0
        // Token: 0x06000189 RID: 393 RVA: 0x0000700C File Offset: 0x0000520C
        public static AddressHeader Parse(string name, string value, AddressParserFlags flags)
        {
            AddressHeader addressHeader = new AddressHeader(name);

            if (!string.IsNullOrEmpty(value))
            {
                byte[] array = ByteString.StringToBytes(value, true);
                addressHeader.parser = new MimeAddressParser();
                addressHeader.parser.Initialize(new MimeStringList(array, 0, array.Length), AddressParserFlags.None != (flags & AddressParserFlags.IgnoreComments), AddressParserFlags.None != (flags & AddressParserFlags.AllowSquareBrackets), true);
                addressHeader.staticParsing = true;
                addressHeader.Parse();
            }
            return(addressHeader);
        }
示例#3
0
        internal override MimeNode ParseNextChild()
        {
            MimeNode mimeNode = null;

            if (!this.parsed && base.Parent != null)
            {
                AddressHeader addressHeader = base.Parent as AddressHeader;
                if (addressHeader != null)
                {
                    mimeNode = addressHeader.ParseNextMailBox(true);
                }
            }
            this.parsed = (mimeNode == null);
            return(mimeNode);
        }
示例#4
0
        internal static Header Create(string name, HeaderId headerId)
        {
            if (headerId < HeaderId.Unknown || headerId > (HeaderId)MimeData.nameIndex.Length)
            {
                throw new ArgumentException(Strings.InvalidHeaderId, "headerId");
            }
            if (headerId == HeaderId.Unknown)
            {
                throw new ArgumentException(Strings.CannotDetermineHeaderNameFromId, "headerId");
            }
            Header header;

            switch (MimeData.headerNames[(int)MimeData.nameIndex[(int)headerId]].headerType)
            {
            case HeaderType.AsciiText:
                header = new AsciiTextHeader(MimeData.headerNames[(int)MimeData.nameIndex[(int)headerId]].name, headerId);
                break;

            case HeaderType.Date:
                header = new DateHeader(MimeData.headerNames[(int)MimeData.nameIndex[(int)headerId]].name, headerId);
                break;

            case HeaderType.Received:
                header = new ReceivedHeader();
                break;

            case HeaderType.ContentType:
                header = new ContentTypeHeader();
                break;

            case HeaderType.ContentDisposition:
                header = new ContentDispositionHeader();
                break;

            case HeaderType.Address:
                header = new AddressHeader(MimeData.headerNames[(int)MimeData.nameIndex[(int)headerId]].name, headerId);
                break;

            default:
                header = new TextHeader(MimeData.headerNames[(int)MimeData.nameIndex[(int)headerId]].name, headerId);
                break;
            }
            if (!string.IsNullOrEmpty(name) && !header.MatchName(name))
            {
                throw new ArgumentException("name");
            }
            return(header);
        }
示例#5
0
        // Token: 0x06000188 RID: 392 RVA: 0x00006FA0 File Offset: 0x000051A0
        public sealed override void CopyTo(object destination)
        {
            if (destination == null)
            {
                throw new ArgumentNullException("destination");
            }
            if (destination == this)
            {
                return;
            }
            AddressHeader addressHeader = destination as AddressHeader;

            if (addressHeader == null)
            {
                throw new ArgumentException(Strings.CantCopyToDifferentObjectType);
            }
            base.CopyTo(destination);
            addressHeader.parsed = this.parsed;
            addressHeader.parser = ((this.parser == null) ? null : new MimeAddressParser(addressHeader.Lines, this.parser));
        }