/// <summary> /// Creates a new dataset from an exising data store. /// </summary> /// <param name="storeName">The name of the data store.</param> /// <param name="storePath">The path of the data store.</param> /// <param name="partitionName">The partition name.</param> /// <returns>The newly created dataset.</returns> public static Dataset CreateFromExistingStore(string storeName, string storePath, string partitionName = null) { var dataset = new Dataset(); dataset.AddSessionFromExistingStore(storeName, storeName, storePath, partitionName); return(dataset); }
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); } }