Beispiel #1
0
 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;
 }
Beispiel #2
0
        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;
        }
Beispiel #3
0
 public void Add(FileList fileList)
 {
     if (fileLists.Contains(fileList))
         return;
     fileLists.Add(fileList);
 }
Beispiel #4
0
 void CreateDefaultList()
 {
     var fl = new FileList(FileList.DEFAULT_NAME);
     fl.AddDefaultFiles();
     fileLists.Add(fl);
 }
Beispiel #5
0
 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;
 }