Example #1
0
        private bool _TryGetStatistic(out Pop3MessageStatistics statistic, out string errorMessage)
        {
            STAT         command  = new STAT();
            Pop3Response response = this.DoCommand(command);

            errorMessage = "";
            statistic    = command.Statistics;
            if (response.Type == EPop3ResponseType.ERR)
            {
                errorMessage = response.Message;
                return(false);
            }
            return(true);
        }
Example #2
0
        public virtual bool TryGetStatistic(out Pop3MessageStatistics statistic, out string errorMessage)
        {
            lock (this)
            {
                if (this.State != EPop3ClientState.Awaiting)
                {
                    errorMessage = "Pop3Client doesn't allow executing multiple operations simulteneously in a few threads using one object";
                    statistic    = new Pop3MessageStatistics();
                    return(false);
                }
                this.State = EPop3ClientState.Busy;
            }
            if (this.ConnectionState != EPop3ConnectionState.Authenticated)
            {
                errorMessage = "The command cannot be executed in this state";
                statistic    = new Pop3MessageStatistics();
                this.State   = EPop3ClientState.Awaiting;
                return(false);
            }
            bool flag = this._TryGetStatistic(out statistic, out errorMessage);

            this.State = EPop3ClientState.Awaiting;
            return(flag);
        }