public CachedDirectory AddToCache(DirectoryEntry directory, IReadOnlyList <FileExplorerEntry> entries, bool directoriesOnly) { var cachedDirectory = new CachedDirectory(directory, directoriesOnly, entries); var cacheKey = NormalizePath(directory.Path); _localCache[cacheKey] = cachedDirectory; DirectoryEntriesUpdated?.Invoke(this, new DirectoryEntriesUpdatedEventArgs(directory.Path, cachedDirectory.Entries, directoriesOnly)); return(cachedDirectory); }
public void AddToCache(DirectoryEntry directoryEntry, List <IFileExplorerEntry> entries, bool directoriesOnly) { var entriesInfo = new EntriesInfo(entries, directoryEntry, directoriesOnly); var path = directoryEntry.Path.NormalizePath(); if (_cachedEntries.ContainsKey(path)) { _cachedEntries[path] = entriesInfo; } else { _cachedEntries.TryAdd(path, entriesInfo); } DirectoryEntriesUpdated?.Invoke(this, new DirectoryEntriesUpdate(directoryEntry.Path, entries, directoriesOnly)); }