static public void getSize(string pathLocation) { DirectoryInfo dInfo = new DirectoryInfo(pathLocation); sizeOfDirKb = DirectorySize(dInfo, true) / (1024); adminProcess = new System.Diagnostics.ProcessStartInfo(); TotalSizeOfFolderByte = sizeOfDirKb / (1024 * 1024); if (TotalSizeOfFolderByte < 100) { TotalSizeOfFolder = Math.Floor(TotalSizeOfFolderByte * 100) / 100; } else if (TotalSizeOfFolderByte >= 100) { TotalSizeOfFolder = Math.Floor(TotalSizeOfFolderByte); } } static int i=0; static double DirectorySize(DirectoryInfo dInfo, bool includeSubDir) { totalSize = dInfo.EnumerateFiles()//double .Sum(file => file.Length);//double Total = Total + totalSize / 1024 / 1024 / 1024;//double total1[i] = Total;//double if (includeSubDir) { totalSize += dInfo.EnumerateDirectories() .Sum(dir => DirectorySize(dir, true)); } return totalSize; }
Parallel.Invoke( () => { //code for getsize1 }, () => { //code for getsize2 }, () => { //code for getsizeN }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)