예제 #1
0
        public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false)
        {
            var beatmapSetInfo = Query <BeatmapSetInfo>().FirstOrDefault(s => s.ID == beatmapInfo.BeatmapSetInfoID);

            if (beatmapSetInfo == null)
            {
                throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");
            }

            //we need metadata
            GetChildren(beatmapSetInfo);
            //we also need a ruleset
            GetChildren(beatmapInfo);

            if (beatmapInfo.Metadata == null)
            {
                beatmapInfo.Metadata = beatmapSetInfo.Metadata;
            }

            WorkingBeatmap working = new DatabaseWorkingBeatmap(this, beatmapInfo, beatmapSetInfo, withStoryboard);

            previous?.TransferTo(working);

            return(working);
        }
예제 #2
0
        public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false)
        {
            if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
            {
                return(DefaultBeatmap);
            }

            if (beatmapInfo.BeatmapSet == null || beatmapInfo.Ruleset == null)
            {
                beatmapInfo = GetChildren(beatmapInfo, true);
            }

            if (beatmapInfo.BeatmapSet == null)
            {
                throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");
            }

            if (beatmapInfo.Metadata == null)
            {
                beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
            }

            WorkingBeatmap working = new DatabaseWorkingBeatmap(this, beatmapInfo);

            previous?.TransferTo(working);

            return(working);
        }