Example #1
0
 public BinaryDecoder(Connection conn)
 {
     Connection = conn;
     // some messages have multiple blank lines between the header & message body
     while(conn.PeekLine() == string.Empty)
         conn.ReadLine();
 }
Example #2
0
 public BinaryDecoder(Connection conn)
 {
     Connection = conn;
     // some messages have multiple blank lines between the header & message body
     while (conn.PeekLine() == string.Empty)
     {
         conn.ReadLine();
     }
 }
Example #3
0
        /// <summary>
        /// Determine the binary encoding of a post
        /// </summary>
        /// <param name="connection">Active NNTP connection</param>
        /// <returns></returns>
        public static IBinaryDecoder DetermineDecoder(Connection connection)
        {
            string header = connection.PeekLine();

            if(header.StartsWith("=ybegin")) {
                return new YEncDecoder(connection);
            }

            if(header.StartsWith("begin")) {
                return new Uudecoder(connection);
            }

            return null;
        }
Example #4
0
        private void ReadHeader()
        {
            string ybegin = string.Empty, ypart = string.Empty;
            List <Dictionary <string, string> > dicts = new List <Dictionary <string, string> >();

            ybegin = Connection.ReadLine();
            dicts.Add(ParseYEncKeywordLine(ybegin));

            if (Connection.PeekLine().StartsWith("=ypart"))
            {
                ypart = Connection.ReadLine();
                dicts.Add(ParseYEncKeywordLine(ypart));
            }

            meta = dicts.SelectMany(d => d).ToDictionary(k => k.Key, v => v.Value);
        }
Example #5
0
        /// <summary>
        /// Determine the binary encoding of a post
        /// </summary>
        /// <param name="connection">Active NNTP connection</param>
        /// <returns></returns>
        public static IBinaryDecoder DetermineDecoder(Connection connection)
        {
            string header = connection.PeekLine();

            if (header.StartsWith("=ybegin"))
            {
                return(new YEncDecoder(connection));
            }

            if (header.StartsWith("begin"))
            {
                return(new Uudecoder(connection));
            }

            return(null);
        }