本文整理汇总了C#中LumiSoft.Net.MIME.MIME_Entity类的典型用法代码示例。如果您正苦于以下问题:C# MIME_Entity类的具体用法?C# MIME_Entity怎么用?C# MIME_Entity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MIME_Entity类属于LumiSoft.Net.MIME命名空间,在下文中一共展示了MIME_Entity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Parse
/// <summary>
/// Parses body from the specified stream
/// </summary>
/// <param name="owner">Owner MIME entity.</param>
/// <param name="defaultContentType">Default content-type for this body.</param>
/// <param name="stream">Stream from where to read body.</param>
/// <returns>Returns parsed body.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>stream</b>, <b>defaultContentType</b> or <b>stream</b> is null reference.</exception>
/// <exception cref="ParseException">Is raised when any parsing errors.</exception>
protected static new MIME_b Parse(MIME_Entity owner,MIME_h_ContentType defaultContentType,SmartStream stream)
{
if(owner == null){
throw new ArgumentNullException("owner");
}
if(defaultContentType == null){
throw new ArgumentNullException("defaultContentType");
}
if(stream == null){
throw new ArgumentNullException("stream");
}
// We need to buffer all body data, otherwise we don't know if we have readed all data
// from stream.
MemoryStream msBuffer = new MemoryStream();
Net_Utils.StreamCopy(stream,msBuffer,32000);
msBuffer.Position = 0;
SmartStream parseStream = new SmartStream(msBuffer,true);
MIME_b_MessageDeliveryStatus retVal = new MIME_b_MessageDeliveryStatus();
//Pare per-message fields.
retVal.m_pMessageFields.Parse(parseStream);
// Parse per-recipient fields.
while(parseStream.Position - parseStream.BytesInReadBuffer < parseStream.Length){
MIME_h_Collection recipientFields = new MIME_h_Collection(new MIME_h_Provider());
recipientFields.Parse(parseStream);
retVal.m_pRecipientBlocks.Add(recipientFields);
}
return retVal;
}
开发者ID:iraychen,项目名称:LumiSoft.Net,代码行数:42,代码来源:MIME_b_MessageDeliveryStatus.cs
示例2: Parse
/// <summary>
/// Parses body from the specified stream
/// </summary>
/// <param name="owner">Owner MIME entity.</param>
/// <param name="defaultContentType">Default content-type for this body.</param>
/// <param name="stream">Stream from where to read body.</param>
/// <returns>Returns parsed body.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>stream</b>, <b>mediaType</b> or <b>stream</b> is null reference.</exception>
/// <exception cref="ParseException">Is raised when any parsing errors.</exception>
protected static new MIME_b Parse(MIME_Entity owner,MIME_h_ContentType defaultContentType,SmartStream stream)
{
if(owner == null){
throw new ArgumentNullException("owner");
}
if(defaultContentType == null){
throw new ArgumentNullException("defaultContentType");
}
if(stream == null){
throw new ArgumentNullException("stream");
}
MIME_b_Text retVal = null;
if(owner.ContentType != null){
retVal = new MIME_b_Text(owner.ContentType.TypeWithSubtype);
}
else{
retVal = new MIME_b_Text(defaultContentType.TypeWithSubtype);
}
Net_Utils.StreamCopy(stream,retVal.EncodedStream,32000);
retVal.SetModified(false);
return retVal;
}
开发者ID:ChuckLafferty,项目名称:bugnet,代码行数:34,代码来源:MIME_b_Text.cs
示例3: Parse
/// <summary>
/// Parses body from the specified stream
/// </summary>
/// <param name="owner">Owner MIME entity.</param>
/// <param name="defaultContentType">Default content-type for this body.</param>
/// <param name="stream">Stream from where to read body.</param>
/// <returns>Returns parsed body.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>stream</b>, <b>defaultContentType</b> or <b>strean</b> is null reference.</exception>
/// <exception cref="ParseException">Is raised when any parsing errors.</exception>
protected static new MIME_b Parse(MIME_Entity owner,MIME_h_ContentType defaultContentType,SmartStream stream)
{
if(owner == null){
throw new ArgumentNullException("owner");
}
if(defaultContentType == null){
throw new ArgumentNullException("defaultContentType");
}
if(stream == null){
throw new ArgumentNullException("stream");
}
string mediaType = null;
try{
mediaType = owner.ContentType.TypeWithSubtype;
}
catch{
mediaType = "unparsable/unparsable";
}
MIME_b_Unknown retVal = new MIME_b_Unknown(mediaType);
Net_Utils.StreamCopy(stream,retVal.EncodedStream,32000);
return retVal;
}
开发者ID:ChuckLafferty,项目名称:bugnet,代码行数:34,代码来源:MIME_b_Unknown.cs
示例4: SetParent
/// <summary>
/// Sets body parent.
/// </summary>
/// <param name="entity">Owner entity.</param>
/// <param name="setContentType">If true sets entity.ContentType header value.</param>
internal virtual void SetParent(MIME_Entity entity,bool setContentType)
{
m_pEntity = entity;
// Owner entity has no content-type or has different content-type, just add/overwrite it.
if(setContentType &&(entity.ContentType == null || !string.Equals(entity.ContentType.TypeWithSubtype,this.MediaType,StringComparison.InvariantCultureIgnoreCase))){
entity.ContentType = m_pContentType;
}
}
开发者ID:ChuckLafferty,项目名称:bugnet,代码行数:14,代码来源:MIME_b.cs
示例5: Remove
/// <summary>
/// Removes specified MIME entity from the collection.
/// </summary>
/// <param name="entity">MIME entity.</param>
/// <exception cref="ArgumentNullException">Is raised when <b>field</b> is null reference.</exception>
public void Remove(MIME_Entity entity)
{
if(entity == null){
throw new ArgumentNullException("field");
}
m_pCollection.Remove(entity);
m_IsModified = true;
}
开发者ID:iraychen,项目名称:LumiSoft.Net,代码行数:14,代码来源:MIME_EntityCollection.cs
示例6: Insert
/// <summary>
/// Inserts a new MIME entity into the collection at the specified location.
/// </summary>
/// <param name="index">The location in the collection where you want to add the MIME entity.</param>
/// <param name="entity">MIME entity.</param>
/// <exception cref="IndexOutOfRangeException">Is raised when <b>index</b> is out of range.</exception>
/// <exception cref="ArgumentNullException">Is raised when <b>entity</b> is null reference.</exception>
public void Insert(int index,MIME_Entity entity)
{
if(entity == null){
throw new ArgumentNullException("entity");
}
m_pCollection.Insert(index,entity);
m_IsModified = true;
}
开发者ID:iraychen,项目名称:LumiSoft.Net,代码行数:16,代码来源:MIME_EntityCollection.cs
示例7: SetParent
/// <summary>
/// Sets body parent.
/// </summary>
/// <param name="entity">Owner entity.</param>
/// <param name="setContentType">If true sets entity.ContentType header value.</param>
internal override void SetParent(MIME_Entity entity,bool setContentType)
{
base.SetParent(entity,setContentType);
// Owner entity has no content-type or has different content-type, just add/overwrite it.
if(setContentType && (this.Entity.ContentType == null || !string.Equals(this.Entity.ContentType.TypeWithSubtype,this.MediaType,StringComparison.InvariantCultureIgnoreCase))){
this.Entity.ContentType = new MIME_h_ContentType(MediaType);
}
}
开发者ID:CivilPol,项目名称:LumiSoft.Net,代码行数:14,代码来源:MIME_b_SinglepartBase.cs
示例8: Add
/// <summary>
/// Adds specified MIME enity to the collection.
/// </summary>
/// <param name="entity">MIME entity.</param>
/// <exception cref="ArgumentNullException">Is raised when <b>entity</b> is null reference.</exception>
public void Add(MIME_Entity entity)
{
if(entity == null){
throw new ArgumentNullException("entity");
}
m_pCollection.Add(entity);
m_IsModified = true;
}
开发者ID:ChuckLafferty,项目名称:bugnet,代码行数:14,代码来源:MIME_EntityCollection.cs
示例9: Parse
/// <summary>
/// Parses MIME entity body from specified stream.
/// </summary>
/// <param name="owner">Owner MIME entity.</param>
/// <param name="stream">Stream from where to parse entity body.</param>
/// <param name="defaultContentType">Default content type.</param>
/// <returns>Returns parsed body.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>owner</b>, <b>strean</b> or <b>defaultContentType</b> is null reference.</exception>
/// <exception cref="ParseException">Is raised when header field parsing errors.</exception>
public MIME_b Parse(MIME_Entity owner,SmartStream stream,MIME_h_ContentType defaultContentType)
{
if(owner == null){
throw new ArgumentNullException("owner");
}
if(stream == null){
throw new ArgumentNullException("stream");
}
if(defaultContentType == null){
throw new ArgumentNullException("defaultContentType");
}
string mediaType = defaultContentType.TypeWithSubype;
if(owner.ContentType != null){
mediaType = owner.ContentType.TypeWithSubype;
}
Type bodyType = null;
// We have exact body provider for specified mediaType.
if(m_pBodyTypes.ContainsKey(mediaType)){
bodyType = m_pBodyTypes[mediaType];
}
// Use default mediaType.
else{
// Registered list of mediaTypes are available: http://www.iana.org/assignments/media-types/.
string mediaRootType = mediaType.Split('/')[0].ToLowerInvariant();
if(mediaRootType == "application"){
bodyType = typeof(MIME_b_Application);
}
else if(mediaRootType == "audio"){
bodyType = typeof(MIME_b_Audio);
}
else if(mediaRootType == "image"){
bodyType = typeof(MIME_b_Image);
}
else if(mediaRootType == "message"){
bodyType = typeof(MIME_b_Message);
}
else if(mediaRootType == "multipart"){
bodyType = typeof(MIME_b_Multipart);
}
else if(mediaRootType == "text"){
bodyType = typeof(MIME_b_Text);
}
else if(mediaRootType == "video"){
bodyType = typeof(MIME_b_Video);
}
else{
throw new ParseException("Invalid media-type '" + mediaType + "'.");
}
}
return (MIME_b)bodyType.GetMethod("Parse",System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.FlattenHierarchy).Invoke(null,new object[]{owner,mediaType,stream});
}
开发者ID:Klaudit,项目名称:inbox2_desktop,代码行数:65,代码来源:MIME_b_Provider.cs
示例10: Parse
/// <summary>
/// Parses body from the specified stream
/// </summary>
/// <param name="owner">Owner MIME entity.</param>
/// <param name="defaultContentType">Default content-type for this body.</param>
/// <param name="stream">Stream from where to read body.</param>
/// <returns>Returns parsed body.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>stream</b>, <b>defaultContentType</b> or <b>stream</b> is null reference.</exception>
/// <exception cref="ParseException">Is raised when any parsing errors.</exception>
protected static MIME_b Parse(MIME_Entity owner,MIME_h_ContentType defaultContentType,SmartStream stream)
{
if(owner == null){
throw new ArgumentNullException("owner");
}
if(defaultContentType == null){
throw new ArgumentNullException("defaultContentType");
}
if(stream == null){
throw new ArgumentNullException("stream");
}
throw new NotImplementedException("Body provider class does not implement required Parse method.");
}
开发者ID:iraychen,项目名称:LumiSoft.Net,代码行数:23,代码来源:MIME_b.cs
示例11: Parse
/// <summary>
/// Parses body from the specified stream
/// </summary>
/// <param name="owner">Owner MIME entity.</param>
/// <param name="defaultContentType">Default content-type for this body.</param>
/// <param name="stream">Stream from where to read body.</param>
/// <returns>Returns parsed body.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>stream</b>, <b>defaultContentType</b> or <b>stream</b> is null reference.</exception>
/// <exception cref="ParseException">Is raised when any parsing errors.</exception>
protected static new MIME_b Parse(MIME_Entity owner,MIME_h_ContentType defaultContentType,SmartStream stream)
{
if(owner == null){
throw new ArgumentNullException("owner");
}
if(defaultContentType == null){
throw new ArgumentNullException("defaultContentType");
}
if(stream == null){
throw new ArgumentNullException("stream");
}
MIME_b_MessageRfc822 retVal = new MIME_b_MessageRfc822();
retVal.m_pMessage = Mail_Message.ParseFromStream(stream);
return retVal;
}
开发者ID:iraychen,项目名称:LumiSoft.Net,代码行数:26,代码来源:MIME_b_MessageRfc822.cs
示例12: Parse
/// <summary>
/// Parses body from the specified stream
/// </summary>
/// <param name="owner">Owner MIME entity.</param>
/// <param name="defaultContentType">Default content-type for this body.</param>
/// <param name="stream">Stream from where to read body.</param>
/// <returns>Returns parsed body.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>stream</b>, <b>defaultContentType</b> or <b>strean</b> is null reference.</exception>
/// <exception cref="ParseException">Is raised when any parsing errors.</exception>
protected static new MIME_b Parse(MIME_Entity owner,MIME_h_ContentType defaultContentType,SmartStream stream)
{
if(owner == null){
throw new ArgumentNullException("owner");
}
if(defaultContentType == null){
throw new ArgumentNullException("defaultContentType");
}
if(stream == null){
throw new ArgumentNullException("stream");
}
MIME_b_ApplicationPkcs7Mime retVal = new MIME_b_ApplicationPkcs7Mime();
Net_Utils.StreamCopy(stream,retVal.EncodedStream,32000);
return retVal;
}
开发者ID:CivilPol,项目名称:LumiSoft.Net,代码行数:26,代码来源:MIME_b_ApplicationPkcs7Mime.cs
示例13: Parse
/// <summary>
/// Parses body from the specified stream
/// </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>
/// <returns>Returns parsed body.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>stream</b>, <b>mediaType</b> or <b>strean</b> is null reference.</exception>
/// <exception cref="ParseException">Is raised when any parsing errors.</exception>
protected static new MIME_b Parse(MIME_Entity owner,string mediaType,SmartStream stream)
{
if(owner == null){
throw new ArgumentNullException("owner");
}
if(mediaType == null){
throw new ArgumentNullException("mediaType");
}
if(stream == null){
throw new ArgumentNullException("stream");
}
MIME_b_Audio retVal = new MIME_b_Audio(mediaType);
Net_Utils.StreamCopy(stream,retVal.EncodedStream,32000);
return retVal;
}
开发者ID:Klaudit,项目名称:inbox2_desktop,代码行数:27,代码来源:MIME_b_Audio.cs
示例14: CreateEntity_Text_Plain
/// <summary>
/// Creates text/plain MIME entity.
/// </summary>
/// <param name="transferEncoding">Content transfer encoding.</param>
/// <param name="charset">Charset to use to encode text. If not sure, utf-8 is recommended.</param>
/// <param name="text">Text.</param>
/// <returns>Returns created entity.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>transferEncoding</b>, <b>charset</b> or <b>text</b> is null reference.</exception>
/// <exception cref="NotSupportedException">Is raised when body contains not supported Content-Transfer-Encoding.</exception>
public static MIME_Entity CreateEntity_Text_Plain(string transferEncoding,Encoding charset,string text)
{
if(transferEncoding == null){
throw new ArgumentNullException("transferEncoding");
}
if(charset == null){
throw new ArgumentNullException("charset");
}
if(text == null){
throw new ArgumentNullException("text");
}
MIME_Entity retVal = new MIME_Entity();
MIME_b_Text body = new MIME_b_Text(MIME_MediaTypes.Text.plain);
retVal.Body = body;
body.SetText(transferEncoding,charset,text);
return retVal;
}
开发者ID:DJGosnell,项目名称:LumiSoft.Net,代码行数:28,代码来源:MIME_Entity.cs
示例15: Parse
/// <summary>
/// Parses body from the specified stream
/// </summary>
/// <param name="owner">Owner MIME entity.</param>
/// <param name="defaultContentType">Default content-type for this body.</param>
/// <param name="stream">Stream from where to read body.</param>
/// <returns>Returns parsed body.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>stream</b>, <b>defaultContentType</b> or <b>stream</b> is null reference.</exception>
/// <exception cref="ParseException">Is raised when any parsing errors.</exception>
protected static new MIME_b Parse(MIME_Entity owner,MIME_h_ContentType defaultContentType,SmartStream stream)
{
if(owner == null){
throw new ArgumentNullException("owner");
}
if(defaultContentType == null){
throw new ArgumentNullException("defaultContentType");
}
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' paramter.");
}
MIME_b_MultipartParallel retVal = new MIME_b_MultipartParallel(owner.ContentType);
ParseInternal(owner,owner.ContentType.TypeWithSubtype,stream,retVal);
return retVal;
}
开发者ID:iraychen,项目名称:LumiSoft.Net,代码行数:29,代码来源:MIME_b_MultipartParallel.cs
示例16: Parse
/// <summary>
/// Parses body from the specified stream
/// </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>
/// <returns>Returns parsed body.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>stream</b>, <b>mediaType</b> or <b>stream</b> is null reference.</exception>
/// <exception cref="ParseException">Is raised when any parsing errors.</exception>
protected static new MIME_b Parse(MIME_Entity owner,string mediaType,SmartStream stream)
{
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' paramter.");
}
MIME_b_MultipartRelated retVal = new MIME_b_MultipartRelated(owner.ContentType);
ParseInternal(owner,mediaType,stream,retVal);
return retVal;
}
开发者ID:Klaudit,项目名称:inbox2_desktop,代码行数:29,代码来源:MIME_b_MultipartRelated.cs
示例17: CreateAttachment
/// <summary>
/// Creates attachment entity.
/// </summary>
/// <param name="file">File name with optional path.</param>
/// <returns>Returns created attachment entity.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>file</b> is null reference.</exception>
public static MIME_Entity CreateAttachment(string file)
{
if(file == null){
throw new ArgumentNullException("file");
}
MIME_Entity retVal = new MIME_Entity();
MIME_b_Application body = new MIME_b_Application(MIME_MediaTypes.Application.octet_stream);
retVal.Body = body;
body.SetBodyDataFromFile(file,MIME_TransferEncodings.Base64);
retVal.ContentType.Param_Name = Path.GetFileName(file);
FileInfo fileInfo = new FileInfo(file);
MIME_h_ContentDisposition disposition = new MIME_h_ContentDisposition(MIME_DispositionTypes.Attachment);
disposition.Param_FileName = Path.GetFileName(file);
disposition.Param_Size = fileInfo.Length;
disposition.Param_CreationDate = fileInfo.CreationTime;
disposition.Param_ModificationDate = fileInfo.LastWriteTime;
disposition.Param_ReadDate = fileInfo.LastAccessTime;
retVal.ContentDisposition = disposition;
return retVal;
}
开发者ID:Klaudit,项目名称:inbox2_desktop,代码行数:29,代码来源:MIME_Message.cs
示例18: Parse
/// <summary>
/// Parses body from the specified stream
/// </summary>
/// <param name="owner">Owner MIME entity.</param>
/// <param name="defaultContentType">Default content-type for this body.</param>
/// <param name="stream">Stream from where to read body.</param>
/// <returns>Returns parsed body.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>stream</b>, <b>defaultContentType</b> or <b>strean</b> is null reference.</exception>
/// <exception cref="ParseException">Is raised when any parsing errors.</exception>
protected static new MIME_b Parse(MIME_Entity owner,MIME_h_ContentType defaultContentType,SmartStream stream)
{
if(owner == null){
throw new ArgumentNullException("owner");
}
if(defaultContentType == null){
throw new ArgumentNullException("defaultContentType");
}
if(stream == null){
throw new ArgumentNullException("stream");
}
MIME_b_Application retVal = null;
if(owner.ContentType != null){
retVal = new MIME_b_Application(owner.ContentType.TypeWithSubtype);
}
else{
retVal = new MIME_b_Application(defaultContentType.TypeWithSubtype);
}
Net_Utils.StreamCopy(stream,retVal.EncodedStream,stream.LineBufferSize);
return retVal;
}
开发者ID:DJGosnell,项目名称:LumiSoft.Net,代码行数:33,代码来源:MIME_b_Application.cs
示例19: MIME_MultipartBody
/// <summary>
/// Default constructor.
/// </summary>
/// <param name="owner">Owner MIME entity.</param>
/// <exception cref="ArgumentNullException">Is raised when <b>owner</b> is null.</exception>
internal MIME_MultipartBody(MIME_Entity owner) : base(owner)
{
m_Boundary = owner.ContentType.Param_Boundary;
m_pParts = new MIME_EntityCollection();
}
开发者ID:vipwan,项目名称:CommunityServer,代码行数:11,代码来源:MIME_MultipartBody.cs
示例20: 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
注:本文中的LumiSoft.Net.MIME.MIME_Entity类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论