public static Setlist SearchAllLocations() { IAsyncResult result; result = StorageDevice.BeginShowSelector(PlayerIndex.One, null, null); // wait in result... StorageDevice device = StorageDevice.EndShowSelector(result); StorageContainer container = Setlist.OpenContainer(device, "Fortissimo"); String directory = Path.Combine(/*TITLE_LOCATION,*/ "Songs"); List <SongDataPlus> list = new List <SongDataPlus>(); DirectoryInfo dr = new DirectoryInfo(directory); if (dr.Exists) { list.AddRange(SearchDirectory(dr).Songs); //list.Add(SearchDirectory(dr)); foreach (DirectoryInfo dir in dr.GetDirectories()) { list.AddRange(SearchDirectory(dir).Songs); } } Setlist s = new Setlist(list, "All Songs"); return(s); }
public static List <Setlist> SearchDefaultLocation() { IAsyncResult result; result = StorageDevice.BeginShowSelector(PlayerIndex.One, null, null); // wait in result... StorageDevice device = StorageDevice.EndShowSelector(result); StorageContainer container = Setlist.OpenContainer(device, "Fortissimo"); String directory = Path.Combine(/*TITLE_LOCATION,*/ "Songs"); return(SearchFileLocation(directory)); }
public static List <Setlist> SearchFileLocation(String location) { List <Setlist> list = new List <Setlist>(); DirectoryInfo dr = new DirectoryInfo(location); if (dr.Exists) { Setlist s = SearchDirectory(dr); s.Name = "Core list"; list.Add(s); foreach (DirectoryInfo dir in dr.GetDirectories()) { list.Add(SearchDirectory(dir)); } } return(list); }
public static Setlist SearchDirectory(DirectoryInfo dir) { List <SongDataPlus> list = new List <SongDataPlus>(); foreach (FileInfo fl in dir.GetFiles("*.gba")) { SongDataPlus dataPlus = new SongDataPlus(); dataPlus.fullPath = fl.FullName; dataPlus.songData = SongDataIO.SongLoader.LoadSong(dataPlus.fullPath); dataPlus.dirPath = dir.ToString(); dataPlus.type = SongDataPlus.NoteType.GBA; list.Add(dataPlus); } foreach (FileInfo fl in dir.GetFiles("*.mid")) { // .mid files are considered to be Notes.mid files from commercial games, not general Midis //if(fl.Name.Contains("if")) list.Add(GetMidiSongDataPlus(dir, fl, true)); } foreach (FileInfo fl in dir.GetFiles("*.fff")) { foreach (FileInfo fl2 in dir.GetFiles("*.ffm")) { // Only add .fff files if there is a corresponding .ffm file if (fl2.FullName.Substring(0, fl2.FullName.Length - 4).CompareTo(fl.FullName.Substring(0, fl.FullName.Length - 4)) == 0) { list.Add(GetMidiSongDataPlus(dir, fl, false)); break; } } } Setlist s = new Setlist(list, dir.Name); return(s); }
public static SongDataPlus PickRandomSong() { IAsyncResult result; result = StorageDevice.BeginShowSelector(PlayerIndex.One, null, null); // wait in result... StorageDevice device = StorageDevice.EndShowSelector(result); StorageContainer container = Setlist.OpenContainer(device, "Fortissimo"); String directory = Path.Combine(/*TITLE_LOCATION,*/ "Songs"); List <SongDataPlus> list = new List <SongDataPlus>(); DirectoryInfo dr = new DirectoryInfo(directory); if (dr.Exists) { list.AddRange(SearchDirectory(dr).Songs); //list.Add(SearchDirectory(dr)); foreach (DirectoryInfo dir in dr.GetDirectories()) { list.AddRange(SearchDirectory(dir).Songs); } } if (list.Count != 0) { Random r = new Random(); int idx = r.Next(list.Count); return(list[idx]); } else { SongDataPlus nullSong = new SongDataPlus(); nullSong.type = SongDataPlus.NoteType.None; return(nullSong); } }