private void OnProfileDataFinished(List <SongPage> pages) { Logger.log.Debug("Finished collecting data - processing now"); DownloadProgress.instance.DownloadFinished(); Destroy(_profileDownloader); _lastUpdateTime = DateTime.Now; if (songDataInfo.Count > 0) { songDataInfo = new Dictionary <SongID, SongData>(); } // Update dict with all of the info foreach (SongPage songPage in pages) { foreach (ProfileData data in songPage.scores) { string id = data.songHash; double acc = (double)data.score / (double)data.maxScore; acc = acc.Equals(Double.PositiveInfinity) ? 1 : acc; double pp = data.pp; double weight = data.weight; int diff = data.difficulty; try { ScoreSaberUtils.GetDifficulty(diff); songDataInfo[new SongID(id, ScoreSaberUtils.GetDifficulty(diff))] = new SongData(acc, pp, weight); } // Ignore for now - will need to come up with a fix for this catch (ArgumentException) { Logger.log.Debug($"Difficulty not accounted for: {diff} on song {id}"); } } } CalculateSums(); SaveSongData(); }
public SongID(string id, string difficulty) { this.id = id; this.difficulty = ScoreSaberUtils.GetDifficulty(difficulty); }