コード例 #1
0
ファイル: XmlLibrary.cs プロジェクト: radtek/iTSfv
        /// <summary>
        /// Method to add a track to Player
        /// </summary>
        /// <param name="track"></param>
        private void AddTrack(XmlTrack track)
        {
            string albumName = track.AlbumArtist;

            if (string.IsNullOrEmpty(albumName))
            {
                albumName = Path.GetFileName(Path.GetDirectoryName(track.Location));
            }

            XmlAlbumArtist tempBand = GetBand(albumName);

            if (tempBand == null)
            {
                tempBand = new XmlAlbumArtist(albumName);
                Library.Add(tempBand.Name, tempBand);
                AlbumArtists.Add(tempBand);
            }

            XmlAlbum tempAlbum = tempBand.GetAlbum(track.GetAlbumKey());

            if (tempAlbum == null)
            {
                tempAlbum = new XmlAlbum(track.GetAlbumKey());
                Library[albumName].AddAlbum(tempAlbum);
                Albums.Add(tempAlbum);
            }

            XmlDisc tempDisc = tempAlbum.GetDisc(track.GetDiscKey());

            if (tempDisc == null)
            {
                tempDisc = new XmlDisc(track.GetDiscKey());
                Library[albumName].GetAlbum(track.GetAlbumKey()).AddDisc(tempDisc);
                Discs.Add(tempDisc);
            }

            if (Library[albumName].GetAlbum(track.GetAlbumKey()).GetDisc(track.GetDiscKey()).AddTrack(track))
            {
                Tracks.Add(track);
            }
        }
コード例 #2
0
ファイル: XmlDisc.cs プロジェクト: radtek/iTSfv
        public bool AddTrack(XmlTrack track)
        {
            bool success = false;

            if (!HasTrack(track))
            {
                Tracks.Add(track);

                if (DiscNumber == 0)
                {
                    this.DiscNumber = Math.Max(track.DiscNumber, 1);
                }

                if (string.IsNullOrEmpty(Key))
                {
                    this.Key = track.GetDiscKey();
                }

                success = true;
            }

            return(success);
        }
コード例 #3
0
ファイル: XmlLibrary.cs プロジェクト: OriginalCliff/itsfv
        /// <summary>
        /// Method to add a track to Player
        /// </summary>
        /// <param name="track"></param>
        private void AddTrack(XmlTrack track)
        {
            string albumName = track.AlbumArtist;
            if (string.IsNullOrEmpty(albumName))
                albumName = Path.GetFileName(Path.GetDirectoryName(track.Location));

            XmlAlbumArtist tempBand = GetBand(albumName);
            if (tempBand == null)
            {
                tempBand = new XmlAlbumArtist(albumName);
                Library.Add(tempBand.Name, tempBand);
                AlbumArtists.Add(tempBand);
            }

            XmlAlbum tempAlbum = tempBand.GetAlbum(track.GetAlbumKey());
            if (tempAlbum == null)
            {
                tempAlbum = new XmlAlbum(track.GetAlbumKey());
                Library[albumName].AddAlbum(tempAlbum);
                Albums.Add(tempAlbum);
            }

            XmlDisc tempDisc = tempAlbum.GetDisc(track.GetDiscKey());
            if (tempDisc == null)
            {
                tempDisc = new XmlDisc(track.GetDiscKey());
                Library[albumName].GetAlbum(track.GetAlbumKey()).AddDisc(tempDisc);
                Discs.Add(tempDisc);
            }

            if (Library[albumName].GetAlbum(track.GetAlbumKey()).GetDisc(track.GetDiscKey()).AddTrack(track))
            {
                Tracks.Add(track);
            }
        }
コード例 #4
0
ファイル: XmlDisc.cs プロジェクト: OriginalCliff/itsfv
        public bool AddTrack(XmlTrack track)
        {
            bool success = false;

            if (!HasTrack(track))
            {
                Tracks.Add(track);

                if (DiscNumber == 0)
                {
                    this.DiscNumber = Math.Max(track.DiscNumber, 1);
                }

                if (string.IsNullOrEmpty(Key))
                {
                    this.Key = track.GetDiscKey();
                }

                success = true;
            }

            return success;
        }