bool GetContentDisposition(ref string sBodyStruct,
ref string sDisp)
{
sDisp = "";
// remove any spaces at the beginning and the end
sBodyStruct = sBodyStruct.Trim();
// check if this is NIL
if (IsNilString(ref sBodyStruct))
return true;
// find and remove opening paranthesis
if (!FindAndRemove( ref sBodyStruct, '(' ))
return false;
// get the content disposition type (inline/attachment)
if (!ParseQuotedString( ref sBodyStruct, ref sDisp))
{
Log (LogTypeEnum.ERROR, "Failed getting Content Disposition.");
return false;
}
// get the associated parameters if any
ArrayList asParam = new ArrayList();
if (!ParseParameters( ref sBodyStruct, asParam ))
{
Log(LogTypeEnum.ERROR, "Failed getting Content Disposition params.");
return false;
}
// prepare the content-disposition
string sTemp = "";
for (int i=0; i < asParam.Count; i+=2)
{
sTemp = "; " + asParam[i].ToString() + "=\"" + asParam[i+1].ToString() + "\"";
sDisp += sTemp;
}
// remove the closing paranthesis
return FindAndRemove( ref sBodyStruct, ')' );
}