/// <summary>
        /// Parses the specified response.
        /// </summary>
        /// <param name="response">The response.</param>
        /// <returns></returns>
        public static ArticleResponseIds Parse(string response)
        {
            if (string.IsNullOrEmpty(response))
            {
                throw new ArgumentNullException("response");
            }
            ArticleResponseIds a = new ArticleResponseIds();

            string[] sa = response.Split(new char[] { ' ' });
            if (sa.Length == 2)
            {
                a.m_articleId = Rfc977NntpClient.ConvertToInt32(sa[0]);
                a.m_messageId = sa[1];
            }
            else if (sa.Length > 2)
            {
                a.m_articleId = Rfc977NntpClient.ConvertToInt32(sa[1]);
                a.m_messageId = sa[2];
            }
            else
            {
                throw new ArgumentException(NntpErrorMessages.ERROR_48, "response");
            }
            return(a);
        }
Пример #2
0
        /// <summary>
        /// Parses the specified response.
        /// </summary>
        /// <param name="response">The response.</param>
        /// <returns></returns>
        public static NewsgroupHeader Parse(string response)
        {
            if (response == null)
            {
                throw new ArgumentNullException("response");
            }

            string[] parts = response.Split(new char[] { ' ' });
            if (parts.Length < 3)
            {
                throw new ArgumentException(Resource.ErrorMessage13);
            }

            NewsgroupHeader h = new NewsgroupHeader();

            h.m_groupName      = parts[0];
            h.m_lastArticleId  = Rfc977NntpClient.ConvertToInt32(parts[1]);
            h.m_firstArticleId = Rfc977NntpClient.ConvertToInt32(parts[2]);
            h.m_statusCode     = ((parts.Length > 3 && parts[3].Length > 0) ? h.m_statusCode = parts[3][0] : 'y');
            return(h);
        }