public static void ReloadSongList() { needRefresh = false; SongList.sFirstTime = true; SongList.OnSongListLoaded.mDone = false; SongList.SongSourceDirs = new Il2CppSystem.Collections.Generic.List <SongList.SongSourceDir>(); SongList.AddSongSearchDir(Application.dataPath, downloadsDirectory); SongList.I.StartAssembleSongList(); SongSelect songSelect = GameObject.FindObjectOfType <SongSelect>(); if (songSelect != null) { SongList.OnSongListLoaded.On(new Action(() => { songSelect.ShowSongList(); })); } if (songDataLoaderInstalled) { SongList.OnSongListLoaded.On(new Action(() => { SafeDataLoaderReload(); })); } DebugText("Reloading Songs"); }
/// <summary>1 /// Call to reload song list after songs were added to songs or downloads directories. /// Should be called while the user is in the main menu. /// </summary> /// <param name="fullReload">Call with true to reload the entire song list. Otherwise only new /// songs will be loaded (unfortunately unable to detect modified songs)</param> public static void ReloadSongList(bool fullReload = true) { SongDownloader.needRefresh = false; if (fullReload) { SongList.sFirstTime = true; SongList.OnSongListLoaded.mDone = false; SongList.SongSourceDirs = new Il2CppSystem.Collections.Generic.List <SongList.SongSourceDir>(); SongList.AddSongSearchDir(Application.dataPath, downloadsDirectory); SongList.I.StartAssembleSongList(); } else { List <SongList.SongSourceDir> sourceDirs = new List <SongList.SongSourceDir>(); sourceDirs.Add(new SongList.SongSourceDir(Application.streamingAssetsPath, mainSongDirectory)); sourceDirs.Add(new SongList.SongSourceDir(Application.dataPath, downloadsDirectory)); for (int i = 0; i < sourceDirs.Count; i++) { SongList.SongSourceDir sourceDir = sourceDirs[i]; string[] files = Directory.GetFiles(sourceDir.dir, "*.audica"); for (int j = 0; j < files.Length; j++) { string file = files[j].Replace('\\', '/'); if (!SongLoadingManager.songFilenames.Contains(Path.GetFileName(file)) && !SongDownloader.downloadedFileNames.Contains(Path.GetFileName(file))) { SongList.I.ProcessSingleSong(sourceDir, file, new Il2CppSystem.Collections.Generic.HashSet <string>()); } } } } SongDownloader.downloadedFileNames.Clear(); SongLoadingManager.StartSongListUpdate(fullReload); DebugText("Reloading Songs"); }