Beispiel #1
0
        private void StartGroup(MimeGroup group)
        {
            MimeWriteState mimeWriteState = this.state;

            switch (mimeWriteState)
            {
            case MimeWriteState.Complete:
            case MimeWriteState.StartPart:
                break;

            default:
                switch (mimeWriteState)
                {
                case MimeWriteState.PartContent:
                case MimeWriteState.EndPart:
                    break;

                default:
                    if (this.lastHeader == null || !(this.lastHeader is AddressHeader))
                    {
                        throw new InvalidOperationException(Strings.CannotWriteGroupStartHere);
                    }
                    this.state = MimeWriteState.GroupRecipients;
                    this.lastHeader.InternalAppendChild(group);
                    return;
                }
                break;
            }
            throw new InvalidOperationException(Strings.CannotWriteGroupStartHere);
        }
Beispiel #2
0
        public sealed override MimeNode Clone()
        {
            MimeGroup mimeGroup = new MimeGroup();

            this.CopyTo(mimeGroup);
            return(mimeGroup);
        }
Beispiel #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();
            }
        }
Beispiel #4
0
        public sealed override void CopyTo(object destination)
        {
            if (destination == null)
            {
                throw new ArgumentNullException("destination");
            }
            if (destination == this)
            {
                return;
            }
            MimeGroup mimeGroup = destination as MimeGroup;

            if (mimeGroup == null)
            {
                throw new ArgumentException(Strings.CantCopyToDifferentObjectType);
            }
            while (mimeGroup.ParseNextChild() != null)
            {
            }
            while (this.ParseNextChild() != null)
            {
            }
            base.CopyTo(destination);
        }
Beispiel #5
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);
            }
        }