Beispiel #1
0
        public void TestEquatableLong()
        {
            var scan = new PopScanListing(1L, 120L);

              Assert.IsTrue (scan.Equals(1L));
              Assert.IsFalse(scan.Equals(0L));
        }
        /// <summary>sends LIST command</summary>
        /// <remarks>valid in transaction state</remarks>
        public PopCommandResult List(long messageNumber, out PopScanListing scanListing)
        {
            PopScanListing[] scanListings;

              var ret = ListCore(messageNumber, out scanListings);

              if (ret.Succeeded)
            scanListing = scanListings[0];
              else
            scanListing = PopScanListing.Invalid;

              return ret;
        }
        private PopMessageInfo ToMessage(PopScanListing scanList, PopUniqueIdListing? uniqueIdList)
        {
            lock (((System.Collections.ICollection)messages).SyncRoot) {
            PopMessageInfo message;

            if (messages.TryGetValue(scanList.MessageNumber, out message)) {
              // update values
              message.ScanList = scanList;
              message.UniqueIdList = uniqueIdList ?? message.UniqueIdList;
            }
            else {
              message = new PopMessageInfo(this, scanList, uniqueIdList);

              messages[message.MessageNumber] = message;
            }

            return message;
              }
        }
 /// <summary>sends LIST command</summary>
 /// <remarks>valid in transaction state</remarks>
 public PopCommandResult List(out PopScanListing[] scanListings)
 {
     return ListCore(null, out scanListings);
 }
        private PopCommandResult ListCore(long? messageNumber, out PopScanListing[] scanListings)
        {
            RejectNonTransactionState();

              if (messageNumber.HasValue && messageNumber.Value <= 0L)
            throw new ArgumentOutOfRangeException("messageNumber", messageNumber.Value, "must be non-zero positive number");

              scanListings = null;

              using (var t = new ListTransaction(connection)) {
            if (messageNumber.HasValue)
              t.RequestArguments["msg"] = messageNumber.Value.ToString();

            if (ProcessTransaction(t).Succeeded)
              scanListings = t.Result.Value;

            return t.Result;
              }
        }