private void AddFileSize(ref FolderSize sum, string path) { sum.fileCount++; sum.logicalSize += (ulong)new FileInfo(path).Length; try { ulong ps = ExtendedFileInfo.GetPhysicalFileSize(path); sum.physicalSize += ps; uint clusterSize = ExtendedFileInfo.GetClusterSize(path); if (clusterSizeOverride != 0) { clusterSize = clusterSizeOverride; } ulong ds = ((ps + clusterSize - 1) / clusterSize) * clusterSize; sum.diskSize += ds; } catch (Win32Exception ex) { throw new UnauthorizedAccessException("Cannot get file size: ", ex); } }