代码改变世界

12 2010 档案

摘要:/// <summary> /// 限制程序只能有一个实例 /// </summary> /// <returns></returns> public static Process RunningInstance() { Process current = Process.GetCurrentProcess(); Process[] processes = Process.GetProcessesByName(current.ProcessName); //Loop through the running processes in with th 阅读全文
posted @ 2010-12-02 16:16 ※森林小居※ 阅读(274) 评论(0) 推荐(0) 编辑
摘要:public static long GetDirectoryLength(string dirPath) { //判断给定的路径是否存在,如果不存在则退出 if (!Directory.Exists(dirPath)) return 0; long len = 0; //定义一个DirectoryInfo对象 DirectoryInfo di = new DirectoryInfo(dirPath); //通过GetFiles方法,获取di目录中的所有文件的大小 foreach (FileInfo fi in di.GetFiles()) { len += fi.Le... 阅读全文
posted @ 2010-12-02 12:50 ※森林小居※ 阅读(337) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示