예제 #1
0
        /// <summary>
        /// Constructeur prenant en entree un fichier xml contenant les pistes stockes
        /// </summary>
        /// <param name="file"></param>
        public LocalPlaylist(string file)
        {
            LocalPlaylist playList = Read(file);

            Name         = playList.Name;
            Tracks       = playList.Tracks;
            CurrentIndex = 0;
        }
예제 #2
0
        /// <summary>
        /// permet de lire un  fichier xml contenant des pistes stockes
        /// </summary>
        /// <param name="file"></param>
        /// <returns>LocalPlaylist</returns>
        public static LocalPlaylist Read(string file)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(LocalPlaylist));
            LocalPlaylist playList   = new LocalPlaylist();

            using (StreamReader reader = new StreamReader(file))
            {
                playList = (LocalPlaylist)serializer.Deserialize(reader);
            }
            return(playList);
        }