[Mime] QuotedPrintableEncoding帮助类 (转载)
点击下载 QuotedPrintableEncoding.rar
这个类是关于QuotedPrintableEncoding的帮助类
看下面代码吧
/// <summary>
/// 类说明:Assistant
/// 编 码 人:苏飞
/// 联系方式:361983679
/// 更新网站:[url=http://www.cckan.net/thread-655-1-1.html]http://www.cckan.net/thread-655-1-1.html[/url]
/// </summary>
using System;
using System.IO;
using System.Text.RegularExpressions; namespace DotNet.Utilities
{
/// <summary>
/// This class is based on the QuotedPrintable class written by Bill Gearhart
/// </summary>
public static class QuotedPrintableEncoding
{
private const string Equal = "="; private const string HexPattern = "(\\=([0-9A-F][0-9A-F]))"; public static string Decode(string contents)
{
if (contents == null)
{
throw new ArgumentNullException("contents");
} using (StringWriter writer = new StringWriter())
{
using (StringReader reader = new StringReader(contents))
{
string line;
while ((line = reader.ReadLine()) != null)
{
/*remove trailing line whitespace that may have
been added by a mail transfer agent per rule
#3 of the Quoted Printable section of RFC 1521.*/
line.TrimEnd(); if (line.EndsWith(Equal))
{
writer.Write(DecodeLine(line));
} //handle soft line breaks for lines that end with an "="
else
{
writer.WriteLine(DecodeLine(line));
}
}
}
writer.Flush(); return writer.ToString();
}
} private static string DecodeLine(string line)
{
if (line == null)
{
throw new ArgumentNullException("line");
} Regex hexRegex = new Regex(HexPattern, RegexOptions.IgnoreCase); return hexRegex.Replace(line, new MatchEvaluator(HexMatchEvaluator));
} private static string HexMatchEvaluator(Match m)
{
int dec = Convert.ToInt32(m.Groups[].Value, );
char character = Convert.ToChar(dec);
return character.ToString();
}
}
}
[Mime] QuotedPrintableEncoding帮助类 (转载)的更多相关文章
- [Mime] MimeHeaders--MimeHeader帮助类 (转载)
点击下载 MimeHeaders.rar 这个类是关于Mime的Headers类看下面代码吧 /// <summary> /// 类说明:Assistant /// 编 码 人:苏飞 // ...
- [Mime] MimeEntity--MimeEntity Mime实体帮助类 (转载)
点击下载 MimeEntity.rar 这个类是关于Mime实体的类看下面代码吧 /// <summary> /// 类说明:Assistant /// 编 码 人:苏飞 /// 联系方式 ...
- [Mime] MimeReader--读取Mime的帮助类 (转载)
点击下载 MimeReader.rar 这个类是关于MimeReader的帮助类看下面代码吧 /// <summary> /// 类说明:Assistant /// 编 码 人:苏飞 // ...
- 常用MIME类型(Flv,Mp4的mime类型设置)(转载)
转载地址:http://www.cuplayer.com/player/Help/2011/0625/83.html 也许你会在纳闷,为什么我上传了flv或MP4文件到服务器,可输入正确地址通过htt ...
- JAVA的StringBuffer类(转载整理)____非常重要的一个类,线程安全,不用每次创建一个对象,以及和String的区别
核心部分转载自:http://www.cnblogs.com/springcsc/archive/2009/12/03/1616330.html StringBuffer类和String一样,也用来代 ...
- GJM :FPSCalc-简单FPS观测类 [转载]
版权声明:本文原创发表于 [请点击连接前往] ,未经作者同意必须保留此段声明!如有侵权请联系我删帖处理! FPSCalc--简单FPS观测类 利用Unity做的手游项目很多时候要保证流畅度,流畅度最直 ...
- 探索Win32系统之窗口类(转载)
Window Classes in Win32 摘要 本文主要介绍win32系统里窗口类的运做和使用机制,探索一些细节问题,使win32窗口类的信息更加明朗化. 在本文中,"类", ...
- [序列化] Serialize--序列化帮助类 (转载)
点击下载 Serialize.zip 这个类是关于加密,解密的操作,文件的一些高级操作1.序列化2.要序列化的类3.序列化例子看下面代码吧 /// <summary> /// 类说明:As ...
- [时间操作] C#TimeHelper时间格式化帮助类 (转载)
点击下载 TimeHelper.rar 主要功能如下 .将时间格式化成 年月日 的形式,如果时间为null,返回当前系统时间 .将时间格式化成 时分秒 的形式,如果时间为null,返回当前系统时间 . ...
随机推荐
- XtraForm中更换皮肤
前提: 默认皮肤的显示http://www.cnblogs.com/chucklu/p/4785572.html 1.修改XtraForm的LookAndFeel的SkinName属性,设置为Cara ...
- BI名词解释
BI名词解释 浏览数Page Views: 网页(含文件及动态网页)被访客浏览的次数.Page View的计算范围包括了所有格式的网页,例如:.htm..html..asp..cfm. asa ...
- cssViewer牛逼的chrome插件
很牛逼,功能很强大.
- Chrome浏览器插件VisualEvent,可以方便的查看页面绑定的事件
http://files.cnblogs.com/files/jiqing9006/VisualEvent.zip
- android基本的数据库创建和使用
android的四大组件中就有Content Provider,对其他应用,提供自己的数据,所以,一般情况下,android应用不需要提供content provider. 1. 简单的数据库表单字 ...
- Centos6.4 设置开机自动以某个非root用户启动脚本
开机自动运行脚本,可以将脚本的执行命令放在 /etc/rc.d/rc.local 文件中,但是这样开机自动运行这个脚本的用户默认为root. 如果想以某个非root用户运行脚本,可以使用如下命令: s ...
- Linux 单网卡多 IP 的配置方法
Linux 单网卡多 IP 的配置方法 1 .永久配置的方法: 知道在 Linux 下网卡被称为 eth0,eth1,eth2..... ,所有网卡的配置文件都存储在 /etc/sysconfi ...
- html页面显示div源代码:用<xmp></xmp>标签
html页面显示div源代码:用<xmp></xmp>标签效果还可以.
- 进军es6(2)---解构赋值
本该两周之前就该总结的,但最近一直在忙校招实习的事,耽误了很久.目前依然在等待阿里HR面后的结果中...但愿好事多磨!在阿里的某轮面试中面试官问到了es6的掌握情况,说明es6真的是大势所趋,我们更需 ...
- How do I use a host name to look up an IP address?
The InetAddress class can be used to perform Domain Name Server (DNS) lookups. For example, you can ...