public static Beatmaps FetchFromApi(ICheesegullConfig cfg, string fileMd5, int beatmapId = -1) { var cg = new Cheesegull(cfg); if (!string.IsNullOrEmpty(fileMd5)) { cg.SetBM(fileMd5); } else if (beatmapId != -1) { cg.SetBM(beatmapId); } var bmSet = cg.GetSets(); if (bmSet.Count == 0) { return(null); } var bm = bmSet[0].ChildrenBeatmaps.FirstOrDefault(x => x.FileMD5 == fileMd5 || x.BeatmapID == beatmapId); if (string.IsNullOrEmpty(bm.FileMD5)) { return(null); } var b = new Beatmaps { Ar = bm.AR, Artist = bmSet[0].Artist, Bpm = bm.BPM, Cs = bm.CS, Difficulty = bm.DifficultyRating, Hp = bm.HP, Id = bm.BeatmapID, Od = bm.OD, Tags = bmSet[0].Tags, Title = bmSet[0].Title, BeatmapCreator = bmSet[0].Creator, BeatmapCreatorId = -1, // -1 because we do not own this beatmap. DifficultyName = bm.DiffName, HitLength = bm.HitLength, LastUpdate = DateTime.Now, PassCount = 0, PlayCount = 0, PlayMode = bm.Mode, RankedDate = Convert.ToDateTime(bmSet[0].ApprovedDate), RankedStatus = Fixer.FixRankedStatus((Cheesegull.RankedStatus)bmSet[0].RankedStatus), TotalLength = bm.TotalLength, BeatmapSetId = bm.ParentSetID, FileMd5 = bm.FileMD5 }; return(b); }
private string ScoreboardHeader() { if (_bm != null && _parent != null) { return($"{(int) Fixer.FixRankedStatus(_parent.RankedStatus)}|false|" + $"{_bm.BeatmapID}|" + $"{_bm.ParentSetID}|" + $"{_scores.Count}\n" + "0\n" + $"{_parent.Artist} - {_parent.Title} [{_bm.DiffName}]\n" + "10.0\n"); } return($"{(int) RankedStatus.NeedUpdate}|false|" + "-1|" + "-1|" + "-1\n" + "0\n" + "Unknown\n" + "0\n"); }