private static void AddSessionsFromExistingStores(this Dataset dataset, string rootPath, string currentPath, string partitionName) { // scan for any psi catalog files foreach (var filename in Directory.EnumerateFiles(currentPath, "*.Catalog_000000.psi")) { var fi = new FileInfo(filename); var storeName = fi.Name.Substring(0, fi.Name.Length - ".Catalog_000000.psi".Length); var sessionName = (currentPath == rootPath) ? filename : Path.Combine(currentPath, filename).Substring(rootPath.Length); sessionName = sessionName.Substring(0, sessionName.Length - fi.Name.Length); sessionName = sessionName.Trim('\\'); dataset.AddSessionFromExistingStore(sessionName, storeName, currentPath, partitionName); } // now go through subfolders foreach (var directory in Directory.EnumerateDirectories(currentPath)) { dataset.AddSessionsFromExistingStores(rootPath, Path.Combine(currentPath, directory), partitionName); } }
/// <summary> /// Adds sessions from data stores located in the specified path. /// </summary> /// <param name="dataset">The dataset to add sessions to.</param> /// <param name="path">The path that contains the data stores.</param> /// <param name="partitionName">The name of the partion to be added when adding a new session. Default is null.</param> public static void AddSessionsFromExistingStores(this Dataset dataset, string path, string partitionName = null) { dataset.AddSessionsFromExistingStores(path, path, partitionName); }