Esempio n. 1
0
        public Pop3ResponseReader Receive()
        {
            var reader = new Pop3ResponseReader(this);

            reader.ReadNextLine();
            return(reader);
        }
        internal override void ReadResponse(Pop3ResponseReader reader)
        {
            TakeSnapshot(reader);
            if (_isSingle)
            {
                if (reader.IsNegative)
                {
                    return;
                }
                var values = reader.CurrentLine.Split(' ');
                MessageSizes.Add(int.Parse(values[1]), Size.FromBytes(int.Parse(values[2])));
                return;
            }

            while (true)
            {
                reader.ReadNextLine();
                if (reader.IsCompleted)
                {
                    break;
                }
                var values = reader.CurrentLine.Split(' ');
                MessageSizes.Add(int.Parse(values[0]), Size.FromBytes(int.Parse(values[1])));
            }
        }
        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();
            }
        }
Esempio n. 4
0
        internal override void ReadResponse(Pop3ResponseReader reader)
        {
            TakeSnapshot(reader);

            if (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 text = writer.ToString();
                var index = text.IndexOf(Strings.CrLf + Strings.CrLf);

                var entity = new Entity();
                entity.Deserialize(text.Substring(0, index));

                _headerFields.AddRange(entity.Headers);
                Lines = text.Substring(index).Trim();
            }
        }
Esempio n. 5
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();
            }
        }
Esempio n. 6
0
        internal override void ReadResponse(Pop3ResponseReader reader)
        {
            TakeSnapshot(reader);

            if (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 text  = writer.ToString();
                var index = text.IndexOf(Strings.CrLf + Strings.CrLf);

                var entity = new Entity();
                entity.Deserialize(text.Substring(0, index));

                _headerFields.AddRange(entity.Headers);
                Lines = text.Substring(index).Trim();
            }
        }
Esempio n. 7
0
 internal override void ReadResponse(Pop3ResponseReader reader)
 {
     TakeSnapshot(reader);
     if (_isSingle && reader.IsPositiveOrNegative) {
         var values = reader.CurrentLine.Split(' ');
         Uids.Add(int.Parse(values[1]), values[2]);
     } else {
         while (true) {
             reader.ReadNextLine();
             if (reader.IsCompleted) {
                 break;
             }
             var values = reader.CurrentLine.Split(' ');
             Uids.Add(int.Parse(values[0]), values[1]);
         }
     }
 }
Esempio n. 8
0
 internal override void ReadResponse(Pop3ResponseReader reader)
 {
     TakeSnapshot(reader);
     if (_isSingle && reader.IsPositiveOrNegative)
     {
         var values = reader.CurrentLine.Split(' ');
         Uids.Add(int.Parse(values[1]), values[2]);
     }
     else
     {
         while (true)
         {
             reader.ReadNextLine();
             if (reader.IsCompleted)
             {
                 break;
             }
             var values = reader.CurrentLine.Split(' ');
             Uids.Add(int.Parse(values[0]), values[1]);
         }
     }
 }
Esempio n. 9
0
        internal override void ReadResponse(Pop3ResponseReader reader)
        {
            TakeSnapshot(reader);
            if (_isSingle) {
                if (reader.IsNegative) {
                    return;
                }
                var values = reader.CurrentLine.Split(' ');
                MessageSizes.Add(int.Parse(values[1]), Size.FromBytes(int.Parse(values[2])));
                return;
            }

            while (true) {
                reader.ReadNextLine();
                if (reader.IsCompleted) {
                    break;
                }
                var values = reader.CurrentLine.Split(' ');
                MessageSizes.Add(int.Parse(values[0]), Size.FromBytes(int.Parse(values[1])));

            }
        }
Esempio n. 10
0
 public Pop3ResponseReader Receive()
 {
     var reader = new Pop3ResponseReader(this);
     reader.ReadNextLine();
     return reader;
 }