摘要: /*过滤掉的信息包括html的任何标签和属性*/ 1 public static string ClearHtmlCode(string text) 2 { 3 text = text.Trim(); 4 if (string.IsNullOrEmpty(text)) 5 return string.Empty; 6 text = Regex.Replace(text, "[/s]{2,}", ""); //过滤两个或两个以上的空格 7 tex... 阅读全文
posted @ 2011-11-05 10:01 幸福~伞 阅读(550) 评论(0) 推荐(0) 编辑
摘要: 1 private static string Conversion(string binarySystem)2 {3 string er = binarySystem;4 int shi = Convert.ToInt32(er, 2);5 string shiliu = Convert.ToString(shi, 16);6 return shiliu;7 } 阅读全文
posted @ 2011-11-05 09:52 幸福~伞 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Text; 4 using System.Text.RegularExpressions; 5 using System.Management; 6 7 namespace ipInfo 8 { 9 class Program10 {11 static void Main(string[] args)12 { //获得主机名13 string hostname = Syste... 阅读全文
posted @ 2011-11-05 09:50 幸福~伞 阅读(553) 评论(0) 推荐(0) 编辑
摘要: API函数是构筑Windows应用程序的基石,是Windows编程的必备利器。每一种Windows应用程序开发工具都提供了间接或直接调用了WindowsAPI函数的方法,或者是调用WindowsAPI函数的接口,也就是说具备调用动态连接库的能力。Visual C#和其它开发工具一样也能够调用动态链接库的API函数。本文中笔者就结合实例向大家介绍在Visual C#中如何调用各种返回值的API,该实例就是一个通过API函数调用获取系统信息的程序。在Visual C#中调用API的基本过程:首先,在调用API之前,你必须先导入System.Runtime.InteropServices这个名称空间 阅读全文
posted @ 2011-11-05 09:41 幸福~伞 阅读(712) 评论(0) 推荐(0) 编辑
摘要: 所谓系统信息,就是计算机的软件硬件信息,硬件如CPU主频、网卡名称等,软件信息就如操作系统目录,用户目录等。在平常的编程中,我们往往要用到这些系统信息,比如字体查看器,如果要写个C#版,则首先要获得系统字体的安装目录。总之,读取系统信息对于编程还是很重要的,.NET也不负所望,提供了很便利的方法,本文提供了四种方法来从各个方面对系统信息进行读取。第一种方法:用SystemInformation类SystemInformation提供静态方法和属性,它们可用于获取诸如Windows显示元素大小、操作系统设置、网络可用性和系统中所安装硬件的性能等信息,这种方法侧重于操作系统(这里特指Windows 阅读全文
posted @ 2011-11-05 09:32 幸福~伞 阅读(598) 评论(0) 推荐(0) 编辑