- 博客(33)
- 资源 (5)
- 收藏
- 关注

原创 基于事件的异步Socket(TCP连接方式)
//TcpService.csusing System;using System.IO;using System.Text;using System.Net;using System.Diagnostics;using System.Net.Sockets;using System.Collections.Generic;using System.Runtime.InteropServices
2006-09-25 13:10:00
7618
1
转载 APM
using System;using System.Collections.Generic;using System.Text;using System.Threading;namespace ConsoleTest{ //Figure 2 AsyncResultNoResult 类 internal class AsyncResultNoResult : IAsyncResult
2008-04-02 16:12:00
712
原创 VS2008 常用快捷建
编辑快捷键Ctrl+B,T 切换书签开关Ctrl+B,N 移动到下一书签Ctrl+B,P 移动到上一书签Ctrl+B,C 清除全部标签 Ctrl+I 渐进式搜索Ctrl+Shift+I反向渐进式搜索F12 转到定义Alt+F12 查找符号(列出所有查找结果)Ctrl+F 查找Ctrl+H 替换Ctrl+Shift+F
2008-03-19 21:22:00
3639
2
原创 C# 大数相乘
参照 http://blog.youkuaiyun.com/qw_study/archive/2006/10/22/1345087.aspx的改了下..速度提高了近40倍..using System;using System.Text;namespace BigNumberCalculator{ public class OP { public static strin
2008-03-19 13:41:00
1474
转载 开源WinMD5中的MTQueue类
using System; using System.Collections; using System.Threading; using System.Collections.Generic; namespace WinMD5 { public abstract class QueueItemBase { } /** A Thread safe wrapper * for the Queue c
2008-02-22 16:53:00
878
2
转载 序列化,反序列化时低序位非打印 ASCII 字符的问题
最近碰到一个问题,我的一个把数据库中记录的信息暴露出来的Web Service调用时候出问题了。报下面的错误信息:System.InvalidOperationException was unhandled Message="XML 文档(1, 823)中有错误。" Source="System.Xml" Message="“”(十六进制值 0x0E)是无效的字符。 行 1,位置 8
2008-01-14 22:51:00
655
原创 利用WellKnown激活模式模拟客户端激活模式
//客户端激活模式接口 public interface IClientActivator { T CreateInstance(); T CreateInstance(params object[] args); }// 客户端激活模式抽象类 public abstract class ClientActivator : MarshalB
2007-12-15 16:08:00
757
原创 自定义配置文件
[Serializable()]public struct GlobalSettings{//} XmlSerializer ser= new XmlSerializer(typeof(GlobalSettings));TextWriter wr = new StreamWriter("data.xml");ser.Serialize(wr,myGlobalSet
2007-06-02 13:14:00
884
原创 2005单元测试文件头
//#define mUnit// 以下代码由 Microsoft Visual Studio 2005 生成。// 测试所有者应该检查每个测试的有效性。using System;using System.Text;using System.Collections.Generic;using zDit.Common.Chinese;using System.IO;#if mUnitusing
2007-03-29 15:04:00
756
原创 序列化及反序列化
加上[Serializable]特性 /**//// /// 序列化/// /// 要序列化的对象public static byte[] Serialize(object data)...{ BinaryFormatter formatter = new BinaryFormatter(); MemoryStream rems = new MemoryStream();
2006-11-09 17:21:00
1026
原创 只充许运行一个应用程序实例
using System;using System.Collections.Generic;using System.Windows.Forms;using System.Reflection;using System.Threading;using System.Diagnostics;using System.Runtime.InteropServices;namespace AutoUp
2006-11-08 15:15:00
1129
翻译 http多线程下载
using System;using System.IO;using System.Net;using System.Text;using System.Security;using System.Threading;using System.Collections.Specialized;using System.Diagnostics;using System.Data;namesp
2006-11-06 17:18:00
1557
原创 如何使用中文密码
设置方法..在修改密码时,将中文字符粘贴到密码框即可..... 登录时的输入方法:先下载"中英文字符编码查询"软件:http://www.skycn.com/soft/22871.html运行软件编码类型选 GBK 内码 ,进制选十六进制输入汉字即可看到编码...再把编码转化为10进制..此10进制即为汉字的GBK内码...照以上方法输入即可..如密码为:中国 查询后为
2006-11-03 14:15:00
2144
1
原创 得到DataGridView的选中行
DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[]...{ new DataColumn("ID",Type.GetType("System.Int32")), new DataColumn("Name
2006-10-15 11:20:00
2693
原创 一个加密与解密的实例
using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.IO;using System.Security.Cryptography;namespace 文件加密.
2006-10-10 13:24:00
1459
原创 SQL连接基础类
/**//**//**//********************************************************************* * App.config 文件内容 * *******************************************************
2006-10-09 10:08:00
928
原创 无限级分类
/**//// /// 添加到节点 /// /// /// public ListTreeNode> GetTreeNode(DataTable dt) ...{ int count = dt.Rows.Count; int[] owne
2006-10-06 13:35:00
964
原创 点对点聊天程序
using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.Net;using System.Net.Sockets;using System.IO;using Sy
2006-10-04 10:40:00
1912
原创 获取计算机信息
//获取计算机名称 this.label1.Text=SystemInformation.ComputerName; //获取用户名 this.label2.Text=SystemInformation.UserName; //获取用户工作域名称 this.label3.Text=SystemInformation.UserDomainName; //获取显示器分辨率
2006-09-15 18:11:00
1088
原创 调用API函数读写INI
using System;using System.Collections.Generic;using System.Text;using System.Runtime.InteropServices;namespace Config...{ class PrivateProfile ...{ /**//// /// 添加GetPrivatePr
2006-09-15 17:54:00
1053
转载 从.NET平台调用Win32 API
小序 Win32 API可以直接控制Microsoft Windows的核心,因为API(Application Programming Interface)本来就是微软留给我们直接控制Windows的接口。想玩儿吗?呵呵,太难了。 C#使用非常简单,写程序就像打拱猪,Sorry -_-! ,搭积木一样简单。想玩儿吗?呵呵,没办法直接控制Windows的核心。
2006-08-09 14:27:00
1601
原创 关键字切词
public Dictionarystring, int> Match(int wordMaxLen, int areaCode, string text) ...{ text = Regex.Replace(text, searchReg, "
2006-08-04 13:29:00
1152
转载 海量分词研究版C#接口
using System;using System.Collections.Generic;using System.Runtime.InteropServices;using System.Text;namespace LanSplit...{ /**//// /// 海量分词研究版C#接口 /// public class HL ...{
2006-08-04 13:24:00
3057
1
翻译 设置系统时间
[StructLayout(LayoutKind.Sequential)] public class SystemTime { public ushort year; public ushort month; public ushort dayofweek; public ushort day; public us
2006-08-04 13:22:00
849
转载 半角与全角、简繁体中文互相转化
/********************************************************************************************* * Microsoft.VisualBasic 命名空间 Strings 模块 StrConv 函数就具有大写/小写、全角/半角、 * 中文简体/繁体等转换功能,* 字符串转
2006-07-27 09:09:00
2229
原创 多线程传输文件辅助类
基类 using System;using System.Collections.Generic;using System.Text;using System.IO;namespace SocketServer...{ public delegate void FileEvent(FileBase f); public class FileBase ...{
2006-07-14 17:18:00
1359
1
原创 异步SOcket传输类(待完善)
#define DUBEGusing System;using System.IO;using System.Text;using System.Net;using System.Threading;using System.Net.Sockets;using System.Collections.Generic;using System.Runtime.Serialization.Fo
2006-07-02 22:43:00
1501
原创 异步TCP连接服务器端
TcpTranslate 为传输辅助类,此外代码不全.待续.....using System;using System.IO;using System.Text;using System.Net;using System.Net.Sockets;using System.Collections.Generic;namespace SocketServer...{ /**////
2006-06-22 16:21:00
1864
转载 跨线程调用Windows窗体控件
delegate void SetTextCallback(string text); private void SetText(string text) { // InvokeRequired required compares the thread ID of the // calling thread to the thread I
2006-06-19 17:49:00
3972
2
转载 用C#实现汉字转化为拼音
using System;using System.Collections.Generic;using System.Text;using System.Text.RegularExpressions;namespace SplitWord...{ /**//// 用C#实现汉字转化为拼音 /// 实现的原理就是先将汉字转化成为内码,然后通过内码和拼音的对照来查找。
2006-06-19 13:15:00
1931
1
原创 文本框中只充许输入数字
文本框中只充许输入数字 Button的KeyPress事件 private void Button_KeyPress(object sender, KeyPressEventArgs e){ char[] charNum ={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ,/u0008,/u000D};
2006-06-19 10:57:00
1482
1
转载 常用正则表达式
匹配中文字符的正则表达式: [/u4e00-/u9fa5] //new Regex("^[/u4e00-/u9fa5]$");匹配双字节字符(包括汉字在内):[^/x00-/xff]应用:计算字符串的长度(一个双字节字符长度计2,ASCII字符计1)String.prototype.len=function(){return this.replace([^/x00-/xff]/g,
2006-06-17 14:21:00
720
原创 SQL如何删除重复的数据行
SQL如何删除重复的数据行- -delete from table where id in ( select max(id) from table group by name having count(*)>1)--删除重复记录中ID最大的一条(如果有2条以上的重复记录则需多次执行)如果table数据完全一样,可以先将数据导入到一个临时表内或delete from table wher
2006-06-08 10:54:00
2818
读取纯真IP数据库的公用组件(C#)
2009-05-19
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人