private void toggleDeleteState(TreeNode node) { //mark entry for deletion //get song if (node.Tag != null) { MapHash tag = (MapHash)node.Tag; string hash = tag.hash; if (OsuDB.songExists(hash)) { //flip the alive state CollectionDB.setAlive(tag, !tag.alive); //set the text to red or black if (tag.alive) { node.ForeColor = Color.Black; } else { node.ForeColor = Color.Red; } //node.ForeColor = } } }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { //different thing selected? update info box TreeNode node = e.Node; if (node.Tag != null) { MapHash tag = (MapHash)node.Tag; string hash = tag.hash; //Console.WriteLine("Hash is" + hash); if (OsuDB.songExists(hash)) { Song cursong = OsuDB.getSong(hash); mapperLabel.Text = "Mapped by: " + cursong.creatorName; arLabel.Text = "AR: " + cursong.ar.ToString(); csLabel.Text = "CS: " + cursong.cs.ToString(); odLabel.Text = "OD: " + cursong.od.ToString(); idLabel.Text = "ID: " + cursong.beatmapID + " (D)"; if (cursong.starRating > 0) { if (cursong.starRating.ToString().Length > 4) { starsLabel.Text = "Stars: " + cursong.starRating.ToString().Substring(0, 4); } else { starsLabel.Text = "Stars: " + cursong.starRating.ToString(); } } else { starsLabel.Text = "Stars: N/A"; } for (int l = idLabel.Links.Count - 1; l > -1; l--) { idLabel.Links.RemoveAt(l); } idLabel.Links.Add(4, cursong.beatmapID.ToString().Length, "https://osu.ppy.sh/b/" + cursong.beatmapID); idLabel.Links.Add(5 + cursong.beatmapID.ToString().Length, 3, "osu://b/" + cursong.beatmapID); if (File.Exists(osuFolder + "data\\bt\\" + cursong.beatmapSetID + "l.jpg")) { pictureBox1.ImageLocation = osuFolder + "data\\bt\\" + cursong.beatmapSetID + "l.jpg"; } else if (File.Exists(osuFolder + "data\\bt\\" + cursong.beatmapSetID + ".jpg")) { pictureBox1.ImageLocation = osuFolder + "data\\bt\\" + cursong.beatmapSetID + ".jpg"; } else { pictureBox1.ImageLocation = null; } //set ranking picturebox //Console.WriteLine(cursong.gradeStandard); if (cursong.gradeStandard < 8) { label1.Visible = true; } switch (cursong.gradeStandard) { case 0: pictureBox2.Image = Properties.Resources.rankingXH; break; case 1: pictureBox2.Image = Properties.Resources.rankingSH; break; case 2: pictureBox2.Image = Properties.Resources.rankingX; break; case 3: pictureBox2.Image = Properties.Resources.rankingS; break; case 4: pictureBox2.Image = Properties.Resources.rankingA; break; case 5: pictureBox2.Image = Properties.Resources.rankingB; break; case 6: pictureBox2.Image = Properties.Resources.rankingC; break; case 7: pictureBox2.Image = Properties.Resources.rankingD; break; default: pictureBox2.Image = null; label1.Visible = false; pictureBox2.Update(); break; } } } //Console.WriteLine(node.Tag); }