Esempio n. 1
0
 /// <summary>
 /// Retrieves the article Header 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 header.</returns>
 /// <example>
 /// <code>
 /// C#
 ///
 /// NntpClient nntp = new NntpClient();
 ///
 /// nntp.Connect("news.myhost.com");
 ///
 /// NewsGroup group = nntp.SelectGroup("mygroup");
 /// //Retrieve the Header of the article at position 29 in this group.
 /// byte[] header29 = group.RetrieveHeader(29);
 /// //Retrieve last Header in this group.
 /// byte[] Header = group.RetrieveHeader(group.LastHeader);
 ///
 /// nntp.Disconnect();
 ///
 /// VB.NET
 ///
 /// Dim nntp As New NntpClient
 ///
 /// nntp.Connect("news.myhost.com")
 ///
 /// Dim group As NewsGroup = nntp.SelectGroup("mygroup")
 /// 'Retrieve the Header of the article at position 29 in this group.
 /// Dim header29() As Byte = group.RetrieveHeader(29)
 /// 'Retrieve last Header in this group.
 /// Dim header() As Byte = group.RetrieveHeader(group.LastHeader)
 ///
 /// nntp.Disconnect()
 ///
 /// JScript.NET
 ///
 /// var nntp:NntpClient = new NntpClient();
 ///
 /// nntp.Connect("news.myhost.com");
 ///
 /// var group:NewsGroup = nntp.SelectGroup("mygroup");
 /// //Retrieve the Header of the article at position 29 in this group.
 /// var header29:byte[] = group.RetrieveHeader(29);
 /// //Retrieve last Header in this group.
 /// var header:byte[] = group.RetrieveHeader(group.LastHeader);
 ///
 /// nntp.Disconnect();
 /// </code>
 /// </example>
 public byte[] RetrieveHeader(int index)
 {
     _nntp.OnHeaderRetrieving(new HeaderRetrievingEventArgs(index));
     byte[] buffer = _nntp.CommandMultiline("head " + index.ToString());
     if (Encoding.ASCII.GetString(buffer, 0, buffer.Length).StartsWith("221"))
     {
         Pointer = index;
     }
     _nntp.OnHeaderRetrieved(new HeaderRetrievedEventArgs(buffer, index));
     return(buffer);
 }