Esempio n. 1
0
 public CPlaylistSong(CPlaylistSong ps)
 {
     SongID = ps.SongID;
     GameMode = ps.GameMode;
 }
Esempio n. 2
0
        public void SongInsert(int DestNr, int SongID, EGameMode gm)
        {
            if (DestNr < 0 || DestNr > Songs.Count - 1)
                return;

            CPlaylistSong ps = new CPlaylistSong(SongID, gm);
            Songs.Insert(DestNr, ps);
        }
Esempio n. 3
0
        public void SongMove(int SourceNr, int DestNr)
        {
            if (SourceNr < 0 || DestNr < 0 || SourceNr == DestNr || SourceNr > Songs.Count - 1 || DestNr > Songs.Count - 1)
                return;

            CPlaylistSong ps = new CPlaylistSong(Songs[SourceNr]);
            Songs.RemoveAt(SourceNr);
            Songs.Insert(DestNr, ps);
        }
Esempio n. 4
0
        public void AddSong(int SongID, EGameMode gm)
        {
            CPlaylistSong song = new CPlaylistSong();
            song.SongID = SongID;
            song.GameMode = gm;

            Songs.Add(song);   
        }
Esempio n. 5
0
        public void AddSong(int SongID)
        {
            CPlaylistSong song = new CPlaylistSong();
            song.SongID = SongID;
            if (CSongs.GetSong(SongID).IsDuet)
                song.GameMode = EGameMode.TR_GAMEMODE_DUET;
            else
                song.GameMode = EGameMode.TR_GAMEMODE_NORMAL;

            Songs.Add(song);            
        }
Esempio n. 6
0
        private void LoadPlaylist()
        {
            bool loaded = false;
            XPathDocument xPathDoc = null;
            XPathNavigator navigator = null;

            try
            {
                xPathDoc = new XPathDocument(PlaylistFile);
                navigator = xPathDoc.CreateNavigator();
                loaded = true;
            }
            catch (Exception e)
            {
                loaded = false;
                if (navigator != null)
                    navigator = null;

                if (xPathDoc != null)
                    xPathDoc = null;

                CLog.LogError("Error opening Playlist File " + PlaylistFile + ": " + e.Message);
            }

            if (loaded)
            {
                string value = String.Empty;
                if (CHelper.GetValueFromXML("//root/Info/PlaylistName", navigator, ref value, value))
                {
                    PlaylistName = value;

                    Songs = new List<CPlaylistSong>();

                    List<string> songs = CHelper.GetValuesFromXML("Songs", navigator);
                    string artist = String.Empty;
                    string title = String.Empty;
                    EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;

                    for (int i = 0; i < songs.Count; i++)
                    {
                        CHelper.GetValueFromXML("//root/Songs/" + songs[i] + "/Artist", navigator, ref artist, String.Empty);
                        CHelper.GetValueFromXML("//root/Songs/" + songs[i] + "/Title", navigator, ref title, String.Empty);
                        CHelper.TryGetEnumValueFromXML<EGameMode>("//root/Songs/" + songs[i] + "/GameMode", navigator, ref gm);

                        CPlaylistSong song = new CPlaylistSong();
                        song.SongID = -1;
                        CSong[] AllSongs = CSongs.AllSongs;

                        for (int s = 0; s < AllSongs.Length; s++)
                        {
                            if (AllSongs[s].Artist == artist && AllSongs[s].Title == title)
                            {
                                song.SongID = AllSongs[s].ID;
                                break;
                            }
                        }

                        if (song.SongID != -1)
                        {
                            song.GameMode = gm;
                            Songs.Add(song);
                        }
                        else
                        {
                            CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + PlaylistFile);
                        }
                    }
                }
                else
                {
                    CLog.LogError("Can't find PlaylistName in Playlist File: " + PlaylistFile);
                }
            }
        }