示例#1
0
        void OnAlbumSelected(string albumDetailsString)
        {
            try
            {
                Album album = new Album();

                // Split data string where the tracklist starts
                int tracklistIndex = albumDetailsString.IndexOf(">Tracklist</h");
                if (tracklistIndex < 0)
                {
                    throw new Exception("There was a problem parsing the album data.");
                }

                string detailsString = albumDetailsString.Substring(0, tracklistIndex);
                AlbumParser.Parse(album, detailsString);

                string tracklistString = albumDetailsString.Substring(tracklistIndex);
                TracklistParser.Parse(album, tracklistString);

                // Populate form
                Populate(album);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        static Album GetAlbum(string albumId)
        {
            string albumData = GetAlbumData(albumId);

            Album album = new Album();

            // Split data string where the tracklist starts
            int tracklistIndex = albumData.IndexOf(">Tracklist</h");

            if (tracklistIndex < 0)
            {
                throw new LetsTagException("There was a problem parsing the album data");
            }

            string detailsString = albumData.Substring(0, tracklistIndex);

            AlbumParser.Parse(album, detailsString);

            string tracklistString = albumData.Substring(tracklistIndex);

            TracklistParser.Parse(album, tracklistString);

            return(album);
        }