public void TestOsuDb() { var db = new OsuDbAPI.OsuDbFile("Resources/osu!.db", byHash: true); CollectionAssert.AllItemsAreNotNull(db.Beatmaps.Select(b => b.Hash)); Assert.True(db.Beatmaps.All(b => db.BeatmapsByHash.ContainsKey(b.Hash))); Console.WriteLine(db.BeatmapsByHash.Count); }
public void TestStacking(string replayFile) { Replay r = new Replay(replayFile); var db = new OsuDbAPI.OsuDbFile("/home/will/osu!/osu!.db", byHash: true); Beatmap b = db.BeatmapsByHash[r.MapHash].Load("/home/will/A/osu!/Songs"); MissAnalyzer analyzer = new MissAnalyzer(r, b); Assert.AreEqual(0, analyzer.MissCount); // foreach(var m in analyzer.DrawAllMisses(new System.Drawing.Rectangle(0, 0, 320, 320))) // m.Save($"miss{Path.GetFileName(replayFile)}{i++}.png", ImageFormat.Png); }
public static Dictionary <string, Beatmap> processOsuDB(OsuDbAPI.OsuDbFile osuDB, string songsFolder) { Dictionary <string, Beatmap> dict = new Dictionary <string, Beatmap>(); foreach (OsuDbAPI.Beatmap dbBeatmap in osuDB.Beatmaps) { string beatmapPath = songsFolder + dbBeatmap.FolderName + "\\" + dbBeatmap.OsuFile; Beatmap map = new Beatmap(beatmapPath); dict.Add(map.BeatmapHash, map); } return(dict); }
public void TestSlider() { var db = new OsuDbAPI.OsuDbFile("/home/will/osu!/osu!.db", byId: true); Beatmap b = db.BeatmapsById[539697].Load("/home/will/A/osu!/Songs"); Replay r = new Replay("/home/will/osu!/Data/r/20b064985202e1a5219432c774476b8b-132562134499563000.osr"); MissAnalyzer analyzer = new MissAnalyzer(r, b); SliderObject s = (SliderObject)b.HitObjects[465]; Console.WriteLine(s); Console.WriteLine(string.Join(", ", s.Curves)); Console.WriteLine(string.Join(", ", s.Points)); Console.WriteLine(string.Join(", ", s.Curves.SelectMany(curve => curve.CurveSnapshots))); }
public void SetSettings(string[] settings) { MainForm.Path_OsuDb = settings[0]; MainForm.Path_Songs = settings[1]; MainForm.Path_Replays = settings[2]; if (Directory.Exists(MainForm.Path_Songs)) { if (MainForm.Path_Songs[MainForm.Path_Songs.Length - 1] != '\\') { MainForm.Path_Songs += '\\'; } if (File.Exists(MainForm.Path_OsuDb)) { try { this.OsuDbFile = new OsuDbAPI.OsuDbFile(MainForm.Path_OsuDb); } catch { MainForm.ErrorMessage("Could not load osu!.db. Try deleting it and letting osu! rebuild it when you relaunch the game."); } } else { MainForm.ErrorMessage("Path to osu!.db file does not exist. You will not be able to view beatmaps, only the cursor data."); } } else { MainForm.ErrorMessage("Path to songs folder does not exist. You will not be able to view beatmaps, only the cursor data."); } if (Directory.Exists(MainForm.Path_Replays)) { if (MainForm.Path_Replays[MainForm.Path_Replays.Length - 1] != '\\') { MainForm.Path_Replays += '\\'; } } }
public void LoadSettings() { FileStream stream = new FileStream(pathSettings, FileMode.Open); try { JavaProperties settings = new JavaProperties(); settings.Load(stream); pathSongs = settings.GetProperty("pathSongs"); pathReplays = settings.GetProperty("pathReplays"); pathOsuDB = settings.GetProperty("pathOsuDB"); Console.WriteLine(pathOsuDB); osuDbP = new OsuDbAPI.OsuDbFile(pathOsuDB); } catch (Exception exp) { Console.WriteLine("Error parsing settings:\n" + exp.ToString()); } finally { stream.Close(); } }