internal static void GetOnlineBeatmapInfo() { lock (BeatmapRequestLock) { if (BeatmapInfoRequestList != null) { return; } bBeatmapInfoRequest req = new bBeatmapInfoRequest(); BeatmapInfoRequestList = new List <Beatmap>(); BeatmapInfoRequestList.AddRange(BeatmapAvailable); BeatmapInfoRequestList.RemoveAll(b => b.BeatmapChecksum == null); int count = BeatmapInfoRequestList.Count; for (int i = 0; i < count; i++) { req.filenames.Add(Path.GetFileName(BeatmapInfoRequestList[i].Filename)); } Console.WriteLine("Requested details for " + req.filenames.Count + " beatmaps"); BanchoClient.SendRequest(RequestType.Osu_BeatmapInfoRequest, req); } }
private static void getOnlineBeatmapInfoForQueued() { if (BeatmapInfoSendListAll == null) { return; } if (GameBase.Mode == OsuModes.Play) { //delay if playing GameBase.Scheduler.AddDelayed(getOnlineBeatmapInfoForQueued, 4000); return; } // i351: Allocate maps_per_request of each to eat slightly more memory to avoid // having to grow the list possibly many times as it iterates. bBeatmapInfoRequest req = new bBeatmapInfoRequest(maps_per_request, maps_per_request); int count = BeatmapInfoSendListAll.Count; if (count < maps_per_request) { BeatmapInfoSendListPartial = new List <Beatmap>(BeatmapInfoSendListAll); BeatmapInfoSendListAll = null; } else { // i351: Pull entries from the end of the list to avoid a linear-time shift every pull. BeatmapInfoSendListPartial = new List <Beatmap>(BeatmapInfoSendListAll.GetRange(count - maps_per_request, maps_per_request)); BeatmapInfoSendListAll.RemoveRange(count - maps_per_request, maps_per_request); } // BeatmapIds from the .osu files are often _wrong_. Until this is somehow fixed don't use them for info retrieval. foreach (Beatmap b in BeatmapInfoSendListPartial) { /*if (b.BeatmapId > 0) * { * req.ids.Add(b.BeatmapId); * } * else*/ { string filename = Path.GetFileName(b.Filename); if (!string.IsNullOrEmpty(filename)) { req.filenames.Add(filename); } } } //BeatmapInfoSendListPartial.RemoveAll(b => b.BeatmapId > 0); //don't use these when receiving data back. Debug.Print("Requested details for " + req.filenames.Count + " (filename) plus " + req.ids.Count + " (beatmap_id) beatmaps..."); BanchoClient.SendRequest(RequestType.Osu_BeatmapInfoRequest, req); }