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
阅读全文
摘要: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...
阅读全文