[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,返回当前系统时间 . ...
随机推荐
- -_-#Tiny Raytracer
http://www.gabrielgambetta.com/tiny_raytracer.htmlhttp://gabrielgambetta.com/tiny_raytracer_full.js
- ODAC with Oracle Developer Tools for Visual Studio
c#开发Oracle数据库的时候,需要本机没有安装过 Oracle 客户端,直接下载 ODAC with Oracle Developer Tools for Visual Studio工具安装即可 ...
- Unity给力插件之ShaderForge(一)
这是一个用来制作shader的插件,也是一个很好的学习shader的工具.这个插件上手很容易,但是要用它来制作理想的Shader,需要下点功夫. 这儿先列举出基础知识,以及我的一些实践.以后我还会继续 ...
- Java中Map遍历的四种方案
在Java中如何遍历Map对象 方式一 这是最常见的并且在大多数情况下也是最可取的遍历方式.在键值都需要时使用. Map<Integer, Integer> map = new HashM ...
- opencl-Shader
转载自:http://blog.csdn.net/leonwei/article/details/8956632 这里介绍关于OpenCL中program函数的写法,program函数通常是文本形式的 ...
- Python的基本语法,涵盖数据类型、循环判断、列表、map和set等
以#开头的语句是注释 当语句以冒号“:”结尾时,缩进的语句视为代码块.一般缩进4个空格 Python程序是大小写敏感的,如果写错了大小写,程序会报错. Python的数据类型 整型 浮点型 字符串 布 ...
- python爬虫学习(1)__抓取煎蛋图片
#coding=utf-8 #python_demo 爬取煎蛋妹子图在本地文件夹 import requests import threading import time import os from ...
- TabHost自定义外观
博客园:http://www.cnblogs.com 农民伯伯: http://www.cnblogs.com/over140 版本 新浪微博 weibo_10235010.apk 正文 一.效果图 ...
- Linux安装Team Service Agent
(1)下载linux agent文件(在windows中下载后,通过WinSCP复制至linux服务器中) 或者可以在linux直接下载文件(直接下载不会因为网络问题而导致传输中断) 首先使用命令建立 ...
- 利用setTimeOut 和clearTimeOut 方法控制写一个 滑动导航显示不同信息的效果
效果如图鼠标滑动导航 下边显示不同效果 html代码和css格式代码 <body><div id="tab" class="tab"> ...