Exemple #1
0
        private static IList <string> MarshalPlaylistSubscribers(IntPtr playlist)
        {
            List <string> subscribers = new List <string>();

            IntPtr p = LibSpotify.sp_playlist_subscribers_r(playlist);

            if (p != IntPtr.Zero)
            {
                int n = Marshal.ReadInt32(p);

                int offset = Marshal.SizeOf(typeof(Int32));
                for (int i = 0; i < n; ++i)
                {
                    subscribers.Add(LibSpotify.ReadUtf8(Marshal.ReadIntPtr(p, offset)));
                    offset += Marshal.SizeOf(typeof(IntPtr));
                }

                LibSpotify.sp_playlist_subscribers_free_r(p);
            }

            return(subscribers);
        }