Пример #1
0
 internal Album(MtpDevice device, AlbumStruct album) : base(device, album.tracks, album.no_tracks)
 {
     // Once we've loaded the tracks, set the TracksPtr to NULL as it
     // will be freed when the Album constructor is finished.
     this.album = album;
     TracksPtr  = IntPtr.Zero;
 }
Пример #2
0
 internal Album(MtpDevice device, AlbumStruct album)
     : base(device, album.tracks, album.no_tracks)
 {
     // Once we've loaded the tracks, set the TracksPtr to NULL as it
     // will be freed when the Album constructor is finished.
     this.album = album;
     TracksPtr = IntPtr.Zero;
 }
Пример #3
0
        public List <Album> GetAlbums()
        {
            List <Album> albums = new List <Album> ();

            IntPtr ptr = Album.LIBMTP_Get_Album_List(Handle);

            while (ptr != IntPtr.Zero)
            {
                AlbumStruct d = (AlbumStruct)Marshal.PtrToStructure(ptr, typeof(AlbumStruct));
                albums.Add(new Album(this, d));
                ptr = d.next;
            }

            return(albums);
        }
Пример #4
0
        internal static List <Album> GetAlbums(MtpDevice device)
        {
            List <Album> albums = new List <Album> ();

            IntPtr ptr = LIBMTP_Get_Album_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
                AlbumStruct d = (AlbumStruct)Marshal.PtrToStructure(ptr, typeof(AlbumStruct));
                albums.Add(new Album(device, d));
                LIBMTP_destroy_album_t(ptr);
                ptr = d.next;
            }

            return(albums);
        }
Пример #5
0
        public static Album GetById(MtpDevice device, uint id)
        {
            IntPtr ptr = Album.LIBMTP_Get_Album(device.Handle, id);

            if (ptr == IntPtr.Zero)
            {
                return(null);
            }
            else
            {
                // Destroy the struct after we use it to prevent accessing freed memory
                // in the 'tracks' variable
                AlbumStruct album = (AlbumStruct)Marshal.PtrToStructure(ptr, typeof(AlbumStruct));
                var         ret   = new Album(device, album);
                LIBMTP_destroy_album_t(ptr);
                return(ret);
            }
        }
Пример #6
0
 static extern int LIBMTP_Update_Album(MtpDeviceHandle handle, ref AlbumStruct album);
Пример #7
0
 internal static extern int LIBMTP_Create_New_Album(MtpDeviceHandle handle, ref AlbumStruct album);
Пример #8
0
 static extern int LIBMTP_Update_Album (MtpDeviceHandle handle, ref AlbumStruct album);
Пример #9
0
 internal static extern int LIBMTP_Create_New_Album (MtpDeviceHandle handle, ref AlbumStruct album, uint parentId);
Пример #10
0
 internal Album(MtpDevice device, AlbumStruct album) : base(device, album.tracks, album.no_tracks)
 {
     this.album = album;
 }
Пример #11
0
 internal static extern void LIBMTP_destroy_album_t(ref AlbumStruct album);
Пример #12
0
 internal Album (MtpDevice device, AlbumStruct album) : base (device, album.tracks, album.no_tracks)
 {
     this.album = album;
 }