public static PresetProvider CreateFromDirectory(string sessionsDirectoryPath) { var allMetaDataSets = new List <Dictionary <string, string> >(); foreach (var sessionDirectoryPath in Directory.GetDirectories(sessionsDirectoryPath)) { foreach (var path in Directory.GetFiles(sessionDirectoryPath)) { var file = SessionFile.Create(path); Dictionary <string, string> dictionary = file.GetMetaDataDictionary(); if (dictionary.Count > 0) { allMetaDataSets.Add(dictionary); } } } return(new PresetProvider(allMetaDataSets)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Refreshes the file list for the current session. /// </summary> /// ------------------------------------------------------------------------------------ private void RefreshFileList() { Utils.SetWindowRedraw(tabSessions, false); // TODO: keep track of currently selected file and try to restore // that after rebuilding the list. _currSessionFiles = (_currSession == null ? null : (from x in _currSession.Files select SessionFile.Create(x)).ToArray()); lblEmptySessionMsg.Visible = (_currSessionFiles != null && _currSessionFiles.Length == 0); splitFileTab.Panel2Collapsed = lblEmptySessionMsg.Visible; gridFiles.Visible = (_currSessionFiles != null && _currSessionFiles.Length > 0); lnkSessionPath.Visible = (_currSessionFiles != null && _currSessionFiles.Length == 0); lnkSessionPath.Text = (_currSession != null && _currSession.Folder != null ? _currSession.Folder : string.Empty); if (_currSessionFiles != null) { gridFiles.RowCount = _currSessionFiles.Length; } Utils.SetWindowRedraw(tabSessions, true); }