示例#1
0
        /// <summary>
        /// Attempts to find a SongInfo matching the provided SongInfoEnhanced.
        /// It creates a new SongInfo, attaches the provided SongInfoEnhanced, and adds it to the ScrapedData if no match is found.
        /// </summary>
        /// <param name="song"></param>
        /// <param name="searchOnline"></param>
        /// <returns></returns>
        public static SongInfo GetOrCreateSong(BeatSaverSong song)//, bool searchOnline = true)
        {
            bool foundOnline = TryGetSongByHash(song.hash, out SongInfo songInfo, false);

            //if (foundOnline)
            //
            BeatSaverSongs.AddOrUpdate(song);
            //}
            if (songInfo == null)
            {
                songInfo = new SongInfo(song.hash);
                TryAddToScrapedData(songInfo);
            }
            songInfo.BeatSaverInfo = song;
            return(songInfo);
        }
示例#2
0
        public static SongInfo GetOrCreateSong(ScoreSaberSong song, bool searchOnline = true)
        {
            bool foundOnline = TryGetSongByHash(song.hash, out SongInfo songInfo, searchOnline);

            if (foundOnline)
            {
                BeatSaverSongs.AddOrUpdate(songInfo.BeatSaverInfo);
            }
            ScoreSaberSongs.AddOrUpdate(song);
            if (songInfo == null)
            {
                songInfo = song.GenerateSongInfo();
                TryAddToScrapedData(songInfo);
            }
            songInfo.ScoreSaberInfo.AddOrUpdate(song.uid, song);
            return(songInfo);
        }