Exemple #1
0
 /// <summary>
 /// Retrieves the article at the specified ordinal position.
 /// </summary>
 /// <param name="index">The ordinal position of the article to be retrieved.</param>
 /// <returns>A byte array containing the article data.</returns>
 /// <example>
 /// <code>
 /// C#
 ///
 /// NntpClient nntp = new NntpClient();
 ///
 /// nntp.Connect("news.myhost.com");
 ///
 /// NewsGroup group = nntp.SelectGroup("mygroup");
 /// //Retrieve article at position 29 in this group.
 /// byte[] article29 = group.RetrieveArticle(29);
 /// //Retrieve last article in this group.
 /// byte[] article = group.RetrieveArticle(group.LastArticle);
 ///
 /// nntp.Disconnect();
 ///
 /// VB.NET
 ///
 /// Dim nntp As New NntpClient
 ///
 /// nntp.Connect("news.myhost.com")
 ///
 /// Dim group As NewsGroup = nntp.SelectGroup("mygroup")
 /// 'Retrieve article at position 29 in this group.
 /// Dim article29() As Byte = group.RetrieveArticle(29)
 /// 'Retrieve last article in this group.
 /// Dim article() As Byte = group.RetrieveArticle(group.LastArticle)
 ///
 /// nntp.Disconnect()
 ///
 /// JScript.NET
 ///
 /// var nntp:NntpClient = new NntpClient();
 ///
 /// nntp.Connect("news.myhost.com");
 ///
 /// var group:NewsGroup = nntp.SelectGroup("mygroup");
 /// //Retrieve article at position 29 in this group.
 /// var article29:byte[] = group.RetrieveArticle(29);
 /// //Retrieve last article in this group.
 /// var article:byte[] = group.RetrieveArticle(group.LastArticle);
 ///
 /// nntp.Disconnect();
 /// </code>
 /// </example>
 public byte[] RetrieveArticle(int index)
 {
     _nntp.OnMessageRetrieving(new MessageRetrievingEventArgs(index));
     byte[] buffer = _nntp.CommandMultiline("article " + index.ToString());
     if (Encoding.ASCII.GetString(buffer, 0, buffer.Length).StartsWith("220"))
     {
         Pointer = index;
     }
     _nntp.OnMessageRetrieved(new MessageRetrievedEventArgs(buffer, index));
     return(buffer);
 }