示例#1
0
        public void AddSongs(PlatformData data, ProgressIndicator progress)
        {
            if (Root == null)
            {
                return;
            }

            foreach (XmlNode node in Root.GetElementsByTagName("addsong"))
            {
                XmlElement element = node as XmlElement;

                if (element.Attributes["game"] != null && int.Parse(element.Attributes["game"].Value) != (int)data.Game)
                {
                    continue;
                }

                SongData song = new SongData(data);
                if (element.Attributes["id"] != null)
                {
                    song.ID = element.Attributes["id"].Value;
                }
                song.PopulateFromXML(element, RootPath);
                data.Platform.AddSong(data, song, progress);
            }

            data.Mutex.WaitOne();
            IList <FormatData> songs = data.Songs;

            foreach (XmlNode node in Root.GetElementsByTagName("deletesong"))
            {
                XmlElement element = node as XmlElement;

                if (element.Attributes["game"] != null && int.Parse(element.Attributes["game"].Value) != (int)data.Game)
                {
                    continue;
                }

                if (element.Attributes["id"] != null)
                {
                    foreach (FormatData song in songs.Where(f => string.Compare(f.Song.ID, element.Attributes["id"].Value, true) == 0).ToList())
                    {
                        data.RemoveSong(song);
                    }
                }

                if (element.Attributes["name"] != null)
                {
                    foreach (FormatData song in songs.Where(f => string.Compare(f.Song.Name, element.Attributes["name"].Value, true) == 0).ToList())
                    {
                        data.RemoveSong(song);
                    }
                }
            }
            data.Mutex.ReleaseMutex();
        }
示例#2
0
 public virtual void DeleteSong(PlatformData data, FormatData formatdata, ProgressIndicator progress)
 {
     data.Mutex.WaitOne(); formatdata.Dispose(); data.RemoveSong(formatdata); data.Mutex.ReleaseMutex();
 }