Beispiel #1
0
        private void ChangeDirButton_Click(object sender, EventArgs e)
        {
            Osu temp = SetNewOsuDirectory();

            if (temp != null)
            {
                osu = temp;
                EnableGUI();
            }
        }
Beispiel #2
0
        private void InitialiseGameInfo()
        {
            if (!File.Exists(dataFile))
            {
                MessageBox.Show("No osu! directory selected. Please locate osu! directory."
                                , "Information"
                                , MessageBoxButtons.OK
                                , MessageBoxIcon.Information);
                osu = SetNewOsuDirectory();
            }
            else
            {
                FileStream   file    = new FileStream(dataFile, FileMode.Open, FileAccess.Read);
                StreamReader reader  = new StreamReader(file);
                string       execdir = reader.ReadLine();
                if (execdir != null && File.Exists(execdir.Trim()))
                {
                    osu = new Osu(execdir.Trim());
                    string nextLine = reader.ReadLine();
                    while (nextLine != null)
                    {
                        string songFolderName = nextLine.Trim();
                        string songPath       = Path.Combine(osu.SongDirectory, songFolderName);

                        nextLine = reader.ReadLine().Trim();
                        string[] bgNamesList = { };
                        if (nextLine != "")
                        {
                            bgNamesList = nextLine.Split('\t');
                        }

                        if (Directory.Exists(songPath))
                        {
                            Song song = new Song(songPath, bgNamesList);
                            osu.AppendSong(song);
                        }
                        nextLine = reader.ReadLine();
                    }
                    osu.UpdateSongList();
                }
                else
                {
                    MessageBox.Show("osu! directory invalid. Please locate osu! directory again."
                                    , "Warning"
                                    , MessageBoxButtons.OK
                                    , MessageBoxIcon.Information);

                    osu = SetNewOsuDirectory();
                }
                reader.Close();
            }
            EnableGUI();
        }
Beispiel #3
0
        private Osu SetNewOsuDirectory()
        {
            OpenFileDialog fileDialog = new OpenFileDialog
            {
                InitialDirectory = "C:\\",
                Filter           = "osu! Executable|osu!.exe",
                FilterIndex      = 1
            };

            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                Osu temp = new Osu(fileDialog.FileName);
                temp.GenerateSongList();
                return(temp);
            }

            else
            {
                return(null);
            }
        }