Пример #1
0
 public static Playlist Create(Session session, Link link)
 {
     IntPtr ptr = libspotify.sp_playlist_create(session.sessionPtr, link.linkPtr);
     if (ptr != IntPtr.Zero)
         return new Playlist(ptr, session);
     else
         return null;
 }
Пример #2
0
		public static Album CreateFromLink(Link link)
		{
			Album result = null;
			
			if(link.linkPtr != IntPtr.Zero)
			{
				lock(libspotify.Mutex)
				{
					IntPtr albumPtr = libspotify.sp_link_as_album(link.linkPtr);
					if(albumPtr != IntPtr.Zero)
						result = new Album(albumPtr);
				}
			}
			
			return result;
		}
Пример #3
0
		public static Artist CreateFromLink(Link link)
		{
			Artist result = null;
			
			if(link.linkPtr != IntPtr.Zero)
			{
				lock(libspotify.Mutex)
				{
					IntPtr artistPtr = libspotify.sp_link_as_artist(link.linkPtr);
					if(artistPtr != IntPtr.Zero)
						result = new Artist(artistPtr);
				}
			}
			
			return result;
		}
Пример #4
0
		public static Track CreateFromLink(Link link)
		{
			Track result = null;
			
			if(link.linkPtr != IntPtr.Zero)
			{
				lock(libspotify.Mutex)
				{
					IntPtr trackPtr = libspotify.sp_link_as_track(link.linkPtr);
					if(trackPtr != IntPtr.Zero)
						result = new Track(trackPtr);
				}
			}
			
			return result;
		}
Пример #5
0
		public static Track CreateFromLink(Link link, out int offset)
		{
			Track result = null;
			offset = 0;
			
			if(link.linkPtr != IntPtr.Zero)
			{
				IntPtr offsetPtr = IntPtr.Zero;
				
				lock(libspotify.Mutex)
				{
					IntPtr trackPtr = libspotify.sp_link_as_track_and_offset(link.linkPtr, out offsetPtr);
					if(trackPtr != IntPtr.Zero)
						result = new Track(trackPtr);
				}
				
				offset = offsetPtr.ToInt32();
			}
			
			return result;
		}
Пример #6
0
        internal Playlist AddPlaylist(Link link)
        {
            CheckDisposed(true);

            Playlist result = null;

            lock(libspotify.Mutex)
            {
                IntPtr playlistPtr = libspotify.sp_playlistcontainer_add_playlist(containerPtr, link.linkPtr);

                int index;
                if(playlistIndexByPtr.TryGetValue(playlistPtr, out index))
                    result = playlists[index];
                else
                    result = null;
            }

            return result;
        }