public static FileList Create(ISettingsSection section) { var fileList = new FileList(section.Attribute<string>(FILELIST_NAME_ATTR)); foreach (var fileSect in section.SectionsWithName(FILE_SECTION)) { var info = DnSpyFileInfoSerializer.TryLoad(fileSect); if (info != null) fileList.Files.Add(info.Value); } return fileList; }
public bool Load(FileList fileList, IDnSpyFileLoader dnSpyFileLoader) { const bool isReload = false; if (dnSpyFileLoader == null) dnSpyFileLoader = new DefaultDnSpyFileLoader(fileTabManager.FileTreeView.FileManager); if (!CanLoad) return false; if (!CheckCanLoad(isReload)) return false; if (fileList != fileListManager.SelectedFileList) SaveCurrentFilesToList(); NotifyBeforeLoad(isReload); using (DisableSaveToList()) { fileTabManager.CloseAll(); fileTabManager.FileTreeView.FileManager.Clear(); dnSpyFileLoader.Load(fileList.Files.Select(a => new FileToLoad(a))); } NotifyAfterLoad(isReload); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { GC.Collect(); GC.WaitForPendingFinalizers(); })); return true; }
public void Add(FileList fileList) { if (fileLists.Contains(fileList)) return; fileLists.Add(fileList); }
void CreateDefaultList() { var fl = new FileList(FileList.DEFAULT_NAME); fl.AddDefaultFiles(); fileLists.Add(fl); }
public bool Remove(FileList fileList) { if (fileList == SelectedFileList) return false; var selected = SelectedFileList; fileLists.Remove(fileList); selectedIndex = fileLists.IndexOf(selected); Debug.Assert(selectedIndex >= 0); Debug.Assert(SelectedFileList == selected); return true; }