Header
namespace ReadyPOP3
{
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.Collections;
using System.Text.RegularExpressions;
public class Header
{
private Hashtable m_Attributes = new Hashtable();
private string m_Data;
private string m_Field;
public Header(string fld, string dat)
{
this.Field = fld;
this.Data = dat;
}
public void DecodeHeaderAttributes()
{
try
{
this.m_Attributes.Clear();
foreach (string str in this.Data.Split(new char[] { ';' }))
{
string[] strArray2 = str.Split(new char[] { '=' });
strArray2[0] = strArray2[0].TrimStart(new char[0]).TrimEnd(new char[0]);
if (strArray2.Length == 2)
{
strArray2[1] = strArray2[1].TrimStart(new char[0]).TrimStart(new char[] { '"' }).TrimEnd(new char[0]).TrimEnd(new char[] { '"' });
this.Attributes.Add(strArray2[0], strArray2[1]);
}
else
{
this.Attributes.Add(strArray2[0], null);
}
}
}
catch (Exception exception1)
{
ProjectData.SetProjectError(exception1);
ProjectData.ClearProjectError();
}
}
public string WithoutComment()
{
return Regex.Replace(this.Data, "\\([A-Za-z0-9\\!\\@\\#\\$\\%\\^\\&\\*\\-_\\=\\+\\[\\]\\{\\}\\|\\\\\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\`\\~\\/\\s]*\\)", "");
}
public Hashtable Attributes
{
get
{
return this.m_Attributes;
}
}
public string Data
{
get
{
return this.m_Data;
}
set
{
this.m_Data = value;
this.DecodeHeaderAttributes();
}
}
public string Field
{
get
{
return this.m_Field;
}
set
{
this.m_Field = value;
}
}
}
}