Esempio n. 1
0
        private void treeView1_KeyDown(object sender, KeyEventArgs e)
        {
            //Console.WriteLine("---------");
            //Console.WriteLine(e.KeyValue);
            switch (e.KeyValue)
            {
            case 46:
                toggleDeleteState(treeView1.SelectedNode);
                break;

            case 8:
                toggleDeleteState(treeView1.SelectedNode);
                break;

            case 116:                    //F5 refresh
                OsuDB.cleanUp();
                CollectionDB.cleanUp();
                treeView1.Nodes.Clear();
                statusLabel.Text = "Refreshing Data...";
                runWorker();
                break;

            default:
                break;
            }
        }
Esempio n. 2
0
 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 =
         }
     }
 }
Esempio n. 3
0
 private void browseButton_Click(object sender, EventArgs e)
 {
     if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
     {
         bool   oldLastSuccess = lastLoadSuccess;
         string oldOsuFolder   = osuFolder;
         osuFolder = folderBrowserDialog1.SelectedPath + "\\";
         //Console.WriteLine("Folder selected: " + osuFolder);
         treeView1.Nodes.Clear();
         statusLabel.Text = "Loading new data...";
         OsuDB.cleanUp();
         CollectionDB.cleanUp();
         loadFiles();
         if (!lastLoadSuccess)
         {
             osuFolder       = oldOsuFolder;
             lastLoadSuccess = oldLastSuccess;
             MessageBox.Show("Going back to old path", "Reverting");
             statusLabel.Text = "Loading previous data...";
             treeView1.Nodes.Clear();
             runWorker();
         }
         else
         {
             populateForm();
             statusLabel.Text = "Loaded new osu! folder, osu.db has " + OsuDB.Songs.Count + " entries, " + CollectionDB.Collections.Count() + " collections loaded";
         }
         folderBrowserDialog1.SelectedPath = osuFolder;
         //Console.WriteLine(osuFolder);
     }
 }
Esempio n. 4
0
        private void loadFiles()
        {
            bool gotFiles = true;

            //pic is osu/data/bt/[setId]l.jpg

            if (File.Exists(osuFolder + "collection.db"))
            {
                CollectionDB.ReadCollectionDB();
            }
            else
            {
                gotFiles = false;
            }

            if (File.Exists(osuFolder + "osu!.db"))
            {
                OsuDB.ReadOsuDB(osuFolder + "osu!.db");
            }
            else
            {
                gotFiles = false;
            }

            if (!gotFiles)
            {
                MessageBox.Show("Could not find osu files, please select your osu path manually", "Oops!");
                lastLoadSuccess = false;
            }
            else
            {
                lastLoadSuccess = true;
            }
        }
Esempio n. 5
0
 /// <summary>
 ///     初始化Set的总方法,从文件读取或从osu!.db读取
 /// </summary>
 private static void Initset()
 {
     if (DBSupporter.LoadList() && (Allsets != null))
     {
         Initplaylist();
     }
     else
     {
         if (File.Exists(Path.Combine(Settings.Default.OSUpath, "osu!.db")))
         {
             try
             {
                 OsuDB.ReadDb(Path.Combine(Settings.Default.OSUpath, "osu!.db"));
             }
             catch (Exception)
             {
                 NotifySystem.Showtip(1000, LanguageManager.Get("OSUplayer"), "Fallback client detected, reloading...");
                 OsuDB.ReadDb(Path.Combine(Settings.Default.OSUpath, "osu!.db"), "fallback");
             }
         }
         Initplaylist();
         NotifySystem.Showtip(1000, LanguageManager.Get("OSUplayer"), string.Format(LanguageManager.Get("Core_Init_Finish_Text"), Allsets.Count));
         _needsave = true;
     }
     CurrentSet     = Allsets[PlayList[0]];
     CurrentBeatmap = CurrentSet.GetBeatmaps()[0];
     TmpSet         = CurrentSet;
     TmpBeatmap     = CurrentBeatmap;
 }
Esempio n. 6
0
        /// <summary>
        ///     初始化播放列表,初始时与Set一一对应
        /// </summary>
        private static void Initplaylist()
        {
            Collections.Clear();
            Collections.Add("Full", Allsets.Select(d => d.Value.GetHash()).ToList());
            PlayList.Sort(((a, b) => (Allsets[a].ArtistCompare(Allsets[b]))));
            var collectpath = Path.Combine(Settings.Default.OSUpath, "collection.db");

            if (File.Exists(collectpath))
            {
                OsuDB.ReadCollect(collectpath);
            }
        }
Esempio n. 7
0
        private void Main_File_Import_Scores_Click(object sender, EventArgs e)
        {
            Core.Scores.Clear();
            var scorepath = Path.Combine(Settings.Default.OSUpath, "scores.db");

            if (!File.Exists(scorepath))
            {
                return;
            }
            OsuDB.ReadScore(scorepath);
            Core.Scoresearched           = true;
            Main_File_Import_Scores.Text = LanguageManager.Get("Main_File_Re_Import_Scores_Text");
        }
Esempio n. 8
0
        private void populateForm()
        {
            //populate tree view

            //make and populate image list
            ImageList iconList = new ImageList();

            iconList.Images.Add(Properties.Resources.rankingXH);
            iconList.Images.Add(Properties.Resources.rankingSH);
            iconList.Images.Add(Properties.Resources.rankingX);
            iconList.Images.Add(Properties.Resources.rankingS);
            iconList.Images.Add(Properties.Resources.rankingA);
            iconList.Images.Add(Properties.Resources.rankingB);
            iconList.Images.Add(Properties.Resources.rankingC);
            iconList.Images.Add(Properties.Resources.rankingD);
            iconList.Images.Add(Properties.Resources.dots);
            //iconList.Images.Add(Properties.Resources.blank);

            treeView1.ImageList          = iconList;
            treeView1.ImageIndex         = 8;
            treeView1.SelectedImageIndex = 8;

            //for every collection create the child nodes then add them to the collection parent node

            for (int c = 0; c < CollectionDB.Collections.Length; c++)
            {
                List <TreeNode> nodeData = new List <TreeNode>();
                for (int h = 0; h < CollectionDB.Collections[c].hashes.Length; h++)                //add child nodes
                {
                    if (OsuDB.songExists(CollectionDB.Collections[c].hashes[h]))
                    {
                        if (OsuDB.getSong(CollectionDB.Collections[c].hashes[h]).gradeStandard < 8)                        //between 0 and 7?
                        {
                            nodeData.Add(new TreeNode(OsuDB.getSong(CollectionDB.Collections[c].hashes[h]).artistName + " - " + OsuDB.getSong(CollectionDB.Collections[c].hashes[h]).songTitle + "[" + OsuDB.getSong(CollectionDB.Collections[c].hashes[h]).difficulty + "]", OsuDB.getSong(CollectionDB.Collections[c].hashes[h]).gradeStandard, OsuDB.getSong(CollectionDB.Collections[c].hashes[h]).gradeStandard));
                        }
                        else
                        {
                            nodeData.Add(new TreeNode(OsuDB.getSong(CollectionDB.Collections[c].hashes[h]).artistName + " - " + OsuDB.getSong(CollectionDB.Collections[c].hashes[h]).songTitle + "[" + OsuDB.getSong(CollectionDB.Collections[c].hashes[h]).difficulty + "]", 8, 8));
                        }
                        nodeData[nodeData.Count - 1].Tag = new MapHash(c, h, CollectionDB.Collections[c].hashes[h], CollectionDB.Collections[c].alivehash[h]);
                    }
                    //nodeData[nodeData.Count - 1].ImageIndex = OsuDB.getSong(CollectionDB.Collections[c].hashes[h]).gradeStandard;
                }
                //add collection nodes
                TreeNode treenode = new TreeNode(CollectionDB.Collections[c].name, nodeData.ToArray());
                treeView1.Nodes.Add(treenode);
            }
        }
Esempio n. 9
0
        public async Task Open()
        {
            await OsuDB.Open();

            await GuildDB.Open();
        }
Esempio n. 10
0
        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);
        }