Example #1
0
        internal override void ReadResponse(Pop3ResponseReader reader)
        {
            TakeSnapshot(reader);

            if (reader.IsNegative) {
                return;
            }

            using (var writer = new StringWriter()) {

                while (true) {
                    reader.ReadNextLine();
                    if (reader.IsCompleted) {
                        break;
                    }
                    writer.WriteLine(reader.CurrentLine.StartsWith("..")
                        ? reader.CurrentLine.Substring(1)
                        : reader.CurrentLine);
                }

                var entity = new Entity();
                entity.Deserialize(writer.ToString());
                Message = entity.ToMessage();
            }
        }
Example #2
0
 public object Parse(string value, object argument)
 {
     // we need to cut the boundaries at the beginning and the end.
     value = Regex.Replace(value, RegexPatterns.BoundaryEnvelope, string.Empty);
     var entity = new Entity();
     entity.Deserialize(value);
     return entity;
 }