Пример #1
0
 public Playlist(MtpDevice device, string name) : base(device, name)
 {
     this.playlist = new PlaylistStruct();
     TracksPtr     = IntPtr.Zero;
     Name          = name;
     Count         = 0;
 }
Пример #2
0
 internal Playlist(MtpDevice device, PlaylistStruct playlist) : base(device, playlist.tracks, playlist.no_tracks)
 {
     // Once we've loaded the tracks, set the TracksPtr to NULL as it
     // will be freed when the Playlist constructor is finished.
     this.playlist = playlist;
     TracksPtr     = IntPtr.Zero;
 }
Пример #3
0
 public Playlist(MtpDevice device, string name)
     : base(device)
 {
     this.playlist = new PlaylistStruct ();
     Name = name;
     Count = 0;
 }
Пример #4
0
 internal Playlist (MtpDevice device, PlaylistStruct playlist) : base (device, playlist.tracks, playlist.no_tracks)
 {
     // Once we've loaded the tracks, set the TracksPtr to NULL as it
     // will be freed when the Playlist constructor is finished.
     this.playlist = playlist;
     TracksPtr = IntPtr.Zero;
 }
 public Playlist (MtpDevice device, string name) : base (device, name)
 {
     this.playlist = new PlaylistStruct ();
     TracksPtr = IntPtr.Zero;
     Name = name;
     Count = 0;
 }
Пример #6
0
        public List <Playlist> GetPlaylists()
        {
            List <Playlist> playlists = new List <Playlist> ();

            IntPtr ptr = Playlist.LIBMTP_Get_Playlist_List(Handle);

            while (ptr != IntPtr.Zero)
            {
                PlaylistStruct d = (PlaylistStruct)Marshal.PtrToStructure(ptr, typeof(PlaylistStruct));
                playlists.Add(new Playlist(this, d));
                ptr = d.next;
            }

            return(playlists);
        }
Пример #7
0
        internal static List <Playlist> GetPlaylists(MtpDevice device)
        {
            List <Playlist> playlists = new List <Playlist> ();
            IntPtr          ptr       = Playlist.LIBMTP_Get_Playlist_List(device.Handle);

            while (ptr != IntPtr.Zero)
            {
                // Destroy the struct *after* we use it to ensure we don't access freed memory
                // for the 'tracks' variable
                PlaylistStruct d = (PlaylistStruct)Marshal.PtrToStructure(ptr, typeof(PlaylistStruct));
                playlists.Add(new Playlist(device, d));
                LIBMTP_destroy_playlist_t(ptr);
                ptr = d.next;
            }
            return(playlists);
        }
Пример #8
0
 private static extern int LIBMTP_Create_New_Playlist(MtpDeviceHandle handle, ref PlaylistStruct metadata, uint parentHandle);
Пример #9
0
 internal Playlist(MtpDevice device, PlaylistStruct playlist) : base(device, playlist.tracks, playlist.no_tracks)
 {
     this.playlist = playlist;
 }
Пример #10
0
 private static extern int LIBMTP_Update_Playlist(MtpDeviceHandle handle, ref PlaylistStruct playlist);
Пример #11
0
 public Playlist(MtpDevice device, string name) : base(device)
 {
     this.playlist = new PlaylistStruct();
     Name          = name;
     Count         = 0;
 }
Пример #12
0
 private static extern int LIBMTP_Update_Playlist(MtpDeviceHandle handle, ref PlaylistStruct playlist);
Пример #13
0
 private static extern int LIBMTP_Create_New_Playlist(MtpDeviceHandle handle, ref PlaylistStruct metadata);
Пример #14
0
 internal Playlist (MtpDevice device, PlaylistStruct playlist) : base (device, playlist.tracks, playlist.no_tracks)
 {
     this.playlist = playlist;
 }