} = 0; // Used to track difficulty switches public static void ImportSongs(string songsFolder) { if (!Directory.Exists(songsFolder)) { return; } //DirectoryInfo di = new DirectoryInfo(songsFolder); //var folders = di.EnumerateDirectories(); var folders = Directory.EnumerateDirectories(songsFolder); foreach (var folder in folders) { // If a folder contains an *.ssi file, use that to load charts // Otherwise, load each chart individually //var files = folder.EnumerateFiles(); var files = Directory.EnumerateFiles(folder); var info = files.Where(f => f.EndsWith(Defines.InfoExtension)); if (info != null && info.Count() > 0) { foreach (var file in info) { Songlist.Add(new SongMetadata(file)); } } else { var charts = files.Where(f => f.EndsWith(Defines.ChartExtension)); if (charts != null && charts.Count() > 0) { foreach (var chart in charts) { Songlist.Add(new SongMetadata(chart)); } } } } FolderParams.Add(new FolderParams() { Type = SortType.Title, Name = ConfigFile.GetLocalizedString("Sort_Title") }); FolderParams.Add(new FolderParams() { Type = SortType.Artist, Name = ConfigFile.GetLocalizedString("Sort_Artist") }); FolderParams.Add(new FolderParams() { Type = SortType.Level, Name = ConfigFile.GetLocalizedString("Sort_Level") }); }
public static void ImportSongs(string songsFolder) { DirectoryInfo di = new DirectoryInfo("Songs"); var folders = di.EnumerateDirectories(); foreach (var folder in folders) { // If a folder contains an *.ssi file, use that to load charts // Otherwise, load each chart individually var files = folder.EnumerateFiles(); var info = files.Where(f => f.FullName.EndsWith(Defines.InfoExtension)); if (info != null && info.Count() > 0) { foreach (var file in info) { Songlist.Add(new SongMetadata(file.FullName)); } } else { var charts = files.Where(f => f.FullName.EndsWith(Defines.ChartExtension)); if (charts != null && charts.Count() > 0) { foreach (var chart in charts) { Songlist.Add(new SongMetadata(chart.FullName)); } } } } FolderParams.Add(new FolderParams() { Type = SortType.Title, Name = "SORT BY\nTITLE" }); FolderParams.Add(new FolderParams() { Type = SortType.Artist, Name = "SORT BY\nARTIST" }); FolderParams.Add(new FolderParams() { Type = SortType.Level, Name = "SORT BY\nLEVEL" }); }