コード例 #1
0
        // Token: 0x06000540 RID: 1344 RVA: 0x0001CCE4 File Offset: 0x0001AEE4
        public sealed override MimeNode Clone()
        {
            MimeRecipient mimeRecipient = new MimeRecipient();

            this.CopyTo(mimeRecipient);
            return(mimeRecipient);
        }
コード例 #2
0
        private void WriteRecipient(MimeRecipient recipient)
        {
            if (this.lastHeader == null || !(this.lastHeader is AddressHeader))
            {
                throw new InvalidOperationException(Strings.CannotWriteRecipientsHere);
            }
            MimeNode lastChild;

            switch (this.state)
            {
            case MimeWriteState.Complete:
            case MimeWriteState.StartPart:
            case MimeWriteState.PartContent:
            case MimeWriteState.EndPart:
                throw new InvalidOperationException(Strings.CannotWriteRecipientsHere);

            case MimeWriteState.GroupRecipients:
                lastChild = this.lastHeader.LastChild;
                goto IL_78;
            }
            this.state = MimeWriteState.Recipients;
            lastChild  = this.lastHeader;
IL_78:
            lastChild.InternalAppendChild(recipient);
        }
コード例 #3
0
        internal void WriteMimeNode(MimeNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }
            Header header = node as Header;

            if (header != null)
            {
                this.WriteHeader(header);
                this.FlushHeader();
                return;
            }
            MimePart mimePart = node as MimePart;

            if (mimePart != null)
            {
                this.StartPart();
                mimePart.WriteTo(this.shimStream, this.encodingOptions);
                this.EndPart();
                return;
            }
            HeaderList headerList = node as HeaderList;

            if (headerList != null)
            {
                foreach (Header header2 in headerList)
                {
                    this.WriteHeader(header);
                }
                this.FlushHeader();
                return;
            }
            node = node.Clone();
            MimeRecipient mimeRecipient = node as MimeRecipient;

            if (mimeRecipient != null)
            {
                this.WriteRecipient(mimeRecipient);
                return;
            }
            MimeParameter mimeParameter = node as MimeParameter;

            if (mimeParameter != null)
            {
                this.WriteParameter(mimeParameter);
                return;
            }
            MimeGroup mimeGroup = node as MimeGroup;

            if (mimeGroup != null)
            {
                this.StartGroup(mimeGroup);
                this.EndGroup();
            }
        }
コード例 #4
0
        // Token: 0x0600053D RID: 1341 RVA: 0x0001CC64 File Offset: 0x0001AE64
        public static MimeRecipient Parse(string address, AddressParserFlags flags)
        {
            MimeRecipient mimeRecipient = new MimeRecipient();

            if (!string.IsNullOrEmpty(address))
            {
                byte[]            array             = ByteString.StringToBytes(address, true);
                MimeAddressParser mimeAddressParser = new MimeAddressParser();
                mimeAddressParser.Initialize(new MimeStringList(array, 0, array.Length), AddressParserFlags.None != (flags & AddressParserFlags.IgnoreComments), AddressParserFlags.None != (flags & AddressParserFlags.AllowSquareBrackets), true);
                MimeStringList displayNameFragments = default(MimeStringList);
                mimeAddressParser.ParseNextMailbox(ref displayNameFragments, ref mimeRecipient.emailAddressFragments);
                MimeRecipient.ConvertDisplayNameBack(mimeRecipient, displayNameFragments, true);
            }
            return(mimeRecipient);
        }
コード例 #5
0
        // Token: 0x06000541 RID: 1345 RVA: 0x0001CD00 File Offset: 0x0001AF00
        public sealed override void CopyTo(object destination)
        {
            if (destination == null)
            {
                throw new ArgumentNullException("destination");
            }
            if (destination == this)
            {
                return;
            }
            MimeRecipient mimeRecipient = destination as MimeRecipient;

            if (mimeRecipient == null)
            {
                throw new ArgumentException(Strings.CantCopyToDifferentObjectType);
            }
            base.CopyTo(destination);
            mimeRecipient.emailAddressFragments = this.emailAddressFragments.Clone();
        }
コード例 #6
0
 // Token: 0x0600053E RID: 1342 RVA: 0x0001CCD0 File Offset: 0x0001AED0
 public static bool IsEmailValid(string email)
 {
     return(MimeRecipient.IsEmailValid(email, false));
 }
コード例 #7
0
        // Token: 0x06000191 RID: 401 RVA: 0x000072A8 File Offset: 0x000054A8
        internal MimeNode ParseNextMailBox(bool fromGroup)
        {
            if (this.parsed)
            {
                return(null);
            }
            DecodingOptions headerDecodingOptions = base.GetHeaderDecodingOptions();

            if (this.parser == null)
            {
                this.parser = new MimeAddressParser();
            }
            if (!this.parser.Initialized)
            {
                this.parser.Initialize(base.Lines, false, false, headerDecodingOptions.AllowUTF8);
            }
            MimeStringList      displayNameFragments = default(MimeStringList);
            MimeStringList      mimeStringList       = default(MimeStringList);
            AddressParserResult addressParserResult  = this.parser.ParseNextMailbox(ref displayNameFragments, ref mimeStringList);

            switch (addressParserResult)
            {
            case AddressParserResult.Mailbox:
            case AddressParserResult.GroupInProgress:
            {
                MimeRecipient mimeRecipient = new MimeRecipient(ref mimeStringList, ref displayNameFragments);
                if (this.staticParsing)
                {
                    MimeRecipient.ConvertDisplayNameBack(mimeRecipient, displayNameFragments, headerDecodingOptions.AllowUTF8);
                }
                if (addressParserResult == AddressParserResult.GroupInProgress)
                {
                    MimeGroup mimeGroup = base.InternalLastChild as MimeGroup;
                    mimeGroup.InternalInsertAfter(mimeRecipient, mimeGroup.InternalLastChild);
                    return(mimeRecipient);
                }
                base.InternalInsertAfter(mimeRecipient, base.InternalLastChild);
                if (!fromGroup)
                {
                    return(mimeRecipient);
                }
                return(null);
            }

            case AddressParserResult.GroupStart:
            {
                MimeGroup mimeGroup = new MimeGroup(ref displayNameFragments);
                if (this.staticParsing)
                {
                    MimeRecipient.ConvertDisplayNameBack(mimeGroup, displayNameFragments, headerDecodingOptions.AllowUTF8);
                }
                base.InternalInsertAfter(mimeGroup, base.InternalLastChild);
                return(mimeGroup);
            }

            case AddressParserResult.End:
                return(null);

            default:
                return(null);
            }
        }