private void OnDownloadComplete(string search, bool success)
 {
     ActiveDownloads -= 1;
     if (!success)
     {
         MelonLogger.Warning("Download of " + search + " failed");
     }
     if (ActiveDownloads > 0)
     {
         return;
     }
     if (!IsDownloadingMissing)
     {
         SongBrowser.ReloadSongList();
         //EnableBackButton();
         return;
     }
     PlaylistManager.SavePlaylistData();
     //EnableBackButton();
     if (IsDownloadingMissing)
     {
         IsDownloadingMissing = false;
         SongLoadingManager.EnableButtons();
         PlaylistUtil.Popup("Missing playlist songs downloaded.");
         PopulatePlaylists();
         SongBrowser.ReloadSongList();
     }
 }
Exemplo n.º 2
0
 private static void LoadPlaylists()
 {
     // ioHandler.LoadPlaylistData();
     playlists = ioHandler.LoadPlaylists();
     SavePlaylistData();
     SongLoadingManager.AddPostProcessingCB(downloadManager.DownloadMissingSongs);
     SongLoadingManager.AddPostProcessingCB(downloadManager.EnableBackButton);
 }
Exemplo n.º 3
0
 private static void Postfix(StartupLogo __instance, ref StartupLogo.State state)
 {
     if (state == StartupLogo.State.Done)
     {
         SongDownloader.StartNewSongSearch();
         PlaylistManager.OnApplicationStart();
         FilterPanel.OnApplicationStart();
         SongLoadingManager.StartSongListUpdate();
         //PlaylistManager.GetAllApiSongs();
     }
 }
Exemplo n.º 4
0
        public override void OnApplicationStart()
        {
            Config.RegisterConfig();
            mainSongDirectory        = Path.Combine(Application.streamingAssetsPath, "HmxAudioAssets", "songs");
            downloadsDirectory       = Application.dataPath.Replace("Audica_Data", "Downloads");
            deletedDownloadsListPath = Path.Combine(downloadsDirectory, "SongBrowserDownload_DeletedFiles");
            CheckFolderDirectories();

            if (MelonHandler.Mods.Any(it => it.Info.SystemType.Name == nameof(SongDataLoader)))
            {
                songDataLoaderInstalled = true;
                MelonLogger.Msg("Song Data Loader is installed. Enabling integration");
            }
            else
            {
                MelonLogger.Warning("Song Data Loader is not installed. Consider downloading it for the best experience :3");
            }

            if (MelonHandler.Mods.Any(it => it.Info.SystemType.Name == nameof(ModSettings)))
            {
                modSettingsInstalled = true;
            }

            if (MelonHandler.Mods.Any(it => it.Assembly.GetName().Name == "AuthorableModifiers"))
            {
                var scoreVersion           = new Version(MelonHandler.Mods.First(it => it.Assembly.GetName().Name == "AuthorableModifiers").Info.Version);
                var lastUnsupportedVersion = new Version("1.2.4");
                var result = scoreVersion.CompareTo(lastUnsupportedVersion);
                if (result > 0)
                {
                    authorableInstalled = true;
                }
            }

            if (!SongBrowser.emptiedDownloadsFolder)
            {
                Utility.EmptyDownloadsFolder();
            }

            if (!isInitialized && MenuState.sState != MenuState.State.TitleScreen)
            {
                SongDownloader.StartNewSongSearch();
                PlaylistManager.OnApplicationStart();
                FilterPanel.OnApplicationStart();
                SongLoadingManager.StartSongListUpdate();
            }
        }
Exemplo n.º 5
0
        /// <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");
        }
Exemplo n.º 6
0
 private static void Postfix(MenuState __instance)
 {
     SongLoadingManager.UpdateUI();
 }
Exemplo n.º 7
0
 /// <summary>
 /// Register a callback that will be called after song list has been reloaded.
 /// </summary>
 public static void RegisterSongListPostProcessing(Action callback)
 {
     SongLoadingManager.AddPostProcessingCB(callback);
 }