public void AddFileStatistics(string path, bool isDirectory, FileStatistics statistics) { var extension = isDirectory ? DirectoryExtension : Path.GetExtension(path).ToLowerInvariant(); lock (Lock) { var s = statistics.CombineWith(ByExtension.GetValueOrDefault(extension)); if (s.Size > 0) { ByExtension[extension] = s; } if (isDirectory) { s = statistics.CombineWith(ByDirectory.GetValueOrDefault(path)); if (s.Size > 0) { ByDirectory[path] = s; } } } }