Step() public method

Sends the next part of the command to the server.
/// The operation was canceled via the cancellation token. /// /// An I/O error occurred. /// /// An IMAP protocol error occurred. ///
public Step ( ) : bool
return bool
コード例 #1
0
ファイル: ImapEngine.cs プロジェクト: ConceptFirst/MailKit
        /// <summary>
        /// Iterate the command pipeline.
        /// </summary>
        public int Iterate()
        {
            if (stream == null)
                throw new InvalidOperationException ();

            if (queue.Count == 0)
                return 0;

            current = queue[0];
            queue.RemoveAt (0);

            try {
                current.CancellationToken.ThrowIfCancellationRequested ();
            } catch (OperationCanceledException) {
                // FIXME: is this right??
                queue.RemoveAll (x => x.CancellationToken == current.CancellationToken);
                throw;
            }

            current.Status = ImapCommandStatus.Active;

            try {
                while (current.Step ()) {
                    // more literal data to send...
                }

                if (current.Bye)
                    Disconnect ();
            } catch {
                Disconnect ();
                throw;
            }

            return current.Id;
        }
コード例 #2
0
ファイル: ImapEngine.cs プロジェクト: rajeshwarn/MailKit
        /// <summary>
        /// Iterate the command pipeline.
        /// </summary>
        public int Iterate()
        {
            if (Stream == null)
                throw new InvalidOperationException ();

            if (queue.Count == 0)
                return 0;

            current = queue[0];
            queue.RemoveAt (0);

            try {
                current.CancellationToken.ThrowIfCancellationRequested ();
            } catch {
                queue.RemoveAll (x => x.CancellationToken.IsCancellationRequested);
                current = null;
                throw;
            }

            current.Status = ImapCommandStatus.Active;

            int id = current.Id;

            try {
                while (current.Step ()) {
                    // more literal data to send...
                }

                if (current.Bye)
                    Disconnect ();
            } catch {
                Disconnect ();
                throw;
            } finally {
                current = null;
            }

            return id;
        }