private IDictionary<string, long> BytesUsedByExtension(Directory d)
{
IDictionary<string, long> bytesUsedByExtension = new Dictionary<string, long>();
foreach (string file in d.ListAll())
{
string ext = IndexFileNames.GetExtension(file) ?? string.Empty;
long previousLength = bytesUsedByExtension.ContainsKey(ext) ? bytesUsedByExtension[ext] : 0;
bytesUsedByExtension[ext] = previousLength + d.FileLength(file);
}
foreach (string item in ExcludedExtensionsFromByteCounts()) {
bytesUsedByExtension.Remove(item);
}
return bytesUsedByExtension;
}