/// <summary> /// Initializes a new instance of the <see cref="BassSongInfo"/> class. /// </summary> /// <param name="Info">A <see cref="RemoteResourceInfo"/> instance that holds informations about the requested URI.</param> public BassSongInfo(RemoteResourceInfo Info) { #region Error checking if (Info == null) { throw new ArgumentNullException(nameof(Info)); } if (!Info.RequestSucceeded) { throw new ArgumentException($"{nameof(Info)} represents a failed request."); } if (Info.IsPlaylist) { throw new ArgumentException($"{nameof(Info)} is a playlist, not a media resource."); } #endregion if (Info.IsInternetRadioStream) { int Channel = Bass.BASS_StreamCreateURL( url: Info.RequestUri.ToString(), offset: 0, flags: BASSFlag.BASS_STREAM_STATUS, proc: null, user: IntPtr.Zero ); if (Channel == 0) { throw new Exception("Could not connect to the radio stream."); } this.tagInfo = new TAG_INFO(); if (!BassTags.BASS_TAG_GetFromURL(Channel, this.tagInfo)) { throw new Exception("Could not retrieve informations about the radio stream."); } } else { this.tagInfo = BassTags.BASS_TAG_GetFromFile(Info.RequestUri.ToString()); } }
public NetworkAudioFilePlayback(string Uri, RemoteResourceInfo Info) : base(Bass.BASS_StreamCreateURL(Uri, 0, BASSFlag.BASS_DEFAULT, null, IntPtr.Zero)) { this.Info = Info; }