public void Clear(HashSet <IDnSpyFile> modules) { lock (lockObj) { foreach (var kv in cachedItems.ToArray()) { if (InModifiedModuleHelper.IsInModifiedModule(modules, kv.Key.Nodes) || IsInModifiedModule(fileManager, modules, kv.Value)) { cachedItems.Remove(kv.Key); continue; } } } }
static bool IsInModifiedModule(IFileManager fileManager, HashSet <IDnSpyFile> modules, Item item) { var result = item.Content; if (result == null && item.WeakContent != null) { result = (DocumentViewerContent)item.WeakContent.Target; } var refs = result?.ReferenceCollection; if (refs == null) { return(false); } return(InModifiedModuleHelper.IsInModifiedModule(fileManager, modules, refs.Select(a => a.Data.Reference))); }
bool MustRefresh(IFileTab tab, IEnumerable <IDnSpyFile> files) { var modules = new HashSet <IDnSpyFile>(files); if (InModifiedModuleHelper.IsInModifiedModule(modules, tab.Content.Nodes)) { return(true); } var uiContext = tab.TryGetTextEditorUIContext(); if (uiContext != null && InModifiedModuleHelper.IsInModifiedModule(FileTreeView.FileManager, modules, uiContext.References)) { return(true); } return(false); }
bool MustRefresh(IFileTab tab, IEnumerable <IDnSpyFile> files) { var modules = new HashSet <IDnSpyFile>(files); if (InModifiedModuleHelper.IsInModifiedModule(modules, tab.Content.Nodes)) { return(true); } var documentViewer = tab.TryGetDocumentViewer(); if (documentViewer != null && InModifiedModuleHelper.IsInModifiedModule(FileTreeView.FileManager, modules, documentViewer.Content.ReferenceCollection.Select(a => a.Data.Reference))) { return(true); } return(false); }
static bool IsInModifiedModule(IFileManager fileManager, HashSet <IDnSpyFile> modules, Item item) { var textOutput = item.TextOutput; if (textOutput == null && item.WeakTextOutput != null) { textOutput = (AvalonEditTextOutput)item.WeakTextOutput.Target; } if (textOutput == null) { return(true); } var refs = textOutput.References; if (refs == null) { return(false); } return(InModifiedModuleHelper.IsInModifiedModule(fileManager, modules, refs.Select(a => a.Reference))); }