当前位置: 首页>>代码示例>>C#>>正文


C# MIME_Entity.Parse方法代码示例

本文整理汇总了C#中LumiSoft.Net.MIME.MIME_Entity.Parse方法的典型用法代码示例。如果您正苦于以下问题:C# MIME_Entity.Parse方法的具体用法?C# MIME_Entity.Parse怎么用?C# MIME_Entity.Parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LumiSoft.Net.MIME.MIME_Entity的用法示例。


在下文中一共展示了MIME_Entity.Parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
        }
开发者ID:DJGosnell,项目名称:LumiSoft.Net,代码行数:40,代码来源:MIME_b_Multipart.cs

示例2: ParseFromReader

 /// <summary>
 /// Parses MIME entity body from the specified reader.
 /// </summary>
 /// <param name="reader">Body reader from where to parse body.</param>
 /// <param name="owner">Specifies if body will be stream owner.</param>
 /// <returns>Returns true if this is last boundary in the message or in multipart "body parts".</returns>
 internal override void ParseFromReader(LineReader reader,bool owner)
 {
     // For multipart we need todo new limiting(limits to specified boundary) reader.
     _MIME_MultipartReader r = new _MIME_MultipartReader(reader,m_Boundary);
     while(r.Next()){
         MIME_Entity bodyPart = new MIME_Entity();                
         bodyPart.Parse(r,owner);
         m_pParts.Add(bodyPart);                
     }
 }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:16,代码来源:MIME_MultipartBody.cs


注:本文中的LumiSoft.Net.MIME.MIME_Entity.Parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。