public void ParseMetadataRecursive( DirectoryInfo rootDirectory, DirectoryInfo rootOutputDirectory, string subDirectorySuffix, bool exportSqlite, bool exportJson, bool shouldOverwrite) { //currentDirectoryTextBlock.Background = new SolidColorBrush(Colors.Gold); var currentInputDirectory = new DirectoryInfo($"{rootDirectory.FullName}\\{subDirectorySuffix}"); var currentOutputDirectory = new DirectoryInfo($"{rootOutputDirectory.FullName}\\{subDirectorySuffix}"); CurrentDirectoryPath = $"$\\{subDirectorySuffix}"; var jsonOutputDirectory = new DirectoryInfo($"{rootOutputDirectory.FullName}\\Json\\{subDirectorySuffix}"); string sqliteFilepath = $"{rootOutputDirectory.FullName}\\Sqlite\\music_metadata.sqlite"; LibraryParsing.ParseMetadata(currentInputDirectory, jsonOutputDirectory, sqliteFilepath, exportSqlite, exportJson, shouldOverwrite); var subDirectories = currentInputDirectory.EnumerateDirectories(); foreach (var subDirectory in subDirectories) { var suffix = $"{subDirectorySuffix}{subDirectory.Name}\\"; ParseMetadataRecursive(rootDirectory, rootOutputDirectory, suffix, exportSqlite, exportJson, shouldOverwrite); } //currentDirectoryTextBlock.Background = new SolidColorBrush(Colors.LightGreen); }
public void ParseButtonClicked(object sender, RoutedEventArgs args) { var directory = new DirectoryInfo(InputRootDirectoryPath); var outputDirectory = new DirectoryInfo(OutputRootDirectoryPath); bool exportSqlite = ExportSqlite.IsChecked ?? false; bool exportJson = ExportJson.IsChecked ?? false; bool shouldOverwrite = ShouldOverwrite.IsChecked ?? false; PersistSettings(); Task.Factory.StartNew(() => { if (shouldOverwrite && exportSqlite) { LibraryParsing.CreateDatabase(SqliteFilepath); } ParseMetadataRecursive(directory, outputDirectory, "", exportSqlite, exportJson, shouldOverwrite); CurrentDirectoryPath = "Finished!"; }); }