public void FetchMessage(string sMessageUID, XmlTextWriter oXmlWriter, bool bFetchBody)
{
if (!m_bIsLoggedIn)
{
try
{
Restore(true);
}
catch (ImapException e)
{
if (e.Type != ImapException.ImapErrorEnum.IMAP_ERR_INSUFFICIENT_DATA)
throw e;
throw new ImapException(ImapException.ImapErrorEnum.IMAP_ERR_NOTCONNECTED);
}
}
if (!m_bIsFolderSelected && !m_bIsFolderExamined)
{
throw new ImapException(ImapException.ImapErrorEnum.IMAP_ERR_NOTSELECTED);
}
try
{
ArrayList asMessageHeader = new ArrayList();
GetHeader( sMessageUID, "0", asMessageHeader);
oXmlWriter.WriteStartElement("Part");
oXmlWriter.WriteAttributeString("ID", "0");
int nCount = asMessageHeader.Count;
for (int i = 0; i < nCount; i = i + 2)
{
oXmlWriter.WriteElementString(asMessageHeader[i].ToString(),asMessageHeader[i + 1].ToString());
}
if (!IsMultipart (asMessageHeader))
{
oXmlWriter.WriteStartElement("Part");
oXmlWriter.WriteAttributeString("ID", "1");
}
/*else
{
oXmlWriter.WriteStartElement("Part");
oXmlWriter.WriteAttributeString("ID", "0");
}*/
GetBodyStructure(sMessageUID, oXmlWriter, bFetchBody);
oXmlWriter.WriteEndElement();
}
catch (ImapException e)
{
throw e;
}
}