[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,返回当前系统时间 . ...
随机推荐
- java学习之多生产者和多消费者
在上一节当中我们说道了,java多线程当中单个消费者对应单个生产者的关系.这个时候有几个点需要注意一下,第一个就是把if判断flag的语句改成while这样能够避免,比如如果我们这个时候用if的话判断 ...
- 利用if else来运行咱们结婚吧
static void Main(string[] args) { while (true) { string ...
- 【转】Linux(ubuntu14.04)上编译Android4.4源码的环境搭建及编译全过程
原文网址:http://jileniao.net/linux-android-building.html sublime text让我伤心.本来很信任sublime text的自动保存功能,之前使用一 ...
- python 零散记录(七)(上) 面向对象 类 类的私有化
python面向对象的三大特性: 多态,封装,继承 多态: 在不知道对象到底是什么类型.又想对其做一些操作时,就会用到多态 如 'abc'.count('a') #对字符串使用count函数返回a的数 ...
- [MarsZ]Unity3d游戏开发之Unity3d全策划配置新手指引
Unity3d全策划配置新手指引 前言... 2 版本... 2 作者... 2 功能... 2 类型... 2 触发类型... 2 步骤类型... 3 实现... 4 简要... 4 策划方面... ...
- Performance Counter的使用
原文地址:http://blog.csdn.net/jiangxinyu/article/details/5480401 PerformanceCounter 基本介绍以及示例方法 一 Perform ...
- Bzoj 3236: [Ahoi2013]作业 莫队,分块
3236: [Ahoi2013]作业 Time Limit: 100 Sec Memory Limit: 512 MBSubmit: 1113 Solved: 428[Submit][Status ...
- 直接下载adobe的完整安装包
在线安装从来没有成功过的. https://get.adobe.com/cn/reader/direct/
- div border-radius
可以画个1/4之一的圆也可以画整个圆 <html> <style type="text/css"> div{ background-color: #000; ...
- noip 2015 提高组
算是填个坑吧 , QwQ Day 1 第一题很水,就是考代码能力 ,直接贴代码. #include <iostream> #include <cstdlib> #include ...