public static ParseHeader ( Array data ) : ActiveUp.Net.Mail.Header | ||
data | Array | The byte array containing the Header data to be parsed. |
return | ActiveUp.Net.Mail.Header |
/// <summary> /// Parses a Header object from a byte array. /// </summary> /// <param name="data">The byte array containing the Header data to be parsed.</param> /// <returns>The parsed Header as a Header object.</returns> /// <example> /// <code> /// C# /// /// Header Header = Parser.ParseHeader(someBuffer); /// //Expose the subject /// string subject = header.Subject; /// /// VB.NET /// /// Dim Header As Header = Parser.ParseHeader(someBuffer) /// 'Expose the subject /// Dim subject As String = header.Subject /// /// JScript.NET /// /// var header:Header = Parser.ParseHeader(someBuffer); /// //Expose the subject /// var subject:string = header.Subject; /// </code> /// </example> public static Header ParseHeader(byte[] data) { Header hdr = new Header(); hdr.OriginalData = data; Parser.ParseHeader(ref hdr); return hdr; }
/// <summary> /// Parses a Header from a string formatted accordingly to the RFC822. /// </summary> /// <param name="data">The string containing the Header data to be parsed.</param> /// <returns>The parsed message as a Header object.</returns> /// <example> /// <code> /// C# /// /// Header Header = Parser.ParseHeaderString(rfc822string); /// //Expose the subject /// string subject = header.Subject; /// /// VB.NET /// /// Dim Header As Header = Parser.ParseHeaderString(rfc822string) /// 'Expose the subject /// Dim subject As String = header.Subject /// /// JScript.NET /// /// var header:Header = Parser.ParseHeaderString(rfc822string); /// //Expose the subject /// var subject:string = header.Subject; /// </code> /// </example> public static Header ParseHeaderString(string data) { #if !PocketPC return(ParseHeader(Encoding.GetEncoding("iso-8859-1").GetBytes(data))); #else return(Parser.ParseHeader(Pop3Client.PPCEncode.GetBytes(data))); #endif }
/// <summary> /// Parses a MemoryStream's content to a Header object. /// </summary> /// <param name="inputStream">The MemoryStream containing the Header data to be parsed.</param> /// <returns>The parsed Header as a Header object.</returns> /// <example> /// <code> /// C# /// /// Header Header = Parser.ParseHeader(someStream); /// //Expose the subject /// string subject = header.Subject; /// /// VB.NET /// /// Dim Header As Header = Parser.ParseHeader(someStream) /// 'Expose the subject /// Dim subject As String = header.Subject /// /// JScript.NET /// /// var header:Header = Parser.ParseHeader(someStream); /// //Expose the subject /// var subject:string = header.Subject; /// </code> /// </example> public static Header ParseHeader(System.IO.MemoryStream inputStream) { byte[] buf = new byte[inputStream.Length]; inputStream.Read(buf,0,buf.Length); Header hdr = new Header(); hdr.OriginalData = buf; Parser.ParseHeader(ref hdr); return hdr; }
/// <summary> /// Parses a Header from a file to a Header object. /// </summary> /// <param name="filePath">The path of the file to be parsed.</param> /// <returns>The parsed file as a Header object.</returns> /// <example> /// <code> /// C# /// /// Header Header = Parser.ParseHeader("C:\\My headers\\header.txt"); /// //Expose the subject /// string subject = header.Subject; /// /// VB.NET /// /// Dim Header As Header = Parser.ParseHeader("C:\My headers\header.txt") /// 'Expose the subject /// Dim subject As String = header.Subject /// /// JScript.NET /// /// var header:Header = Parser.ParseHeader("C:\\My headers\\header.txt"); /// //Expose the subject /// var subject:string = header.Subject; /// </code> /// </example> public static Header ParseHeader(string filePath) { System.IO.FileStream fs = System.IO.File.OpenRead(filePath); byte[] data = new byte[fs.Length]; fs.Read(data,0,System.Convert.ToInt32(fs.Length)); fs.Close(); Header hdr = new Header(); hdr.OriginalData = data; Parser.ParseHeader(ref hdr); return hdr; }
/// <summary> /// Parses a Header from a string formatted accordingly to the RFC822. /// </summary> /// <param name="data">The string containing the Header data to be parsed.</param> /// <returns>The parsed message as a Header object.</returns> /// <example> /// <code> /// C# /// /// Header Header = Parser.ParseHeaderString(rfc822string); /// //Expose the subject /// string subject = header.Subject; /// /// VB.NET /// /// Dim Header As Header = Parser.ParseHeaderString(rfc822string) /// 'Expose the subject /// Dim subject As String = header.Subject /// /// JScript.NET /// /// var header:Header = Parser.ParseHeaderString(rfc822string); /// //Expose the subject /// var subject:string = header.Subject; /// </code> /// </example> public static Header ParseHeaderString(string data) { return Parser.ParseHeader(System.Text.Encoding.ASCII.GetBytes(data)); }
/// <summary> /// Retrieves the article Header at the position specified by the current article pointer. /// </summary> /// <returns>A Header object representing the article header.</returns> /// <example> /// <code> /// C# /// /// NntpClient nntp = new NntpClient(); /// /// nntp.Connect("news.myhost.com"); /// /// NewsGroup group = nntp.SelectGroup("mygroup"); /// //Retrieve the first Header in this group. /// Header Header = group.RetrieveHeaderObject(); /// /// nntp.Disconnect(); /// /// VB.NET /// /// Dim nntp As New NntpClient /// /// nntp.Connect("news.myhost.com") /// /// Dim group As NewsGroup = nntp.SelectGroup("mygroup") /// 'Retrieve the first Header in this group. /// Dim Header As Header = group.RetrieveHeaderObject() /// /// nntp.Disconnect() /// /// JScript.NET /// /// var nntp:NntpClient = new NntpClient(); /// /// nntp.Connect("news.myhost.com"); /// /// var group:NewsGroup = nntp.SelectGroup("mygroup"); /// //Retrieve the first Header in this group. /// var header:Header = group.RetrieveHeaderObject(); /// nntp.Disconnect(); /// </code> /// </example> public Header RetrieveHeaderObject() { return(Parser.ParseHeader(RetrieveHeader())); }
/// <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 Header object representing 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. /// Header header29 = group.RetrieveHeaderObject(29); /// //Retrieve last Header in this group. /// Header Header = group.RetrieveHeaderObject(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 Header = group.RetrieveHeaderObject(29) /// 'Retrieve last Header in this group. /// Dim Header As Header = group.RetrieveHeaderObject(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:Header = group.RetrieveHeaderObject(29); /// //Retrieve last Header in this group. /// var header:Header = group.RetrieveHeaderObject(group.LastHeader); /// /// nntp.Disconnect(); /// </code> /// </example> public Header RetrieveHeaderObject(int index) { return(Parser.ParseHeader(RetrieveHeader(index))); }