示例#1
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == typeof(string))
     {
         return(((SongID)value).id + "," + ScoreSaberUtils.GetDifficultyAsString(((SongID)value).difficulty));
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
示例#2
0
        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();
        }
示例#3
0
 public SongID(string id, string difficulty)
 {
     this.id         = id;
     this.difficulty = ScoreSaberUtils.GetDifficulty(difficulty);
 }