本文整理汇总了C#中LumiSoft.Net.MIME.MIME_Entity.SetParent方法的典型用法代码示例。如果您正苦于以下问题:C# MIME_Entity.SetParent方法的具体用法?C# MIME_Entity.SetParent怎么用?C# MIME_Entity.SetParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LumiSoft.Net.MIME.MIME_Entity
的用法示例。
在下文中一共展示了MIME_Entity.SetParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseInternal
/// <summary>
/// Internal body parsing.
/// </summary>
/// <param name="owner">Owner MIME entity.</param>
/// <param name="mediaType">MIME media type. For example: text/plain.</param>
/// <param name="stream">Stream from where to read body.</param>
/// <param name="body">Multipart body instance.</param>
/// <exception cref="ArgumentNullException">Is raised when <b>stream</b>, <b>mediaType</b>, <b>stream</b> or <b>body</b> is null reference.</exception>
/// <exception cref="ParseException">Is raised when any parsing errors.</exception>
protected static void ParseInternal(MIME_Entity owner,string mediaType,SmartStream stream,MIME_b_Multipart body)
{
if(owner == null){
throw new ArgumentNullException("owner");
}
if(mediaType == null){
throw new ArgumentNullException("mediaType");
}
if(stream == null){
throw new ArgumentNullException("stream");
}
if(owner.ContentType == null || owner.ContentType.Param_Boundary == null){
throw new ParseException("Multipart entity has not required 'boundary' parameter.");
}
if(body == null){
throw new ArgumentNullException("body");
}
_MultipartReader multipartReader = new _MultipartReader(stream,owner.ContentType.Param_Boundary);
while(multipartReader.Next()){
MIME_Entity entity = new MIME_Entity();
entity.Parse(new SmartStream(multipartReader,false),Encoding.UTF8,body.DefaultBodyPartContentType);
body.m_pBodyParts.Add(entity);
entity.SetParent(owner);
}
body.m_TextPreamble = multipartReader.TextPreamble;
body.m_TextEpilogue = multipartReader.TextEpilogue;
body.BodyParts.SetModified(false);
}