SDownload.Framework.Streams.SCSetStream.SCSetStream C# (CSharp) Method

SCSetStream() public method

Gathers and prepares all of the tracks in the set for download
public SCSetStream ( string url, InfoReportProxy view ) : System
url string The url to the set
view InfoReportProxy The view to report progress back to
return System
        public SCSetStream(string url, InfoReportProxy view) : base(url, view)
        {
            var playlistData = SCPlaylistData.LoadData(url);
            if (playlistData == null)
                throw new HandledException("Downloaded set information was corrupted!", true);

            if (playlistData.Tracks.Length < 1)
                throw new HandledException("Playlist does not contain any tracks!", true);

            for (var index = 0; index < playlistData.Tracks.Length; index++)
            {
                View.Report(String.Format("Processing track {0}/{1}", index+1, playlistData.Tracks.Length));
                var track = playlistData.Tracks[index];
                var setItemReporter = new SetItemReportProxy(this, playlistData.Tracks.Length);
                try
                {
                    var trackHandler = new SCTrackStream(track.PermalinkUrl, setItemReporter, track);
                    _downloads.Add(trackHandler, null);
                }
                catch (Exception)
                {
                    // Mark the item failed if it couldn't be processed
                    setItemReporter.Close();
                }
            }
        }