Exemplo n.º 1
0
        private string ReadDiscreteEntity(ref Stream dataStream, ref IEntity entity)
        {
            string body;
            string delimiter;

            body      = string.Empty;
            delimiter = ReadDiscreteBody(ref dataStream, ref entity, ref body);

            string transferEncoding = string.Empty;

            foreach (RFC822.Field field in entity.Fields)
            {
                if (field is ContentTransferEncodingField)
                {
                    ContentTransferEncodingField transferField = field as ContentTransferEncodingField;
                    transferEncoding = transferField.Encoding;
                    break;
                }
            }

            foreach (RFC2045.IDecoder decoder in m_Decoders)
            {
                if (decoder.CanDecode(transferEncoding))
                {
                    entity.Body = decoder.Decode(ref body);
                    break;
                }
            }

            return(delimiter);
        }
 public override void Parse(ref IList<RFC822.Field> fields, ref string fieldString)
 {
     DecoratedFieldParser.Parse(ref fields, ref fieldString);
     MatchCollection matches = m_ContentTransferPattern.RegularExpression.Matches(fieldString);
     foreach (Match match in matches)
     {
         Match enc;
         ContentTransferEncodingField tmpTransfer = new ContentTransferEncodingField();
         enc = m_MechanismPattern.RegularExpression.Match(match.Value);
         tmpTransfer.Name = "Content-Transfer-Encoding";
         tmpTransfer.Encoding = enc.Value;
         fields.Add(tmpTransfer);
     }
 }
Exemplo n.º 3
0
        public override void Parse(ref IList <RFC822.Field> fields, ref string fieldString)
        {
            DecoratedFieldParser.Parse(ref fields, ref fieldString);
            MatchCollection matches = m_ContentTransferPattern.RegularExpression.Matches(fieldString);

            foreach (Match match in matches)
            {
                Match enc;
                ContentTransferEncodingField tmpTransfer = new ContentTransferEncodingField();
                enc = m_MechanismPattern.RegularExpression.Match(match.Value);
                tmpTransfer.Name     = "Content-Transfer-Encoding";
                tmpTransfer.Encoding = enc.Value;
                fields.Add(tmpTransfer);
            }
        }