コード例 #1
0
 private IEnumerable <OsuDatabaseBeatmapStarRating> ReadStarRatings(OsuDatabaseBeatmap beatmap)
 {
     return(ReadSingleModeRatings(beatmap, OsuGameRuleSet.Standard)
            .Concat(ReadSingleModeRatings(beatmap, OsuGameRuleSet.Taiko))
            .Concat(ReadSingleModeRatings(beatmap, OsuGameRuleSet.Catch))
            .Concat(ReadSingleModeRatings(beatmap, OsuGameRuleSet.Mania)));
 }
コード例 #2
0
 private IEnumerable <OsuDatabaseTimings> ReadBeatmapTimings(OsuDatabaseBeatmap beatmap)
 {
     for (int i = 0; i < beatmap.TimingPointCount; i++)
     {
         yield return(new OsuDatabaseTimings()
         {
             BeatPreMinute = Reader.ReadDouble(),
             Offset = Reader.ReadDouble(),
             Inherited = Reader.ReadBoolean(),
             OsuDatabaseBeatmap = beatmap,
         });
     }
 }
コード例 #3
0
 private IEnumerable <OsuDatabaseBeatmapStarRating> ReadSingleModeRatings(OsuDatabaseBeatmap beatmap, OsuGameRuleSet ruleSet)
 {
     foreach (var(moderator, rate) in Reader.ReadDictionary <OsuGameModerator, double>())
     {
         yield return(new OsuDatabaseBeatmapStarRating()
         {
             Moderators = moderator,
             OsuDatabaseBeatmap = beatmap,
             RuleSet = ruleSet,
             StarRating = rate,
         });
     }
 }
コード例 #4
0
        private IEnumerable <OsuDatabaseBeatmap> ReadBeatmap(OsuDatabase db)
        {
            for (int i = 0; i < db.BeatmapCount; i++)
            {
                var beatmap = new OsuDatabaseBeatmap();
                if (db.Version < 20191106)
                {
                    beatmap.BytesOfBeatmapEntry = Reader.ReadInt32();
                }
                beatmap.Artist            = Reader.ReadOsuString();
                beatmap.ArtistUnicode     = Reader.ReadOsuString();
                beatmap.Title             = Reader.ReadOsuString();
                beatmap.TitleUnicode      = Reader.ReadOsuString();
                beatmap.Creator           = Reader.ReadOsuString();
                beatmap.Difficult         = Reader.ReadOsuString();
                beatmap.AudioFileName     = Reader.ReadOsuString();
                beatmap.MD5Hash           = Reader.ReadOsuString();
                beatmap.FileName          = Reader.ReadOsuString();
                beatmap.RankStatus        = (OsuGameBeatmapRankStatus)Reader.ReadByte();
                beatmap.CircleCount       = Reader.ReadInt16();
                beatmap.SliderCount       = Reader.ReadInt16();
                beatmap.SpinnerCount      = Reader.ReadInt16();
                beatmap.LatestModifiedAt  = Reader.ReadDateTime();
                beatmap.ApproachRate      = db.Version >= 20140609 ? Reader.ReadSingle() : Reader.ReadByte();
                beatmap.CircleSize        = db.Version >= 20140609 ? Reader.ReadSingle() : Reader.ReadByte();
                beatmap.HPDrain           = db.Version >= 20140609 ? Reader.ReadSingle() : Reader.ReadByte();
                beatmap.OverallDifficulty = db.Version >= 20140609 ? Reader.ReadSingle() : Reader.ReadByte();
                beatmap.SliderVelocity    = Reader.ReadDouble();
                if (db.Version >= 20140609)
                {
                    beatmap.StarRatings = ReadStarRatings(beatmap).ToList();
                }
                beatmap.DrainTime              = Reader.ReadInt32();
                beatmap.TotalTime              = Reader.ReadInt32();
                beatmap.AudioPreviewTime       = Reader.ReadInt32();
                beatmap.TimingPointCount       = Reader.ReadInt32();
                beatmap.OsuDatabaseTimings     = ReadBeatmapTimings(beatmap).ToList();
                beatmap.BeatmapId              = Reader.ReadInt32();
                beatmap.BeatmapSetId           = Reader.ReadInt32();
                beatmap.ThreadId               = Reader.ReadInt32();
                beatmap.StandardRankRating     = (OsuGameRankRating)Reader.ReadByte();
                beatmap.TaikoRankRating        = (OsuGameRankRating)Reader.ReadByte();
                beatmap.CatchTheBeatRankRating = (OsuGameRankRating)Reader.ReadByte();
                beatmap.ManiaRankRating        = (OsuGameRankRating)Reader.ReadByte();
                beatmap.LocalOffset            = Reader.ReadInt16();
                beatmap.StackLeniency          = Reader.ReadSingle();
                beatmap.RuleSet             = (OsuGameRuleSet)Reader.ReadByte();
                beatmap.Source              = Reader.ReadOsuString();
                beatmap.Tags                = Reader.ReadOsuString();
                beatmap.OnlineOffset        = Reader.ReadInt16();
                beatmap.TitleFont           = Reader.ReadOsuString();
                beatmap.NotPlayed           = Reader.ReadBoolean();
                beatmap.LatestPlayedAt      = Reader.ReadDateTime();
                beatmap.IsOsz2              = Reader.ReadBoolean();
                beatmap.FolderName          = Reader.ReadOsuString();
                beatmap.LatestPlayedAt      = Reader.ReadDateTime();
                beatmap.BeatmapSoundIgnored = Reader.ReadBoolean();
                beatmap.BeatmapSkinIgnored  = Reader.ReadBoolean();
                beatmap.StoryboardDisabled  = Reader.ReadBoolean();
                beatmap.VideoDisabled       = Reader.ReadBoolean();
                beatmap.VisualOverrided     = Reader.ReadBoolean();
                if (db.Version < 20140609)
                {
                    Reader.BaseStream.Seek(sizeof(short), SeekOrigin.Current);
                }
                Reader.BaseStream.Seek(sizeof(int), SeekOrigin.Current);
                beatmap.ManiaScrollSpeed = Reader.ReadByte();

                yield return(beatmap);
            }
        }