예제 #1
0
 public MessagePart VisitMessage(PopMessage message, string question)
 {
     if (message == null)
     {
         throw new ArgumentNullException("message");
     }
     return(this.VisitMessagePart(message.MessagePart, question));
 }
예제 #2
0
        public T VisitMessage(PopMessage message)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            return(VisitMessagePart(message.MessagePart));
        }
예제 #3
0
        /// <summary>
        /// 从stream
        /// </summary>
        /// <param name="messageStream"></param>
        /// <returns></returns>
        public static PopMessage Load(Stream messageStream)
        {
            if (messageStream == null)
            {
                throw new ArgumentNullException("messageStream");
            }
            PopMessage result;

            using (MemoryStream outStream = new MemoryStream())
            {
                byte[] buffer = new byte[4096];
                int    bytesRead;
                while ((bytesRead = messageStream.Read(buffer, 0, 4096)) > 0)
                {
                    outStream.Write(buffer, 0, bytesRead);
                }
                byte[] content = outStream.ToArray();
                result = new PopMessage(content, true);
            }
            return(result);
        }