<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Null&#039;s Notebook</title>
	<atom:link href="http://blog.hetaoos.com/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.hetaoos.com</link>
	<description>代码笔记</description>
	<lastBuildDate>Thu, 17 May 2012 15:01:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>C# / MVC 中使用 LDAP 验证</title>
		<link>http://blog.hetaoos.com/archives/95?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=c-mvc-%25e4%25b8%25ad%25e4%25bd%25bf%25e7%2594%25a8-ldap-%25e9%25aa%258c%25e8%25af%2581</link>
		<comments>http://blog.hetaoos.com/archives/95#comments</comments>
		<pubDate>Tue, 18 Oct 2011 13:27:03 +0000</pubDate>
		<dc:creator>Null</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[编程笔记]]></category>
		<category><![CDATA[DirectoryServices]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[编程]]></category>
		<category><![CDATA[验证]]></category>

		<guid isPermaLink="false">http://blog.hetaoos.com/?p=95</guid>
		<description><![CDATA[LDAP 全称是 Lightweight Directory Access Protocol,中文名称：轻型目录访问协议，广泛用于统一认证。 下面实现了简单的用户名、密码验证： using System; using System.Collections.Generic; using System.Text; using System.DirectoryServices.Protocols; using System.Net; namespace com.hetaoos.Authenticator { /// &#60;summary> /// Ldap 验证 /// http://blog.hetaoos.com /// &#60;/summary> public class LdapAuthenticator { /// &#60;summary> /// Ldap 验证 /// &#60;/summary> /// &#60;param name="domain">服务器&#60;/param> /// &#60;param name="username">帐号&#60;/param> /// &#60;param name="pwd">密码&#60;/param> /// &#60;returns>是否验证成功&#60;/returns> public static bool ValidateUser(string [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F95">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PAC Maker,代理自动配置文件生成器[C#,Open Source]</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F34&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F95">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 类 XML 序列化基类</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F37&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F95">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 通过文件头判断图像的类型</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F95">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中反射获取某类的子类和根据类型名动态创建对象</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/4' rel='bookmark' title='C# 中利用反射机制拷贝类的字段和属性'>C# 中利用反射机制拷贝类的字段和属性</a></li>
<li><a href='http://blog.hetaoos.com/archives/34' rel='bookmark' title='C# 类 XML 序列化基类'>C# 类 XML 序列化基类</a></li>
<li><a href='http://blog.hetaoos.com/archives/41' rel='bookmark' title='C# 获取枚举 Enum 变量值的 Description 属性'>C# 获取枚举 Enum 变量值的 Description 属性</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Ldap" target="_blank">LDAP</a> 全称是 Lightweight Directory Access Protocol,中文名称：<a href="http://zh.wikipedia.org/zh/%E8%BD%BB%E5%9E%8B%E7%9B%AE%E5%BD%95%E8%AE%BF%E9%97%AE%E5%8D%8F%E8%AE%AE" target="_blank">轻型目录访问协议</a>，广泛用于统一认证。</p>
<p>下面实现了简单的用户名、密码验证：</p>
<pre class="brush: csharp;">
using System;
using System.Collections.Generic;
using System.Text;
using System.DirectoryServices.Protocols;
using System.Net;

namespace com.hetaoos.Authenticator
{
    /// &lt;summary>
    /// Ldap 验证
    /// http://blog.hetaoos.com
    /// &lt;/summary>
    public class LdapAuthenticator
    {
        /// &lt;summary>
        /// Ldap 验证
        /// &lt;/summary>
        /// &lt;param name="domain">服务器&lt;/param>
        /// &lt;param name="username">帐号&lt;/param>
        /// &lt;param name="pwd">密码&lt;/param>
        /// &lt;returns>是否验证成功&lt;/returns>
        public static bool ValidateUser(string domain, string userName, string password)
        {
            bool validation = false;
            LdapConnection ldc = null;
            try
            {
                ldc = new LdapConnection(domain);
                //ou=Users,ou=tempusers,ou=staff,dc=guet,dc=org  这串玩意要改为自己的
                NetworkCredential nc = new NetworkCredential(string.Format("uid={0},ou=Users,ou=tempusers,ou=staff,dc=guet,dc=org", userName), password);
                ldc.AuthType = AuthType.Basic;
                ldc.SessionOptions.ProtocolVersion = 3;
                ldc.Bind(nc);
                validation = true;
            }
            catch { }
            finally
            {
                if (ldc != null)
                {
                    ldc.Dispose();
                }
            }
            return validation;
        }

    }
}
</pre>
<p>PS：<br />
需要添加以下引用：<br />
1,System.DirectoryServices<br />
2,System.DirectoryServices.Protocols</p>
<p>调用很简单：</p>
<pre class="brush: csharp;">
bool authenticated = LdapAuthenticator.ValidateUser("ldap.hetaoos.com", "null", "hetaoos.com");</pre>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F95">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PAC Maker,代理自动配置文件生成器[C#,Open Source]</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F34&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F95">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 类 XML 序列化基类</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F37&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F95">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 通过文件头判断图像的类型</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F95">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中反射获取某类的子类和根据类型名动态创建对象</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/4' rel='bookmark' title='C# 中利用反射机制拷贝类的字段和属性'>C# 中利用反射机制拷贝类的字段和属性</a></li>
<li><a href='http://blog.hetaoos.com/archives/34' rel='bookmark' title='C# 类 XML 序列化基类'>C# 类 XML 序列化基类</a></li>
<li><a href='http://blog.hetaoos.com/archives/41' rel='bookmark' title='C# 获取枚举 Enum 变量值的 Description 属性'>C# 获取枚举 Enum 变量值的 Description 属性</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hetaoos.com/archives/95/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# 泛型的一些特殊使用</title>
		<link>http://blog.hetaoos.com/archives/79?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=c-%25e6%25b3%259b%25e5%259e%258b%25e7%259a%2584%25e4%25b8%2580%25e4%25ba%259b%25e7%2589%25b9%25e6%25ae%258a%25e4%25bd%25bf%25e7%2594%25a8</link>
		<comments>http://blog.hetaoos.com/archives/79#comments</comments>
		<pubDate>Tue, 20 Sep 2011 04:28:44 +0000</pubDate>
		<dc:creator>Null</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[编程笔记]]></category>
		<category><![CDATA[Assembly]]></category>
		<category><![CDATA[Generic]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Type]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[动态]]></category>
		<category><![CDATA[反射]]></category>
		<category><![CDATA[应用程序]]></category>
		<category><![CDATA[开源]]></category>
		<category><![CDATA[泛型]]></category>
		<category><![CDATA[程序集]]></category>
		<category><![CDATA[类型]]></category>
		<category><![CDATA[继承]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://blog.hetaoos.com/?p=79</guid>
		<description><![CDATA[关于泛型的介绍和基本操作，可以参见 MSDN，以及各种博客文章：C# 泛型简介 、泛型介绍（C# 编程指南），这里就不再赘述。 下面是要用到的泛型： internal interface IStack { } public class Stack&#60;T&#62; : IStack where T : new() { public T Value { get; set; } } public class IntStack : Stack&#60;int&#62; { } public class DoubleStack : Stack&#60;double&#62; { } 1、取泛型的 Type 要取泛型的 Type，这个稍微有点特殊： //取泛型的 Type Type type = typeof(Stack&#60;&#62;); 比普通的类型多了对尖括号。 2、判断某类型是否是继承于某泛型 [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="3"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="WordPress 代码高亮" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F29&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F79">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30123030.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress 代码高亮</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IP Client for Android 2.2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F58&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F79">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/02/17/2776143.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IP Client for Android 2.2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="破解 Android Market 的区域限制-Market Faker v1.0.2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F66&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F79">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30122584.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">破解 Android Market 的区域限制-Market Faker v1.0.2</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="3" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/40' rel='bookmark' title='C# 中反射获取某类的子类和根据类型名动态创建对象'>C# 中反射获取某类的子类和根据类型名动态创建对象</a></li>
<li><a href='http://blog.hetaoos.com/archives/41' rel='bookmark' title='C# 获取枚举 Enum 变量值的 Description 属性'>C# 获取枚举 Enum 变量值的 Description 属性</a></li>
<li><a href='http://blog.hetaoos.com/archives/34' rel='bookmark' title='C# 类 XML 序列化基类'>C# 类 XML 序列化基类</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>关于泛型的介绍和基本操作，可以参见 MSDN，以及各种博客文章：<a href="http://msdn.microsoft.com/zh-cn/library/ms379564%28v=vs.80%29.aspx" target="_blank">C# 泛型简介</a> 、<a href="http://msdn.microsoft.com/zh-cn/library/0x6a29h6.aspx" target="_blank">泛型介绍（C# 编程指南）</a>，这里就不再赘述。</p>
<p>下面是要用到的泛型：</p>
<pre class="brush: csharp;">    internal interface IStack
    {
    }

    public class Stack&lt;T&gt; : IStack
        where T : new()
    {
        public T Value { get; set; }
    }

    public class IntStack : Stack&lt;int&gt; { }

    public class DoubleStack : Stack&lt;double&gt; { }</pre>
<p><span id="more-79"></span></p>
<ul>
<li>1、取泛型的 Type</li>
</ul>
<p>要取泛型的 Type，这个稍微有点特殊：</p>
<pre class="brush: csharp;">            //取泛型的 Type
            Type type = typeof(Stack&lt;&gt;);</pre>
<p>比普通的类型多了对尖括号。</p>
<ul>
<li>2、判断某类型是否是继承于某泛型</li>
</ul>
<p>如果是判断是否继承于普通类，或者接口，很简单：</p>
<pre class="brush: csharp;">    //接口
    public interface IClass { }
    //类
    public class Class : IClass { }
    //子类
    public class SubClass : Class { }

    class Program
    {
        static void Main(string[] args)
        {
            Type typeIClass = typeof(IClass);
            Type typeClass = typeof(Class);
            Type typeSubClass = typeof(SubClass);

            //判断类型的继承关系
            bool isSubclassOf = typeSubClass.IsSubclassOf(typeClass);//true
            bool isAssignableFrom = typeClass.IsAssignableFrom(typeSubClass);//true
            //判断类型是否拥有该接口
            bool isInterfaceOf = typeSubClass.GetInterfaces().Contains(typeIClass);//true
            bool isSubclassOf2 = typeSubClass.IsSubclassOf(typeIClass);//false,因为 IClass 是接口而不是类
            bool isAssignableFrom2 = typeIClass.IsAssignableFrom(typeSubClass);//true
        }
    }</pre>
<p>泛型的关系判断就有所不同了：</p>
<pre class="brush: csharp;">            Type typeIStack = typeof(IStack);
            Type typeStack = typeof(Stack&lt;&gt;);
            Type typeDoubleStack = typeof(DoubleStack);

            //判断类型的继承关系
            bool isSubclassOf = typeDoubleStack.IsSubclassOf(typeStack);//false,泛型类似于模板，如用模具生产产品，“模具”和“产品”属于不同的东西，他们不是父子关系
            bool isAssignableFrom = typeStack.IsAssignableFrom(typeDoubleStack);//false，同上
            //判断类型是否拥有该接口
            bool isInterfaceOf = typeDoubleStack.GetInterfaces().Contains(typeIStack);//true
            bool isSubclassOf2 = typeDoubleStack.IsSubclassOf(typeIStack);//false,因为 IStack 是接口而不是类
            bool isAssignableFrom2 = typeIStack.IsAssignableFrom(typeDoubleStack);//true</pre>
<p>可以看出，是不能用 Class 的方式判断继承关系的，因为泛型类似于模板，如用模具生产产品，“模具”和“产品”属于不同的东西，他们不是父子关系。</p>
<p>所以呢，要确定继承关系，最好写一个特殊的空接口只让该泛型类继承，然后根据这个接口来确定某个类是否是某个泛型派生的。</p>
<p>PS：<br />
如果在代码中直接使用泛型，如：</p>
<pre class="brush: csharp;">            Stack&lt;double&gt; DoubleStack = new Stack&lt;double&gt;();
            DoubleStack.Value = 0.5;
            Console.WriteLine("Double Value:{0}", DoubleStack.Value);</pre>
<p>那么，可以用以下方式来判断它的泛型类：</p>
<pre class="brush: csharp;">            Type typeStack = typeof(Stack&lt;&gt;);
            Type typeDoubleStack = typeof(Stack&lt;double&gt;);
            bool isGenericOf = typeDoubleStack.IsGenericType &amp;&amp; typeDoubleStack.GetGenericTypeDefinition() == typeStack;//true</pre>
<ul>
<li>3、运行时创建泛型对象</li>
</ul>
<p>主要是用 Type 的 MakeGenericType 方法，如：</p>
<pre class="brush: csharp;">            Type t = Type.GetType("System.Int32");
            Type typeStack = typeof(Stack&lt;&gt;);
            IStack stack = (IStack)Activator.CreateInstance(typeStack.MakeGenericType(t));</pre>
<p>详情，请参见：<a href="http://msdn.microsoft.com/zh-cn/library/system.type.makegenerictype.aspx" target="_blank">Type.MakeGenericType 方法</a><br />
至于动态创建泛型对象后的使用，如果是接口或者继承与某个类，那么可以强制转换过去，直接调用。其他的，只能用反射咯。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="3"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="VPN Client For M8 beta" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F44&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F79">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30122833.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">VPN Client For M8 beta</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PAC Maker,代理自动配置文件生成器[C#,Open Source]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F79">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30122680.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PAC Maker,代理自动配置文件生成器[C#,Open Source]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress 代码高亮" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F29&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F79">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30123030.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress 代码高亮</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="3" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/40' rel='bookmark' title='C# 中反射获取某类的子类和根据类型名动态创建对象'>C# 中反射获取某类的子类和根据类型名动态创建对象</a></li>
<li><a href='http://blog.hetaoos.com/archives/41' rel='bookmark' title='C# 获取枚举 Enum 变量值的 Description 属性'>C# 获取枚举 Enum 变量值的 Description 属性</a></li>
<li><a href='http://blog.hetaoos.com/archives/34' rel='bookmark' title='C# 类 XML 序列化基类'>C# 类 XML 序列化基类</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hetaoos.com/archives/79/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>路由规则生成器[C#,Open Source]</title>
		<link>http://blog.hetaoos.com/archives/75?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e5%25a4%25a9%25e6%259c%259d%25e8%25b7%25af%25e7%2594%25b1%25e8%25a7%2584%25e5%2588%2599%25e7%2594%259f%25e6%2588%2590%25e5%2599%25a8copen-source</link>
		<comments>http://blog.hetaoos.com/archives/75#comments</comments>
		<pubDate>Mon, 23 May 2011 13:12:36 +0000</pubDate>
		<dc:creator>Null</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[编程笔记]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[VPN]]></category>
		<category><![CDATA[外国]]></category>
		<category><![CDATA[开源]]></category>
		<category><![CDATA[海外]]></category>
		<category><![CDATA[生成]]></category>
		<category><![CDATA[编程]]></category>
		<category><![CDATA[规则]]></category>
		<category><![CDATA[路由]]></category>

		<guid isPermaLink="false">http://blog.hetaoos.com/?p=75</guid>
		<description><![CDATA[使用方式及原理：http://code.google.com/p/chnroutes/ 因为一些众所周知的原因, 来自中国大陆的网民想要访问非本国资源时总会那么的不方便, 这促使了海外vpn供应商在中国的繁荣. 使用海外vpn访问已经成为一些需要经常访问海外资源的中国网民的必要装备. 但通常这些vpn都是有流量限制的, 除此之外一些中国内部的资源也限制海外的ip访问. 本项目的就是提供一些启动脚本给vpn用户, 在vpn拨号之后修过路由表,让他们在使用vpn访问国外资源的同时, 能用非vpn线路高速访问本国资源. Due to well-known reasons, it's always inconvenient for Chinese netizens and foreigners who live in China to access information physically outside of China via internet. Timeouts and connection resets are the most common results you will get when you trying to visit websites that are [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F75">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PAC Maker,代理自动配置文件生成器[C#,Open Source]</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F4&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F75">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中利用反射机制拷贝类的字段和属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F37&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F75">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 通过文件头判断图像的类型</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F34&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F75">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 类 XML 序列化基类</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/55' rel='bookmark' title='PAC Maker,代理自动配置文件生成器[C#,Open Source]'>PAC Maker,代理自动配置文件生成器[C#,Open Source]</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>使用方式及原理：<a href="http://code.google.com/p/chnroutes/">http://code.google.com/p/chnroutes/</a></p>
<pre class="brush: csharp;">因为一些众所周知的原因, 来自中国大陆的网民想要访问非本国资源时总会那么的不方便, 这促使了海外vpn供应商在中国的繁荣. 使用海外vpn访问已经成为一些需要经常访问海外资源的中国网民的必要装备. 但通常这些vpn都是有流量限制的, 除此之外一些中国内部的资源也限制海外的ip访问. 本项目的就是提供一些启动脚本给vpn用户, 在vpn拨号之后修过路由表,让他们在使用vpn访问国外资源的同时, 能用非vpn线路高速访问本国资源.

Due to well-known reasons, it's always inconvenient for Chinese netizens and foreigners who live in China to access information physically outside of China via internet. Timeouts and connection resets are the most common results you will get when you trying to visit websites that are hosted in other countries. That leads to the growth of a new business which is called climb-the-wall or crack-the-wall. That is to use some kind of technologies such as encrypted proxy and VPN to bypass censorship. This project is created for those who uses VPN to combat censorship. It will generate some shell scripts to modify the routing table to split the chinese and non-chinese IPs. This gives VPN users the best experience by keeping domestic traffic efficient and only sending request through the VPN that need to.</pre>
<p>上面提到的网站提供了 python 的脚本，本人运行不成功，估计是 python 的版本问题。懒得折腾，就自己写了个生成器。</p>
<p>使用 VS2010 .NET Framework 4.0 编写</p>
<p><a class="downloadlink" href="http://blog.hetaoos.com/attachment/9" title=" 已下载 405 次" >RouteGenerator_Bin (405)</a><br />
<a class="downloadlink" href="http://blog.hetaoos.com/attachment/10" title=" 已下载 391 次" >RouteGenerator_src (391)</a></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F75">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PAC Maker,代理自动配置文件生成器[C#,Open Source]</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F4&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F75">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中利用反射机制拷贝类的字段和属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F37&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F75">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 通过文件头判断图像的类型</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F34&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F75">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 类 XML 序列化基类</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/55' rel='bookmark' title='PAC Maker,代理自动配置文件生成器[C#,Open Source]'>PAC Maker,代理自动配置文件生成器[C#,Open Source]</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hetaoos.com/archives/75/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>破解 Android Market 的区域限制-运营商伪装/Market Faker v1.1.2</title>
		<link>http://blog.hetaoos.com/archives/66?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e7%25a0%25b4%25e8%25a7%25a3-android-market-%25e7%259a%2584%25e5%258c%25ba%25e5%259f%259f%25e9%2599%2590%25e5%2588%25b6-market-faker</link>
		<comments>http://blog.hetaoos.com/archives/66#comments</comments>
		<pubDate>Thu, 07 Apr 2011 12:48:29 +0000</pubDate>
		<dc:creator>Null</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Faker]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Market]]></category>
		<category><![CDATA[伪装]]></category>
		<category><![CDATA[区域]]></category>
		<category><![CDATA[原理]]></category>
		<category><![CDATA[应用]]></category>
		<category><![CDATA[源码]]></category>
		<category><![CDATA[电子市场]]></category>
		<category><![CDATA[破解]]></category>
		<category><![CDATA[运营商]]></category>
		<category><![CDATA[运营商伪装]]></category>
		<category><![CDATA[限制]]></category>

		<guid isPermaLink="false">http://blog.hetaoos.com/?p=66</guid>
		<description><![CDATA[2011/11/02 V1.1.2 1，界面微调 2011/11/01 V1.1.0 1，增加自定义运营商选项 2，增加自动伪装功能，先设置一个预设运营商，然后点击菜单键选择“启用自动伪装”，即可启用。 3，增加英语 Android Market 电子市场 会根据运营商的不同，而呈现不同的应用列表，身在天朝，有着深刻的体会： 1，搜索”Google”,谷歌地图，Gmail 并未出现在搜索结果中。 2，查看不到没有任何手收费应用。 之前在网上找到个免费的 Market Enabler ，但这个东西有个问题： 1，系统启动后，必须要在电子市场运行之前操作，不能即时切换 2，有广告 后来更具他的源码及帮助，找到了相关的原理 Android market switch简单的说，原理如下： 注：以下操作都需要 root 权限，所以执行前要运行 su 1，设置系统环境变量 setprop gsm.sim.operator.numeric MCC_MNC #//setprop gsm.operator.numeric MCC_MNC 不需要设置这个值，看更新 这个 MCC_MNC 可以从这里查询：Mobile Network Code 直接把把两个值拼接起来就行了，不能省略 MNC 的0，比如天朝移不动的值是：46000，天朝连不通的是：46001,貌似电不信的有错误，这个有待求证，没用过。 其他还有比较多的相关环境变量，经过测试，其他的可以不设置，就设置这两个就可以了。 2，杀掉 Android Market 电子市场的进程 杀掉进程才能重新初始化 busybox killall com.android.vending 这里要说明下，必须要有 [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IP Client for Android 2.2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F58&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F66">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/02/17/2776143.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IP Client for Android 2.2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="VPN Client For M8 beta" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F44&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F66">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30122833.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">VPN Client For M8 beta</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress 代码高亮" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F29&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F66">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30123030.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress 代码高亮</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Hello world！" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F1&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F66">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Hello world！</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/58' rel='bookmark' title='IP Client for Android 2.2'>IP Client for Android 2.2</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>2011/11/02 V1.1.2<br />
1，界面微调</p>
<p>2011/11/01 V1.1.0<br />
1，增加自定义运营商选项<br />
2，增加自动伪装功能，先设置一个预设运营商，然后点击菜单键选择“启用自动伪装”，即可启用。<br />
3，增加英语</p>
<p>Android Market 电子市场 会根据运营商的不同，而呈现不同的应用列表，身在天朝，有着深刻的体会：<br />
1，搜索”Google”,谷歌地图，Gmail 并未出现在搜索结果中。<br />
2，查看不到没有任何手收费应用。</p>
<p>之前在网上找到个免费的 <a title="http://market-enabler.googlecode.com" href="http://www.2030.tk/links/goto/225/119/links_related" target="_blank">Market Enabler</a> ，但这个东西有个问题：<br />
1，系统启动后，必须要在电子市场运行之前操作，不能即时切换<br />
2，有广告</p>
<p>后来更具他的源码及帮助，找到了相关的原理 <a href="http://www.2030.tk/wiki/Android_market_switch">Android market switch<span id="more-66"></span></a>简单的说，原理如下：<br />
注：以下操作都需要 root 权限，所以执行前要运行 su<br />
1，设置系统环境变量</p>
<pre class="brush: shell;"> setprop gsm.sim.operator.numeric MCC_MNC
#//setprop gsm.operator.numeric MCC_MNC 不需要设置这个值，看更新</pre>
<p>这个 MCC_MNC 可以从这里查询：<a href="http://en.wikipedia.org/wiki/Mobile_Network_Code" target="_blank">Mobile Network Code</a><br />
直接把把两个值拼接起来就行了，不能省略 MNC 的0，比如天朝移不动的值是：46000，天朝连不通的是：46001,貌似电不信的有错误，这个有待求证，没用过。<br />
其他还有比较多的相关环境变量，经过测试，其他的可以不设置，就设置这两个就可以了。</p>
<p>2，杀掉 Android Market 电子市场的进程<br />
杀掉进程才能重新初始化</p>
<pre class="brush: shell;"> busybox killall com.android.vending</pre>
<p>这里要说明下，必须要有 busybox ,否则这个命令无法执行</p>
<p>3，清理掉缓存文件<br />
如果缓存没清理，会有些诡异的问题，比如推荐列表显示不出来。<br />
原来的代码是将 电子市场 的全部缓存一起清理，这个对于使用天朝运营商的GPRS用户非常不人道的，简直是把人往破产的边缘推。<br />
后来研究了下，只要删除其中几个文件就可以了</p>
<pre class="brush: shell;"> busybox rm -rf /data/data/com.android.vending/cache/AVMC_UGCR_P_
 busybox rm -rf /data/data/com.android.vending/cache/AVMC_UGCIR_
 busybox rm -rf /data/data/com.android.vending/cache/AVMC_UAR{*
 busybox rm -rf /data/data/com.android.vending/cache/AVMC_PUAR{*</pre>
<p>到这里，整个过程就结束了。</p>
<p>2011/04/30 更新<br />
1，取消掉设置 setprop gsm.operator.numeric MCC_MNC 的值，设置该值后会导致 Google Maps 停止纠编，而导致显示位置偏移巨大</p>
<p><a href="http://blog.hetaoos.com/wp-content/uploads/2011/04/20111102110627.png"><img class="alignnone size-full wp-image-102" title="20111102110627" src="http://blog.hetaoos.com/wp-content/uploads/2011/04/20111102110627.png" alt="" width="480" height="800" /></a><a href="http://blog.hetaoos.com/wp-content/uploads/2011/04/20111102110715.png"><img class="alignnone size-full wp-image-100" title="20111102110715" src="http://blog.hetaoos.com/wp-content/uploads/2011/04/20111102110715.png" alt="" width="480" height="800" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://blog.hetaoos.com/wp-content/uploads/2011/04/20111101202637.png"><img class="alignnone size-full wp-image-99" title="MarketFaker_ContextMenu" src="http://blog.hetaoos.com/wp-content/uploads/2011/04/20111101202637.png" alt="" width="480" height="800" /></a></p>
<p><a href="http://blog.hetaoos.com/wp-content/uploads/2011/04/MaketFaker_03_Android_Market_Main.png"><img class="alignnone size-full wp-image-69" title="MaketFaker_03_Android_Market_Main" src="http://blog.hetaoos.com/wp-content/uploads/2011/04/MaketFaker_03_Android_Market_Main.png" alt="" width="480" height="800" /></a></p>
<p><a href="http://blog.hetaoos.com/wp-content/uploads/2011/04/MaketFaker_04_Search_Google.png"><img class="alignnone size-full wp-image-70" title="MaketFaker_04_Search_Google" src="http://blog.hetaoos.com/wp-content/uploads/2011/04/MaketFaker_04_Search_Google.png" alt="" width="480" height="800" /></a></p>
<p>&nbsp;</p>
<p>下载：<br />
<a class="downloadlink" href="http://blog.hetaoos.com/attachment/6" title="版本1.1.2 已下载 1733 次" >MarketFaker_V1.1.2_Signed.apk (1733)</a></p>
<a class="downloadlink" href="http://blog.hetaoos.com/attachment/7" title="版本V1.0.2 已下载 440 次" >MarketFaker_V1.0.2_src (440)</a>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IP Client for Android 2.2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F58&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F66">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/02/17/2776143.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IP Client for Android 2.2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="VPN Client For M8 beta" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F44&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F66">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30122833.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">VPN Client For M8 beta</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress 代码高亮" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F29&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F66">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30123030.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress 代码高亮</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Hello world！" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F1&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F66">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Hello world！</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/58' rel='bookmark' title='IP Client for Android 2.2'>IP Client for Android 2.2</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hetaoos.com/archives/66/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>IP Client for Android 2.2</title>
		<link>http://blog.hetaoos.com/archives/58?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ip-client-for-android-2-2</link>
		<comments>http://blog.hetaoos.com/archives/58#comments</comments>
		<pubDate>Wed, 16 Feb 2011 16:16:28 +0000</pubDate>
		<dc:creator>Null</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[GUET]]></category>
		<category><![CDATA[IPClient]]></category>

		<guid isPermaLink="false">http://blog.hetaoos.com/?p=58</guid>
		<description><![CDATA[基于 Web IP Client 2012/05/17 V1.2.2 增加广西师范大学版本 2012/02/02 V1.2.2 1，支持 Android 4.0 2，增加待机后退出选项，并移除自动重连选项（内部开启） 3，优化验证码识别 4， 界面支持滚动 2011/10/25 V1.1.0 重写刷新方式，待机也不掉线。 2011/09/19 V1.0.3 与网站同步更新。 2011/03/01 V1.0.2 1，增加掉线重连设置，更稳定 2，后台运行时显示状态栏图标 3，修正几个小错误 4，增加签名 注：由于添加了签名，必须卸载掉老版本才能安装这个。（原来的是测试签名，和现在的个人签名不同，无法覆盖安装） 2010/02/17 V1.0.1 第一次写 Android 的应用，估计会有些问题。 注意：单击“返回”键，程序会在后台运行，如果要退出，需要点击“菜单”键，在弹出菜单中选择“退出”，方可完全退出。 更新内容： 1，完整的功能 2，支持 简体中文/英语 3，免输验证码 下载： 桂电： 师大： &#160; &#160; 没有关联文章.<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="破解 Android Market 的区域限制-Market Faker v1.0.2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F66&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F58">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30122584.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">破解 Android Market 的区域限制-Market Faker v1.0.2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress 代码高亮" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F29&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F58">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30123030.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress 代码高亮</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="VPN Client For M8 beta" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F44&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F58">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30122833.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">VPN Client For M8 beta</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PAC Maker,代理自动配置文件生成器[C#,Open Source]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F58">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30122680.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PAC Maker,代理自动配置文件生成器[C#,Open Source]</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<strong>没有关联文章.</strong>]]></description>
			<content:encoded><![CDATA[<p>基于<a href="http://172.16.12.11/ipmanager/index.jsp" target="_blank"> Web IP Client</a></p>
<p>2012/05/17 V1.2.2<br />
增加广西师范大学版本</p>
<p>2012/02/02 V1.2.2<br />
1，支持 Android 4.0<br />
2，增加待机后退出选项，并移除自动重连选项（内部开启）<br />
3，优化验证码识别<br />
4， 界面支持滚动</p>
<p>2011/10/25 V1.1.0<br />
重写刷新方式，待机也不掉线。</p>
<p>2011/09/19 V1.0.3</p>
<p>与网站同步更新。</p>
<p>2011/03/01 V1.0.2</p>
<p>1，增加掉线重连设置，更稳定<br />
2，后台运行时显示状态栏图标<br />
3，修正几个小错误<br />
4，增加签名</p>
<p><span style="color: #ff0000;">注：由于添加了签名，必须卸载掉老版本才能安装这个</span>。（原来的是测试签名，和现在的个人签名不同，无法覆盖安装）<br />
<span id="more-58"></span></p>
<p>2010/02/17 V1.0.1</p>
<p>第一次写 Android 的应用，估计会有些问题。</p>
<p>注意：单击“返回”键，程序会在后台运行，如果要退出，需要点击“菜单”键，在弹出菜单中选择“退出”，方可完全退出。</p>
<p>更新内容：<br />
1，完整的功能<br />
2，支持 简体中文/英语<br />
3，免输验证码<br />
下载：<br />
桂电：<a class="downloadlink" href="http://blog.hetaoos.com/attachment/5" title="版本1.2.2 已下载 618 次" >IP_Client_for_Android_V1.2.2_Signed.apk (618)</a><br />
师大：<a class="downloadlink" href="http://blog.hetaoos.com/attachment/12" title=" 已下载 6 次" >IP_Client_for_Android_V1.2.2_GXNU_Signed.apk (6)</a></p>
<p><a href="http://blog.hetaoos.com/wp-content/uploads/2011/02/IP_Client_for_Android_V1.0.2_Main.png"><img class="alignnone size-full wp-image-61" title="IP_Client_for_Android_V1.0.2_Main" src="http://blog.hetaoos.com/wp-content/uploads/2011/02/IP_Client_for_Android_V1.0.2_Main.png" alt="" width="480" height="800" /></a><a href="http://blog.hetaoos.com/wp-content/uploads/2011/02/IP_Client_for_Android_V1.0.2_About.png"><img class="alignnone size-full wp-image-62" title="IP_Client_for_Android_V1.0.2_About" src="http://blog.hetaoos.com/wp-content/uploads/2011/02/IP_Client_for_Android_V1.0.2_About.png" alt="" width="480" height="800" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="3"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="破解 Android Market 的区域限制-Market Faker v1.0.2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F66&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F58">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30122584.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">破解 Android Market 的区域限制-Market Faker v1.0.2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PAC Maker,代理自动配置文件生成器[C#,Open Source]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F58">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30122680.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PAC Maker,代理自动配置文件生成器[C#,Open Source]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="VPN Client For M8 beta" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F44&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F58">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30122833.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">VPN Client For M8 beta</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="3" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><strong>没有关联文章.</strong></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hetaoos.com/archives/58/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>PAC Maker,代理自动配置文件生成器[C#,Open Source]</title>
		<link>http://blog.hetaoos.com/archives/55?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=pac-maker%25e4%25bb%25a3%25e7%2590%2586%25e8%2587%25aa%25e5%258a%25a8%25e9%2585%258d%25e7%25bd%25ae%25e6%2596%2587%25e4%25bb%25b6%25e7%2594%259f%25e6%2588%2590%25e5%2599%25a8</link>
		<comments>http://blog.hetaoos.com/archives/55#comments</comments>
		<pubDate>Mon, 13 Dec 2010 06:18:23 +0000</pubDate>
		<dc:creator>Null</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[编程笔记]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PAC]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[开源]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://blog.hetaoos.com/?p=55</guid>
		<description><![CDATA[PacMaker &#8212; By Null PACMaker#hetaoos.com http://blog.hetaoos.com 由于 http://autoproxy2pac.appspot.com 经常超载，只好自己弄个生成器了。 本程序参考、使用以下内容： http://igfw.tk/archives/286 https://autoproxy.org/zh-CN/Rules https://github.com/iamamac/autoproxy2pac http://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt #region Copyright (C) 2010 Null Studio /* * Author:Null hetaoos#gmail.com * Blog: http://blog.hetaoos.com * Copyright (C) 2010 Null Studio * * * PACMaker is free software: you can redistribute it and/or modify * it under the terms of the GNU General [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F75&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">路由规则生成器[C#,Open Source]</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F37&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 通过文件头判断图像的类型</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F95&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# / MVC 中使用 LDAP 验证</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F4&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中利用反射机制拷贝类的字段和属性</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/44' rel='bookmark' title='VPN Client For M8 beta'>VPN Client For M8 beta</a></li>
<li><a href='http://blog.hetaoos.com/archives/40' rel='bookmark' title='C# 中反射获取某类的子类和根据类型名动态创建对象'>C# 中反射获取某类的子类和根据类型名动态创建对象</a></li>
<li><a href='http://blog.hetaoos.com/archives/4' rel='bookmark' title='C# 中利用反射机制拷贝类的字段和属性'>C# 中利用反射机制拷贝类的字段和属性</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>PacMaker &#8212; By Null<br />
PACMaker#hetaoos.com <a href="http://blog.hetaoos.com">http://blog.hetaoos.com</a><br />
由于 <a href="http://autoproxy2pac.appspot.com">http://autoproxy2pac.appspot.com</a> 经常超载，只好自己弄个生成器了。<br />
<span id="more-55"></span><br />
本程序参考、使用以下内容：<br />
<a href="http://igfw.tk/archives/286">http://igfw.tk/archives/286</a><br />
<a href="https://autoproxy.org/zh-CN/Rules">https://autoproxy.org/zh-CN/Rules</a><br />
<a href="https://github.com/iamamac/autoproxy2pac">https://github.com/iamamac/autoproxy2pac</a><br />
<a href="http://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt">http://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt</a></p>
<pre class="brush: csharp;">#region Copyright (C) 2010 Null Studio
/*
 * Author:Null hetaoos#gmail.com
 * Blog: http://blog.hetaoos.com
 * Copyright (C) 2010 Null Studio
 *
 *
 * PACMaker is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * PACMaker is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PACMaker. If not, see &lt;http://www.gnu.org/licenses/&gt;.
 */
#endregion</pre>
<p>使用 VS2010 .NET Framework 4.0 编写<br />
<a href="http://blog.hetaoos.com/wp-content/uploads/2010/12/PAC-Maker.jpg"><img class="alignnone size-full wp-image-56" title="PAC Maker" src="http://blog.hetaoos.com/wp-content/uploads/2010/12/PAC-Maker.jpg" alt="" width="437" height="427" /></a></p>
<p><a class="downloadlink" href="http://blog.hetaoos.com/attachment/3" title=" 已下载 319 次" >PacMaker_bin.zip (319)</a><br />
<a class="downloadlink" href="http://blog.hetaoos.com/attachment/4" title=" 已下载 289 次" >PacMaker_src.zip (289)</a></p>
<p>Google Code 托管地址 <a href="http://code.google.com/p/pacmaker/">http://code.google.com/p/pacmaker/</a>（包含最近的更新：自定义规则地址，使用系统代理）</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F75&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">路由规则生成器[C#,Open Source]</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F37&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 通过文件头判断图像的类型</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F95&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# / MVC 中使用 LDAP 验证</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F4&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中利用反射机制拷贝类的字段和属性</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/44' rel='bookmark' title='VPN Client For M8 beta'>VPN Client For M8 beta</a></li>
<li><a href='http://blog.hetaoos.com/archives/40' rel='bookmark' title='C# 中反射获取某类的子类和根据类型名动态创建对象'>C# 中反射获取某类的子类和根据类型名动态创建对象</a></li>
<li><a href='http://blog.hetaoos.com/archives/4' rel='bookmark' title='C# 中利用反射机制拷贝类的字段和属性'>C# 中利用反射机制拷贝类的字段和属性</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hetaoos.com/archives/55/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>返璞归真，直接用 TcpClient 请求 Web 网站资源</title>
		<link>http://blog.hetaoos.com/archives/48?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e8%25bf%2594%25e7%2592%259e%25e5%25bd%2592%25e7%259c%259f%25ef%25bc%258c%25e7%259b%25b4%25e6%258e%25a5%25e7%2594%25a8-tcpclient-%25e8%25af%25b7%25e6%25b1%2582-web-%25e7%25bd%2591%25e7%25ab%2599%25e8%25b5%2584%25e6%25ba%2590</link>
		<comments>http://blog.hetaoos.com/archives/48#comments</comments>
		<pubDate>Thu, 02 Dec 2010 03:48:02 +0000</pubDate>
		<dc:creator>Null</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[编程笔记]]></category>
		<category><![CDATA[Cookies]]></category>
		<category><![CDATA[Get]]></category>
		<category><![CDATA[Http]]></category>
		<category><![CDATA[Post]]></category>
		<category><![CDATA[TcpClient]]></category>
		<category><![CDATA[WebBrowser]]></category>
		<category><![CDATA[WebClient]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://blog.hetaoos.com/?p=48</guid>
		<description><![CDATA[在 C# 中，想获取Web网站上的网页或者下载其中的文件，非常方便。有三种常见方式可以使用：WebBrowser、WebClient、WebRequest，WebBrowser 不仅可以获取到网页的内容，还可以呈现出来，当然还支持 Cookies；WebClient 提供多种请求方式，满足大多数要求，但默认没有支持 Cookies，要继承修改下才得；WebRequest 几乎可以完全自定义，应用更灵活。 以上方法虽然方便，但也有些杯具的地方：请求速度慢、偶尔不能自动断开，并不是对所有网站都有很好的支持。所以，要自己弄个 Http 简单操作的类。 using System; using System.Collections.Generic; using System.Text; using System.Net.Sockets; using System.IO; using System.Drawing; using System.Diagnostics; using System.Net; using System.Threading; using System.Net.NetworkInformation; namespace GUET.OA.Client.ERPClient.Utils { /// &#60;summary> /// Http 请求 /// &#60;/summary> public class HttpHelper { /// &#60;summary> /// 下载一个页面 /// &#60;/summary> /// &#60;param name="uri">&#60;/param> /// [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F48">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中反射获取某类的子类和根据类型名动态创建对象</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F4&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F48">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中利用反射机制拷贝类的字段和属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F95&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F48">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# / MVC 中使用 LDAP 验证</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F37&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F48">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 通过文件头判断图像的类型</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/37' rel='bookmark' title='C# 通过文件头判断图像的类型'>C# 通过文件头判断图像的类型</a></li>
<li><a href='http://blog.hetaoos.com/archives/4' rel='bookmark' title='C# 中利用反射机制拷贝类的字段和属性'>C# 中利用反射机制拷贝类的字段和属性</a></li>
<li><a href='http://blog.hetaoos.com/archives/34' rel='bookmark' title='C# 类 XML 序列化基类'>C# 类 XML 序列化基类</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>在 C# 中，想获取Web网站上的网页或者下载其中的文件，非常方便。有三种常见方式可以使用：WebBrowser、WebClient、WebRequest，WebBrowser 不仅可以获取到网页的内容，还可以呈现出来，当然还支持 Cookies；WebClient 提供多种请求方式，满足大多数要求，但默认没有支持 Cookies，要继承修改下才得；WebRequest 几乎可以完全自定义，应用更灵活。<br />
<span id="more-48"></span><br />
以上方法虽然方便，但也有些杯具的地方：请求速度慢、偶尔不能自动断开，并不是对所有网站都有很好的支持。所以，要自己弄个 Http 简单操作的类。</p>
<pre class="brush: csharp;">
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
using System.IO;
using System.Drawing;
using System.Diagnostics;
using System.Net;
using System.Threading;
using System.Net.NetworkInformation;

namespace GUET.OA.Client.ERPClient.Utils
{
    /// &lt;summary>
    /// Http 请求
    /// &lt;/summary>
    public class HttpHelper
    {
        /// &lt;summary>
        /// 下载一个页面
        /// &lt;/summary>
        /// &lt;param name="uri">&lt;/param>
        /// &lt;returns>&lt;/returns>
        public static string Get(Uri uri)
        {
            return Request(uri, null, 2);
        }
        /// &lt;summary>
        /// 下载一个页面
        /// &lt;/summary>
        /// &lt;param name="url">&lt;/param>
        /// &lt;returns>&lt;/returns>
        public static string Get(string url)
        {
            return Request(url, null, 2);
        }
        /// &lt;summary>
        /// Post数据
        /// &lt;/summary>
        /// &lt;param name="uri">&lt;/param>
        /// &lt;param name="msg">&lt;/param>
        /// &lt;returns>&lt;/returns>
        public static string Post(Uri uri, string msg)
        {
            return Request(uri, msg, 2);
        }
        /// &lt;summary>
        /// Post数据
        /// &lt;/summary>
        /// &lt;param name="url">&lt;/param>
        /// &lt;param name="msg">&lt;/param>
        /// &lt;returns>&lt;/returns>
        public static string Post(string url, string msg)
        {
            return Request(url, msg, 2);
        }

        /// &lt;summary>
        /// 执行请求
        /// &lt;/summary>
        /// &lt;param name="url">&lt;/param>
        /// &lt;param name="msg">&lt;/param>
        /// &lt;param name="tryTimes">&lt;/param>
        /// &lt;returns>&lt;/returns>
        private static string Request(string url, string msg, int tryTimes)
        {
            Uri uri = new Uri(url);
            return Request(uri, msg, tryTimes);
        }
        /// &lt;summary>
        /// 执行请求
        /// &lt;/summary>
        /// &lt;param name="uri">&lt;/param>
        /// &lt;param name="msg">&lt;/param>
        /// &lt;param name="tryTimes">&lt;/param>
        /// &lt;returns>&lt;/returns>
        private static string Request(Uri uri, string msg, int tryTimes)
        {

            if (string.IsNullOrEmpty(msg))
            {
                msg = string.Format(getHeader, uri.PathAndQuery, uri.Host);
            }
            else
            {
                msg = string.Format(postHeader, uri.PathAndQuery, uri.Host, Encoding.UTF8.GetByteCount(msg), msg);
            }
            TcpClient tcp = new TcpClient();
            NetworkStream ns = null;
            MemoryStream ms = null;
            try
            {
                tcp.Connect(uri.Host, uri.Port);
                ns = tcp.GetStream();
                var s = Encoding.UTF8.GetBytes(msg);
                ns.Write(s, 0, s.Length);
                ns.Flush();
                if (GetStateCode(ns) != 200)
                {
                    return string.Empty;
                }
                var headers = ParseHttpHeader(ns);
                ms = new MemoryStream();
                byte[] buf = new byte[20 * 1024];
                int count = 0;
                while (ns.DataAvailable &#038;&#038; (count = ns.Read(buf, 0, buf.Length)) > 0)
                {
                    ms.Write(buf, 0, count);
                }
                ms.Position = 0;
                using (StreamReader de = new StreamReader(ms))
                {
                    return de.ReadToEnd();
                }
            }
            catch (Exception ex)
            {
                if (tryTimes &lt;= 0)
                {
                    throw ex;
                }
                else
                {
                    Thread.Sleep(2000);
                    return Request(uri, msg, --tryTimes);
                }
            }
            finally
            {
                if (ns != null)
                {
                    ns.Dispose();
                }
                if (tcp != null)
                {
                    tcp.Close();
                }
                if (ms != null)
                {
                    ms.Dispose();
                }
            }
        }
        /// &lt;summary>
        /// 下载图片
        /// &lt;/summary>
        /// &lt;param name="url">&lt;/param>
        /// &lt;returns>&lt;/returns>
        public static Image GetImage(string url)
        {
            Uri uri = new Uri(url);
            return GetImage(uri);
        }
        /// &lt;summary>
        /// 下载图片
        /// &lt;/summary>
        /// &lt;param name="uri">&lt;/param>
        /// &lt;returns>&lt;/returns>
        public static Image GetImage(Uri uri)
        {
            //WebClient client = new WebClient();
            //client.Proxy = null;

            //var d = client.DownloadData(url);
            //MemoryStream ms = new MemoryStream(d);
            //return Image.FromStream(ms);

            string msg = string.Format(getHeader, uri.AbsolutePath, uri.Host);

            TcpClient tcp = new TcpClient();
            NetworkStream ns = null;
            MemoryStream ms = null;
            try
            {
                tcp.Connect(uri.Host, uri.Port);
                ns = tcp.GetStream();
                var s = Encoding.UTF8.GetBytes(msg);
                ns.Write(s, 0, s.Length);
                ns.Flush();
                if (GetStateCode(ns) != 200)
                {
                    return null;
                }
                var headers = ParseHttpHeader(ns);

                ms = new MemoryStream();

                var buf = new byte[4096];
                int readCount;
                while ((readCount = ns.Read(buf, 0, buf.Length)) > 0)
                {
                    ms.Write(buf, 0, readCount);
                    if (readCount &lt; buf.Length || ns.DataAvailable == false)
                    {
                        break;
                    }
                }
                ms.Position = 0;
                return Image.FromStream(ms);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (ns != null)
                {
                    ns.Dispose();
                }
                if (tcp != null)
                {
                    tcp.Close();
                }
                if (ms != null)
                {
                    ms.Dispose();
                }
            }
        }
        /// &lt;summary>
        /// 获取状态码
        /// &lt;/summary>
        /// &lt;param name="stream">&lt;/param>
        /// &lt;returns>&lt;/returns>
        public static int GetStateCode(NetworkStream stream)
        {
            string headerLine = GetNextHeaderLine(stream);
            if (string.IsNullOrEmpty(headerLine))
            {
                return 0;
            }
            var i = headerLine.Split(' ');
            if (i.Length != 3)
            {
                return 0;
            }

            int code = 0;
            if (int.TryParse(i[1], out code))
            {
                return code;
            }
            return 0;
            //HTTP/1.1 302 Found
            //return 1;
        }
        /// &lt;summary>
        /// 获取回应头
        /// &lt;/summary>
        /// &lt;param name="stream">&lt;/param>
        /// &lt;returns>&lt;/returns>
        public static WebHeaderCollection ParseHttpHeader(NetworkStream stream)
        {
            //string firstLine = GetNextHeaderLine(stream);
            WebHeaderCollection headers = new WebHeaderCollection();
            string headerLine;
            while ((headerLine = GetNextHeaderLine(stream)).Length != 0)
            {
                try
                {
                    headers.Add(headerLine);
                }
                catch { }
            }
            return headers;
        }

        private static byte[] pingData = Encoding.ASCII.GetBytes("012345678901234567890123456789");
        public static bool CanPing(string host)
        {
            try
            {
                using (Ping ping = new Ping())
                {
                    PingReply reply = ping.Send(host, 120, pingData);
                    return reply.Status == IPStatus.Success;
                }
            }
            catch
            {
                return false;
            }
        }

        public static bool CanConnect(string host)
        {
            return CanConnect(host, 80);
        }
        public static bool CanConnect(string host, int port)
        {
            bool connected = false;
            try
            {
                using (TcpClient tc = new TcpClient())
                {
                    tc.SendTimeout = tc.ReceiveTimeout = 2000;
                    tc.Connect(host, port);
                    connected = tc.Connected;
                    tc.Close();
                }
            }
            catch
            {
            }

            return connected;
        }

        /// &lt;summary>
        /// 获取头的下一行
        /// &lt;/summary>
        /// &lt;param name="stream">&lt;/param>
        /// &lt;returns>&lt;/returns>
        private static string GetNextHeaderLine(NetworkStream stream)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                int readByte;
                while ((readByte = stream.ReadByte()) != '\n' &#038;&#038; readByte != -1)
                {
                    if (readByte != '\r')
                        ms.WriteByte((byte)readByte);
                }
                if (ms.Length == 0)
                {
                    return string.Empty;
                }
                return Encoding.UTF8.GetString(ms.ToArray());
            }
        }
        //Nokia5700AP23.01/SymbianOS/9.1 Series60/3.0
        private const string postHeader = @"POST {0} HTTP/1.1
Host: {1}
User-Agent: Nokia5700AP23.01/SymbianOS/9.1 Series60/3.0
Accept: */*
Cache-Control: no-cache
Content-Length: {2}
Content-Type: application/x-www-form-urlencoded

{3}";

        private const string getHeader = @"GET {0} HTTP/1.1
Host: {1}
User-Agent: NNokia5700AP23.01/SymbianOS/9.1 Series60/3.0
Accept: */*
Accept-Encoding: gzip,deflate
Cache-Control: no-cache

";
    }
}
</pre>
<p>1，以上代码的请求头我已经写死了，可以用 WebHeaderCollection 搞成自定义的，或者根据实际情况修改<br />
2，下载文件，就是把其中的 MemoryStream 换成文件流即可<br />
3，Http 请求时，服务器传输数据完毕，并不一定会断开连接，所以获取网页内容时，将 NetworkStream 转换为 StreamReader 再   ReadToEnd  并不保险，正确的做法是，先读到内存流中，读的过程中要判断 NetworkStream.DataAvailable 是否有数据，当为 false 是，就表示读完了。当然，可以考虑用 Content-Length 来判断。<br />
4，Content-Type 头比较麻烦，一般的网页提交，其值为 application/x-www-form-urlencoded，如果与WebService 交互，值要改为 application/soap+xml; charset=utf-8<br />
5，初次请求或者长时间未请求，可以使用 CanConnect 来测试网站是否可用，以减少正式请求过程中长时间的阻塞。<br />
6，至于 Cookies，可以自己解析 Set-Cookies 回复头的解析和发送时添加 Cookies<br />
7，某些 WAP 的数据输出，NetworkStream.DataAvailable 为 False 时也还能读数据。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F48">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中反射获取某类的子类和根据类型名动态创建对象</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F4&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F48">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中利用反射机制拷贝类的字段和属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F95&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F48">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# / MVC 中使用 LDAP 验证</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F37&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F48">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 通过文件头判断图像的类型</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/37' rel='bookmark' title='C# 通过文件头判断图像的类型'>C# 通过文件头判断图像的类型</a></li>
<li><a href='http://blog.hetaoos.com/archives/4' rel='bookmark' title='C# 中利用反射机制拷贝类的字段和属性'>C# 中利用反射机制拷贝类的字段和属性</a></li>
<li><a href='http://blog.hetaoos.com/archives/34' rel='bookmark' title='C# 类 XML 序列化基类'>C# 类 XML 序列化基类</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hetaoos.com/archives/48/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VPN Client For M8 beta</title>
		<link>http://blog.hetaoos.com/archives/44?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=vpn-client-for-m8-beta</link>
		<comments>http://blog.hetaoos.com/archives/44#comments</comments>
		<pubDate>Sat, 20 Nov 2010 14:53:34 +0000</pubDate>
		<dc:creator>Null</dc:creator>
				<category><![CDATA[Meizu M8]]></category>
		<category><![CDATA[手机]]></category>
		<category><![CDATA[软件发布]]></category>
		<category><![CDATA[Client]]></category>
		<category><![CDATA[M8]]></category>
		<category><![CDATA[Meizu]]></category>
		<category><![CDATA[VPN]]></category>
		<category><![CDATA[WinCE]]></category>
		<category><![CDATA[下载]]></category>
		<category><![CDATA[安装包]]></category>
		<category><![CDATA[应用程序]]></category>
		<category><![CDATA[绿色版]]></category>
		<category><![CDATA[软件]]></category>
		<category><![CDATA[魅族]]></category>

		<guid isPermaLink="false">http://blog.hetaoos.com/?p=44</guid>
		<description><![CDATA[有时候需要使用 VPN 上网，在M8中设置VPN非常杯具，所以写了个简单的 VPN 客户端。 拨号前 拨号后 使用说明： 直接填写 服务器地址、用户名、密码，再点“拨号”按钮即可。 拨号后就可以关闭本程序了，需要断开是，再运行本程序，点“断开”按钮即可。 注： 1，创建拨号连接时，内置了大部分选项。可能这些选项并不适合你的网络环境。 2，拨号连接后将影响待机，不用时请断开连接。（系统问题，不关我事） 3，本程序创建的拨号连接名称为“VPN_C2AC6A3C”，可在控制面板中删除。 4，这是个测试版本，如有疑问、问题，请给我发邮件。 附件 没有关联文章.<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IP Client for Android 2.2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F58&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F44">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/02/17/2776143.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IP Client for Android 2.2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="破解 Android Market 的区域限制-Market Faker v1.0.2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F66&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F44">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30122584.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">破解 Android Market 的区域限制-Market Faker v1.0.2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="C# 中反射获取某类的子类和根据类型名动态创建对象" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F44">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">C# 中反射获取某类的子类和根据类型名动态创建对象</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="路由规则生成器[C#,Open Source]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F75&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F44">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">路由规则生成器[C#,Open Source]</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<strong>没有关联文章.</strong>]]></description>
			<content:encoded><![CDATA[<p>有时候需要使用 VPN 上网，在M8中设置VPN非常杯具，所以写了个简单的 VPN 客户端。<br />
<span id="more-44"></span><br />
拨号前<br />
  <a href="http://blog.hetaoos.com/wp-content/uploads/2010/11/PrtScn20101120212727.png"><img src="http://blog.hetaoos.com/wp-content/uploads/2010/11/PrtScn20101120212727.png" alt="VPN Client 拨号前" title="PrtScn20101120212727" width="480" height="720" class="alignnone size-full wp-image-45" /></a><br />
拨号后<br />
 <a href="http://blog.hetaoos.com/wp-content/uploads/2010/11/PrtScn20101120212721.png"><img src="http://blog.hetaoos.com/wp-content/uploads/2010/11/PrtScn20101120212721.png" alt="VPN Client 拨号后" title="PrtScn20101120212721" width="480" height="720" class="alignnone size-full wp-image-46" /></a></p>
<p>使用说明：<br />
直接填写 服务器地址、用户名、密码，再点“拨号”按钮即可。<br />
拨号后就可以关闭本程序了，需要断开是，再运行本程序，点“断开”按钮即可。</p>
<p>注：<br />
1，创建拨号连接时，内置了大部分选项。可能这些选项并不适合你的网络环境。<br />
2，拨号连接后将影响待机，不用时请断开连接。（系统问题，不关我事）<br />
3，本程序创建的拨号连接名称为“VPN_C2AC6A3C”，可在控制面板中删除。<br />
4，这是个测试版本，如有疑问、问题，请给我发邮件。</p>
<p>附件<br />
<a class="downloadlink" href="http://blog.hetaoos.com/attachment/2" title=" 已下载 315 次" >VPN Client.zip (315)</a><br />
<a class="downloadlink" href="http://blog.hetaoos.com/attachment/1" title=" 已下载 352 次" >VPN Client_0.9.0_20101120.cab (352)</a></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="IP Client for Android 2.2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F58&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F44">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/02/17/2776143.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IP Client for Android 2.2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="破解 Android Market 的区域限制-Market Faker v1.0.2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F66&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F44">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/11/30122584.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">破解 Android Market 的区域限制-Market Faker v1.0.2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="C# 中反射获取某类的子类和根据类型名动态创建对象" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F44">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">C# 中反射获取某类的子类和根据类型名动态创建对象</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="路由规则生成器[C#,Open Source]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F75&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F44">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">路由规则生成器[C#,Open Source]</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><strong>没有关联文章.</strong></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hetaoos.com/archives/44/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>C# 获取枚举 Enum 变量值的 Description 属性</title>
		<link>http://blog.hetaoos.com/archives/41?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=c-%25e8%258e%25b7%25e5%258f%2596%25e6%259e%259a%25e4%25b8%25be-enum-%25e5%258f%2598%25e9%2587%258f%25e5%2580%25bc%25e7%259a%2584-description-%25e5%25b1%259e%25e6%2580%25a7</link>
		<comments>http://blog.hetaoos.com/archives/41#comments</comments>
		<pubDate>Tue, 26 Oct 2010 02:26:54 +0000</pubDate>
		<dc:creator>Null</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[编程笔记]]></category>
		<category><![CDATA[Description]]></category>
		<category><![CDATA[DescriptionAttribute]]></category>
		<category><![CDATA[Enum]]></category>
		<category><![CDATA[Type]]></category>
		<category><![CDATA[反射]]></category>
		<category><![CDATA[属性]]></category>
		<category><![CDATA[枚举]]></category>
		<category><![CDATA[类型]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://blog.hetaoos.com/?p=41</guid>
		<description><![CDATA[有些时候，某个方法的返回值是个枚举类型，比如描述登录结果： public enum LoginResult { Success, WrongPassword, UserNotExist, Forbidden, Unknown } 当前段UI获取到登陆方法的返回结果时，就需要告诉用户登录是否成功、什么原因失败的。如果直接使用 ToString() 方式直接返回枚举变量的名称，显然不合适。通常的做法是使用各 switch 来转换，弊端是要写过多的代码；或者构造一个 string[] msg ，再根据 LoginResult 的 int 值来相应的取，弊端是类型的int值必须是连续的或者 string[] msg 的个数大于或等于 枚举类型的最大 int 值 ，一一对应起来也比较麻烦 。 在 枚举类型 Enum 中，不支持 DisplayNameAttribute，但支持 DescriptionAttribute ，所以要从 DescriptionAttribute 入手。写一个通用方法，取出 DescriptionAttribute 即可。当然，为了使用方便，我们使用 .NET 3.5+ 支持的 扩展方法来实现： using System; using System.Collections.Generic; using System.Linq; using System.Text; using [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F41">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中反射获取某类的子类和根据类型名动态创建对象</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F4&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F41">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中利用反射机制拷贝类的字段和属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F37&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F41">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 通过文件头判断图像的类型</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F5&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F41">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">动态填充/修改类属性的 DisplayNameAttribute 属性</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/37' rel='bookmark' title='C# 通过文件头判断图像的类型'>C# 通过文件头判断图像的类型</a></li>
<li><a href='http://blog.hetaoos.com/archives/4' rel='bookmark' title='C# 中利用反射机制拷贝类的字段和属性'>C# 中利用反射机制拷贝类的字段和属性</a></li>
<li><a href='http://blog.hetaoos.com/archives/40' rel='bookmark' title='C# 中反射获取某类的子类和根据类型名动态创建对象'>C# 中反射获取某类的子类和根据类型名动态创建对象</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>有些时候，某个方法的返回值是个枚举类型，比如描述登录结果：</p>
<pre class="brush: csharp;">    public enum LoginResult
    {
        Success,
        WrongPassword,
        UserNotExist,
        Forbidden,
        Unknown
    }</pre>
<p>当前段UI获取到登陆方法的返回结果时，就需要告诉用户登录是否成功、什么原因失败的。如果直接使用 ToString() 方式直接返回枚举变量的名称，显然不合适。通常的做法是使用各 switch 来转换，弊端是要写过多的代码；或者构造一个 string[] msg ，再根据 LoginResult 的 int 值来相应的取，弊端是类型的int值必须是连续的或者 string[] msg 的个数大于或等于 枚举类型的最大 int 值 ，一一对应起来也比较麻烦 。<br />
<span id="more-41"></span><br />
在 枚举类型 Enum 中，不支持 DisplayNameAttribute，但支持 DescriptionAttribute ，所以要从 DescriptionAttribute 入手。写一个通用方法，取出 DescriptionAttribute 即可。当然，为了使用方便，我们使用 .NET 3.5+ 支持的 扩展方法来实现：</p>
<pre class="brush: csharp;">using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Reflection;

namespace com.hetaoos.Utils.Extensions
{
    public static class Extensions
    {
        /// &lt;summary>
        /// 获取枚举变量值的 Description 属性
        /// &lt;/summary>
        /// &lt;param name="obj">枚举变量&lt;/param>
        /// &lt;returns>如果包含 Description 属性，则返回 Description 属性的值，否则返回枚举变量值的名称&lt;/returns>
        public static string GetDescription(this object obj)
        {
            return GetDescription(obj, false);
        }

        /// &lt;summary>
        /// 获取枚举变量值的 Description 属性
        /// &lt;/summary>
        /// &lt;param name="obj">枚举变量&lt;/param>
        /// &lt;param name="isTop">是否改变为返回该类、枚举类型的头 Description 属性，而不是当前的属性或枚举变量值的 Description 属性&lt;/param>
        /// &lt;returns>如果包含 Description 属性，则返回 Description 属性的值，否则返回枚举变量值的名称&lt;/returns>
        public static string GetDescription(this object obj, bool isTop)
        {
            if (obj == null)
            {
                return string.Empty;
            }
            try
            {
                Type _enumType = obj.GetType();
                DescriptionAttribute dna = null;
                if (isTop)
                {
                    dna = (DescriptionAttribute)Attribute.GetCustomAttribute(_enumType, typeof(DescriptionAttribute));
                }
                else
                {
                    FieldInfo fi = _enumType.GetField(Enum.GetName(_enumType, obj));
                    dna = (DescriptionAttribute)Attribute.GetCustomAttribute(
                       fi, typeof(DescriptionAttribute));
                }
                if (dna != null &#038;&#038; string.IsNullOrEmpty(dna.Description) == false)
                    return dna.Description;
            }
            catch
            {
            }
            return obj.ToString();
        }
    }
}
</pre>
<p>使用方法很简单：</p>
<pre class="brush: csharp;">using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.ComponentModel;
using com.hetaoos.Utils.Extensions;//这一句是必须的，否则无法使用扩展方法
using System.Diagnostics;

namespace com.hetaoos
{
    static class Program
    {
        /// &lt;summary>
        /// 应用程序的主入口点。
        /// &lt;/summary>
        [STAThread]
        static void Main()
        {
            ProcessedDataResultType resultType = ProcessedDataResultType.BkgrdMap;
            ProcessedDataWaringResult ret = new ProcessedDataWaringResult() { ResultType = ProcessedDataResultType.WaringResult };
            Debug.Print("枚举类型的描述属性：{0}", resultType.GetDescription(true));
            Debug.Print("单个枚举变量的描述属性：{0} --> {1}", resultType, resultType.GetDescription());
            Debug.Print("类类型的描述属性：{0}", ret.GetDescription(true));
            Debug.Print("类类型的属性的描述属性：{0} --> {1}  --> {2}", ret.ResultType, ret.ResultType.GetDescription(), ret.ResultType.GetDescription(true));
        }

        /// &lt;summary>
        /// 处理结果类型
        /// &lt;/summary>
        //[TypeConverter(typeof(EnumDescConverter))]
        [Description("处理后的数据类型")]
        public enum ProcessedDataResultType : byte
        {
            [Description("背景地图")]
            BkgrdMap,
            [Description("检测结果")]
            WaringResult
        }

        [Description("报警结果")]
        public class ProcessedDataWaringResult
        {
            [Description("结果类型")]
            public ProcessedDataResultType ResultType { get; set; }
        }
    }
}
</pre>
<p>输出结果如下：</p>
<pre class="brush: html;">枚举类型的描述属性：处理后的数据类型
单个枚举变量的描述属性：BkgrdMap --> 背景地图
类类型的描述属性：报警结果
类类型的属性的描述属性：WaringResult --> 检测结果  --> 处理后的数据类型</pre>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F41">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中反射获取某类的子类和根据类型名动态创建对象</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F4&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F41">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中利用反射机制拷贝类的字段和属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F37&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F41">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 通过文件头判断图像的类型</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F5&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F41">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">动态填充/修改类属性的 DisplayNameAttribute 属性</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/37' rel='bookmark' title='C# 通过文件头判断图像的类型'>C# 通过文件头判断图像的类型</a></li>
<li><a href='http://blog.hetaoos.com/archives/4' rel='bookmark' title='C# 中利用反射机制拷贝类的字段和属性'>C# 中利用反射机制拷贝类的字段和属性</a></li>
<li><a href='http://blog.hetaoos.com/archives/40' rel='bookmark' title='C# 中反射获取某类的子类和根据类型名动态创建对象'>C# 中反射获取某类的子类和根据类型名动态创建对象</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hetaoos.com/archives/41/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C# 中反射获取某类的子类和根据类型名动态创建对象</title>
		<link>http://blog.hetaoos.com/archives/40?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=c-%25e4%25b8%25ad%25e5%258f%258d%25e5%25b0%2584%25e8%258e%25b7%25e5%258f%2596%25e6%259f%2590%25e7%25b1%25bb%25e7%259a%2584%25e5%25ad%2590%25e7%25b1%25bb%25e5%2592%258c%25e6%25a0%25b9%25e6%258d%25ae%25e7%25b1%25bb%25e5%259e%258b%25e5%2590%258d%25e5%258a%25a8%25e6%2580%2581%25e5%2588%259b%25e5%25bb%25ba%25e5%25af%25b9</link>
		<comments>http://blog.hetaoos.com/archives/40#comments</comments>
		<pubDate>Mon, 11 Oct 2010 15:35:19 +0000</pubDate>
		<dc:creator>Null</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[编程笔记]]></category>
		<category><![CDATA[Assembly]]></category>
		<category><![CDATA[Type]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[动态]]></category>
		<category><![CDATA[反射]]></category>
		<category><![CDATA[程序集]]></category>
		<category><![CDATA[继承]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://blog.hetaoos.com/?p=40</guid>
		<description><![CDATA[有时候，为了快速批量处理已经实现某个基类或者某个接口的子类，需要通过反射的方式获取到他们的类类型(Type),然后再通过 Activator.CreateInstance(objType); 或者 Assembly.Load(path).CreateInstance(typeName); 或者 Assembly.LoadFile(filePath).CreateInstance(typeName); 创建对象实例。 以下通过一个简单的示例来展示： 1，获取当前程序集中的全部类型； 2，判断某一类型是否是继承与另一类型； 3，根据类型名动态创建对象。 目前还有个疑问，不知道谁能解答： 1，如何判断某个类是否实现了某个接口，目前只能先 new 一个对象，然后再 用 is 判断。 using System; using System.Collections.Generic; using System.Text; using System.Reflection; using System.Diagnostics; namespace com.hetaoos { class Test { public Test() { var types = Assembly.GetExecutingAssembly().GetTypes(); var baseType = typeof(BaseProcessor); List&#60;BaseProcessor> processors = new List&#60;BaseProcessor>(); foreach (var t in types) [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F41&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 获取枚举 Enum 变量值的 Description 属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F4&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中利用反射机制拷贝类的字段和属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F5&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">动态填充/修改类属性的 DisplayNameAttribute 属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PAC Maker,代理自动配置文件生成器[C#,Open Source]</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/4' rel='bookmark' title='C# 中利用反射机制拷贝类的字段和属性'>C# 中利用反射机制拷贝类的字段和属性</a></li>
<li><a href='http://blog.hetaoos.com/archives/34' rel='bookmark' title='C# 类 XML 序列化基类'>C# 类 XML 序列化基类</a></li>
<li><a href='http://blog.hetaoos.com/archives/37' rel='bookmark' title='C# 通过文件头判断图像的类型'>C# 通过文件头判断图像的类型</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>有时候，为了快速批量处理已经实现某个基类或者某个接口的子类，需要通过反射的方式获取到他们的类类型(Type),然后再通过 </p>
<pre class="brush: csharp;">Activator.CreateInstance(objType);</pre>
<p>或者</p>
<pre class="brush: csharp;">Assembly.Load(path).CreateInstance(typeName);</pre>
<p>或者</p>
<pre class="brush: csharp;">Assembly.LoadFile(filePath).CreateInstance(typeName);</pre>
<p>创建对象实例。<br />
<span id="more-40"></span></p>
<p>以下通过一个简单的示例来展示：<br />
1，获取当前程序集中的全部类型；<br />
2，判断某一类型是否是继承与另一类型；<br />
3，根据类型名动态创建对象。</p>
<p>目前还有个疑问，不知道谁能解答：<br />
1，如何判断某个类是否实现了某个接口，目前只能先 new 一个对象，然后再 用 is 判断。</p>
<pre class="brush: csharp;">using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Diagnostics;

namespace com.hetaoos
{

    class Test
    {
        public Test()
        {
            var types = Assembly.GetExecutingAssembly().GetTypes();
            var baseType = typeof(BaseProcessor);
            List&lt;BaseProcessor> processors = new List&lt;BaseProcessor>();
            foreach (var t in types)
            {
                var tmp = t.BaseType;
                while (tmp != null)
                {
                    if (tmp == baseType)
                    {
                        BaseProcessor obj = MethodMaker.CreateObject(t.FullName) as BaseProcessor;
                        if (obj != null)
                        {
                            processors.Add(obj);
                        }
                        break;
                    }
                    else
                    {
                        tmp = tmp.BaseType;
                    }
                }
            }

            Debug.Print("Processor Count:{0}", processors.Count);
            foreach (var p in processors)
            {
                Debug.Print("{0}\t:{1}", p, p.Calc(2, 5));
            }
        }
    }

    public class MethodMaker
    {

        /// &lt;summary>
        /// 创建对象（当前程序集）
        /// &lt;/summary>
        /// &lt;param name="typeName">类型名&lt;/param>
        /// &lt;returns>创建的对象，失败返回 null&lt;/returns>
        public static object CreateObject(string typeName)
        {
            object obj = null;
            try
            {
                Type objType = Type.GetType(typeName, true);
                obj = Activator.CreateInstance(objType);
            }
            catch (Exception ex)
            {
                Debug.Write(ex);
            }
            return obj;
        }

        /// &lt;summary>
        /// 创建对象(外部程序集)
        /// &lt;/summary>
        /// &lt;param name="path">&lt;/param>
        /// &lt;param name="typeName">类型名&lt;/param>
        /// &lt;returns>创建的对象，失败返回 null&lt;/returns>
        public static object CreateObject(string path, string typeName)
        {
            object obj = null;
            try
            {

                obj = Assembly.Load(path).CreateInstance(typeName);
            }
            catch (Exception ex)
            {
                Debug.Write(ex);
            }

            return obj;
        }
    }

    public abstract class BaseProcessor
    {
        public abstract int Calc(int a, int b);
    }

    public class Adder : BaseProcessor
    {
        public override int Calc(int a, int b)
        {
            return a + b;
        }
    }

    public class Multiplier : BaseProcessor
    {
        public override int Calc(int a, int b)
        {
            return a * b;
        }
    }
}
</pre>
<p>输出结果为：</p>
<pre class="brush: html;">Processor Count:2
com.hetaoos.Adder	:7
com.hetaoos.Multiplier	:10</pre>
<p>PS:<br />
判断某个类是否继承自某个接口、类的方法：</p>
<pre class="brush: csharp;">        public static bool IsParent(Type test, Type parent)
        {
            if (test == null || parent == null || test == parent || test.BaseType == null)
            {
                return false;
            }
            if (parent.IsInterface)
            {
                foreach (var t in test.GetInterfaces())
                {
                    if (t == parent)
                    {
                        return true;
                    }
                }
            }
            else
            {
                do
                {
                    if (test.BaseType == parent)
                    {
                        return true;
                    }
                    test = test.BaseType;
                } while (test != null);

            }
            return false;
        }</pre>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">无觅猜您也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F41&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 获取枚举 Enum 变量值的 Description 属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F4&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C# 中利用反射机制拷贝类的字段和属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F5&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">动态填充/修改类属性的 DisplayNameAttribute 属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F55&from=http%3A%2F%2Fblog.hetaoos.com%2Farchives%2F40">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PAC Maker,代理自动配置文件生成器[C#,Open Source]</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><strong>关联文章:</strong><ol>
<li><a href='http://blog.hetaoos.com/archives/4' rel='bookmark' title='C# 中利用反射机制拷贝类的字段和属性'>C# 中利用反射机制拷贝类的字段和属性</a></li>
<li><a href='http://blog.hetaoos.com/archives/34' rel='bookmark' title='C# 类 XML 序列化基类'>C# 类 XML 序列化基类</a></li>
<li><a href='http://blog.hetaoos.com/archives/37' rel='bookmark' title='C# 通过文件头判断图像的类型'>C# 通过文件头判断图像的类型</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hetaoos.com/archives/40/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

