Exemplo n.º 1
0
        public static ChildrenBeatmap FromBeatmapInfo(BeatmapInfo info, BeatmapSetOnlineInfo setOnlineInfo, BeatmapSet parent = null)
        {
            if (info == null)
            {
                return(null);
            }

            var cb = new ChildrenBeatmap
            {
                BeatmapId        = info.OnlineBeatmapID ?? -1,
                ParentSetId      = info.BeatmapSetInfoID,
                Parent           = parent,
                DiffName         = info.Version,
                FileMd5          = info.MD5Hash,
                Mode             = (PlayMode)info.RulesetID,
                Ar               = info.BaseDifficulty.ApproachRate,
                Od               = info.BaseDifficulty.OverallDifficulty,
                Cs               = info.BaseDifficulty.CircleSize,
                Hp               = info.BaseDifficulty.DrainRate,
                TotalLength      = (int)info.OnlineInfo.Length,
                HitLength        = (int)info.StackLeniency,
                Playcount        = info.OnlineInfo.PassCount,
                Bpm              = setOnlineInfo.BPM,
                MaxCombo         = info.OnlineInfo.CircleCount,
                DifficultyRating = info.StarDifficulty
            };

            return(cb);
        }
Exemplo n.º 2
0
        public static BeatmapSet FromBeatmapSetInfo(BeatmapSetInfo info)
        {
            if (info?.Beatmaps == null)
            {
                return(null);
            }

            var beatmapSet = new BeatmapSet
            {
                SetId            = info.OnlineBeatmapSetID ?? -1,
                RankedStatus     = info.Status,
                ApprovedDate     = info.OnlineInfo.Ranked?.DateTime,
                LastUpdate       = info.OnlineInfo.LastUpdated?.DateTime,
                LastChecked      = DateTime.Now,
                Artist           = info.Metadata.Artist,
                Title            = info.Metadata.Title,
                Creator          = info.Metadata.Author.Username,
                Source           = info.Metadata.Source,
                Tags             = info.Metadata.Tags,
                HasVideo         = info.OnlineInfo.HasVideo,
                ChildrenBeatmaps = new List <ChildrenBeatmap>(),
                // Obsolete!
                Genre    = Genre.Any,
                Language = Language.Any
            };

            foreach (var map in info.Beatmaps)
            {
                beatmapSet.ChildrenBeatmaps.Add(ChildrenBeatmap.FromBeatmapInfo(map, info.OnlineInfo, beatmapSet));
            }

            return(beatmapSet);
        }
Exemplo n.º 3
0
        public static ChildrenBeatmap FromBeatmapInfo(BeatmapInfo info, BeatmapSetOnlineInfo setOnlineInfo,
                                                      BeatmapSet parent = null)
        {
            if (info == null)
            {
                return(null);
            }

            var cb = new ChildrenBeatmap
            {
                BeatmapId        = info.OnlineBeatmapID ?? -1,
                ParentSetId      = info.BeatmapSetInfoID,
                Parent           = parent,
                DiffName         = info.Version,
                FileMd5          = info.MD5Hash,
                File             = $"{parent.Artist} - {parent.Title} ({parent.Creator}) [{info.Version}].osu",
                Mode             = (PlayMode)(info.Ruleset?.ID ?? (int)PlayMode.Default),
                Ar               = info.BaseDifficulty.ApproachRate,
                Od               = info.BaseDifficulty.OverallDifficulty,
                Cs               = info.BaseDifficulty.CircleSize,
                Hp               = info.BaseDifficulty.DrainRate,
                TotalLength      = info.OnlineInfo.CircleCount + info.OnlineInfo.SliderCount,
                HitLength        = (int)info.StackLeniency,
                Playcount        = info.OnlineInfo.PassCount,
                Bpm              = setOnlineInfo.BPM,
                MaxCombo         = info.OnlineInfo.CircleCount,
                DifficultyRating = info.StarDifficulty
            };

            return(cb);
        }