예제 #1
0
 public static OsuView getInstance(String path)
 {
     if (_osuView == null)
     {
         _osuView = new OsuView(path);
     }
     return(_osuView);
 }
예제 #2
0
        private void LoadLists()
        {
            if (!Directory.Exists(dataPath))
            {
                Directory.CreateDirectory(dataPath);
            }
            IEnumerable <string> files = Directory.GetFiles(dataPath).Where(s => s.EndsWith(".xml"));

            foreach (string file in files)
            {
                StreamReader sr = File.OpenText(file);
                if (sr.ReadLine() == OsuPlaylist.Header)
                {
                    OsuPlaylist tmp = new OsuPlaylist(sr.ReadLine());
                    while (!sr.EndOfStream)
                    {
                        string s = sr.ReadLine();
                        if (s == "")
                        {
                            continue;
                        }
                        OsuSong os = OsuView.getInstance().getOsuSongByID(s);
                        if (os != null)
                        {
                            tmp.Items.Add(os);
                        }
                        else
                        {
                            tmp.Items.Add(new OsuSong(s));
                        }
                    }

                    Playlists.Add(tmp);
                }
                sr.Close();
            }
            UpdatePlaylists();
        }