Exemplo n.º 1
0
        /// <summary>
        /// Returns parsed IMAP SEARCH <b>UID (sequence set)</b> key.
        /// </summary>
        /// <param name="r">String reader.</param>
        /// <returns>Returns parsed IMAP SEARCH <b>UID (sequence set)</b> key.</returns>
        /// <exception cref="ArgumentNullException">Is raised when <b>r</b> is null reference.</exception>
        /// <exception cref="ParseException">Is raised when parsing fails.</exception>
        internal static IMAP_Search_Key_Uid Parse(StringReader r)
        {
            if (r == null)
            {
                throw new ArgumentNullException("r");
            }

            string word = r.ReadWord();

            if (!string.Equals(word, "UID", StringComparison.InvariantCultureIgnoreCase))
            {
                throw new ParseException("Parse error: Not a SEARCH 'UID' key.");
            }
            r.ReadToFirstChar();
            string value = r.QuotedReadToDelimiter(' ');

            if (value == null)
            {
                throw new ParseException("Parse error: Invalid 'UID' value.");
            }

            try{
                return(new IMAP_Search_Key_Uid(IMAP_t_SeqSet.Parse(value)));
            }
            catch {
                throw new ParseException("Parse error: Invalid 'UID' value.");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Parses COPYUID optional response from string.
        /// </summary>
        /// <param name="value">COPYUID optional response string.</param>
        /// <returns>Returns COPYUID optional response.</returns>
        /// <exception cref="ArgumentNullException">Is raised when <b>value</b> is null reference.</exception>
        public new static IMAP_t_orc_CopyUid Parse(string value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            /* RFC 4315 3.
             *  COPYUID
             *      Followed by the UIDVALIDITY of the destination mailbox, a UID set
             *      containing the UIDs of the message(s) in the source mailbox that
             *      were copied to the destination mailbox and containing the UIDs
             *      assigned to the copied message(s) in the destination mailbox,
             *      indicates that the message(s) have been copied to the destination
             *      mailbox with the stated UID(s).
             */

            string[] code_mailboxUid_sourceSeqSet_targetSeqSet = value.Split(new char[] { ' ' }, 4);
            if (!string.Equals("COPYUID", code_mailboxUid_sourceSeqSet_targetSeqSet[0], StringComparison.InvariantCultureIgnoreCase))
            {
                throw new ArgumentException("Invalid COPYUID response value.", "value");
            }
            if (code_mailboxUid_sourceSeqSet_targetSeqSet.Length != 4)
            {
                throw new ArgumentException("Invalid COPYUID response value.", "value");
            }

            return(new IMAP_t_orc_CopyUid(
                       Convert.ToInt64(code_mailboxUid_sourceSeqSet_targetSeqSet[1]),
                       IMAP_t_SeqSet.Parse(code_mailboxUid_sourceSeqSet_targetSeqSet[2]),
                       IMAP_t_SeqSet.Parse(code_mailboxUid_sourceSeqSet_targetSeqSet[3])
                       ));
        }
Exemplo n.º 3
0
        public IMAP_Search_Key_Uid(IMAP_SequenceSet seqSet)
        {
            if (seqSet == null)
            {
                throw new ArgumentNullException("seqSet");
            }

            m_pSeqSet = IMAP_t_SeqSet.Parse(seqSet.ToSequenceSetString());
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns parsed IMAP SEARCH <b>sequence-set</b> key.
        /// </summary>
        /// <param name="r">String reader.</param>
        /// <returns>Returns parsed IMAP SEARCH <b>sequence-set</b> key.</returns>
        /// <exception cref="ArgumentNullException">Is raised when <b>r</b> is null reference.</exception>
        /// <exception cref="ParseException">Is raised when parsing fails.</exception>
        internal static IMAP_Search_Key_SeqSet Parse(StringReader r)
        {
            if (r == null)
            {
                throw new ArgumentNullException("r");
            }

            r.ReadToFirstChar();
            string value = r.QuotedReadToDelimiter(' ');

            if (value == null)
            {
                throw new ParseException("Parse error: Invalid 'sequence-set' value.");
            }

            try{
                return(new IMAP_Search_Key_SeqSet(IMAP_t_SeqSet.Parse(value)));
            }
            catch {
                throw new ParseException("Parse error: Invalid 'sequence-set' value.");
            }
        }