예제 #1
0
 internal static void UpdateTrackMetadata(MtpDeviceHandle handle, ref TrackStruct metadata)
 {
     if (LIBMTP_Update_Track_Metadata(handle, ref metadata) != 0)
     {
         throw new LibMtpException(ErrorCode.General);
     }
 }
예제 #2
0
 internal MtpDevice(MtpDeviceHandle handle, MtpDeviceStruct device)
 {
     this.device = device;
     this.Handle = handle;
     this.name   = GetFriendlyName(Handle);
     SetDefaultFolders();
 }
예제 #3
0
 internal static void GetTrack(MtpDeviceHandle handle, uint trackId, string destPath, ProgressFunction callback, IntPtr data)
 {
     if (LIBMTP_Get_Track_To_File(handle, trackId, destPath, callback, data) != 0)
     {
         LibMtpException.CheckErrorStack(handle);
         throw new LibMtpException(ErrorCode.General, "Could not download track from the device");
     }
 }
예제 #4
0
 internal static void SendTrack(MtpDeviceHandle handle, string path, ref TrackStruct metadata, ProgressFunction callback, IntPtr data)
 {
     if (LIBMTP_Send_Track_From_File(handle, path, ref metadata, callback, data) != 0)
     {
         LibMtpException.CheckErrorStack(handle);
         throw new LibMtpException(ErrorCode.General, "Could not upload the track");
     }
 }
예제 #5
0
 internal static void DeleteObject(MtpDeviceHandle handle, uint object_id)
 {
     if (LIBMTP_Delete_Object(handle, object_id) != 0)
     {
         LibMtpException.CheckErrorStack(handle);
         throw new LibMtpException(ErrorCode.General, "Could not delete the track");
     }
 }
예제 #6
0
        internal static void GetBatteryLevel(MtpDeviceHandle handle, out ushort maxLevel, out ushort currentLevel)
        {
            int result = LIBMTP_Get_Batterylevel(handle, out maxLevel, out currentLevel);

            if (result != 0)
            {
                throw new LibMtpException(ErrorCode.General, "Could not retrieve battery stats");
            }
        }
예제 #7
0
        internal static string GetDeviceversion(MtpDeviceHandle handle)
        {
            IntPtr ptr = LIBMTP_Get_Deviceversion(handle);

            if (ptr == IntPtr.Zero)
            {
                return(null);
            }

            return(StringFromIntPtr(ptr));
        }
예제 #8
0
        internal static string GetFriendlyName(MtpDeviceHandle handle)
        {
            IntPtr ptr = LIBMTP_Get_Friendlyname(handle);

            if (ptr == IntPtr.Zero)
            {
                return(null);
            }

            return(StringFromIntPtr(ptr));
        }
예제 #9
0
        internal static string GetSerialnumber(MtpDeviceHandle handle)
        {
            IntPtr ptr = LIBMTP_Get_Serialnumber(handle);

            if (ptr == IntPtr.Zero)
            {
                return(null);
            }

            return(StringFromIntPtr(ptr));
        }
예제 #10
0
        internal static uint CreateFolder(MtpDeviceHandle handle, string name, uint parentId)
        {
            uint result = LIBMTP_Create_Folder(handle, name, parentId, 0);

            if (result == 0)
            {
                LibMtpException.CheckErrorStack(handle);
                throw new LibMtpException(ErrorCode.General, "Could not create folder on the device");
            }

            return(result);
        }
예제 #11
0
        internal static Int16 [] GetFileTypes(MtpDeviceHandle handle)
        {
            IntPtr types = IntPtr.Zero;
            ushort count = 0;

            if (LIBMTP_Get_Supported_Filetypes(handle, ref types, ref count) == 0)
            {
                Int16 [] type_ary = new Int16 [count];
                Marshal.Copy(types, type_ary, 0, (int)count);
                Marshal.FreeHGlobal(types);
                return(type_ary);
            }

            return(new Int16[0]);
        }
예제 #12
0
파일: Error.cs 프로젝트: knocte/banshee
        internal static void CheckErrorStack(MtpDeviceHandle handle)
        {
            IntPtr ptr = MtpDevice.GetErrorStack (handle);
            if (ptr == IntPtr.Zero)
                return;

            LibMtpException ex = null;
            while (ptr != IntPtr.Zero) {
                Error e = (Error)Marshal.PtrToStructure (ptr, typeof(Error));
                ex = new LibMtpException (e.errornumber, e.error_text, ex);
                ptr = e.next;
            }

            // Once we throw the exception, clear the error stack
            MtpDevice.ClearErrorStack (handle);
            throw ex;
        }
예제 #13
0
파일: Error.cs 프로젝트: thoja21/banshee-1
        internal static void CheckErrorStack(MtpDeviceHandle handle)
        {
            IntPtr ptr = MtpDevice.GetErrorStack(handle);

            if (ptr == IntPtr.Zero)
            {
                return;
            }

            LibMtpException ex = null;

            while (ptr != IntPtr.Zero)
            {
                Error e = (Error)Marshal.PtrToStructure(ptr, typeof(Error));
                ex  = new LibMtpException(e.errornumber, e.error_text, ex);
                ptr = e.next;
            }

            // Once we throw the exception, clear the error stack
            MtpDevice.ClearErrorStack(handle);
            throw ex;
        }
예제 #14
0
 static extern IntPtr LIBMTP_Get_Album_List (MtpDeviceHandle handle); // LIBMTP_album_t*
예제 #15
0
 internal static extern IntPtr LIBMTP_Get_Playlist_List(MtpDeviceHandle handle);  // LIBMTP_playlist_t*
예제 #16
0
 private static extern uint LIBMTP_Create_Folder(MtpDeviceHandle handle, string name, uint parentId);
예제 #17
0
 internal static IntPtr GetFolderList(MtpDeviceHandle handle)
 {
     return(LIBMTP_Get_Folder_List(handle));
 }
 private static extern int LIBMTP_Get_Representative_Sample_Format(MtpDeviceHandle handle, FileType type, IntPtr data_array);
예제 #19
0
파일: Album.cs 프로젝트: thoja21/banshee-1
 static extern IntPtr LIBMTP_Get_Album_List(MtpDeviceHandle handle);  // LIBMTP_album_t*
예제 #20
0
파일: File.cs 프로젝트: gclark916/banshee
 private static extern IntPtr LIBMTP_Get_Filemetadata (MtpDeviceHandle handle, uint fileid); // LIBMTP_file_t *
예제 #21
0
파일: Track.cs 프로젝트: ptrimble/banshee
 internal static void UpdateTrackMetadata(MtpDeviceHandle handle, ref TrackStruct metadata)
 {
     if (LIBMTP_Update_Track_Metadata (handle, ref metadata) != 0)
         throw new LibMtpException (ErrorCode.General);
 }
예제 #22
0
파일: Track.cs 프로젝트: ptrimble/banshee
 internal static void SendTrack(MtpDeviceHandle handle, string path, ref TrackStruct metadata, ProgressFunction callback, IntPtr data)
 {
     if (LIBMTP_Send_Track_From_File (handle, path, ref metadata, callback, data) != 0)
     {
         LibMtpException.CheckErrorStack (handle);
         throw new LibMtpException (ErrorCode.General, "Could not upload the track");
     }
 }
예제 #23
0
파일: Track.cs 프로젝트: ptrimble/banshee
 internal static IntPtr GetTrackListing(MtpDeviceHandle handle, ProgressFunction function, IntPtr data)
 {
     return LIBMTP_Get_Tracklisting_With_Callback (handle, function, data);
 }
예제 #24
0
파일: Track.cs 프로젝트: ptrimble/banshee
 internal static void GetTrack(MtpDeviceHandle handle, uint trackId, string destPath, ProgressFunction callback, IntPtr data)
 {
     if (LIBMTP_Get_Track_To_File (handle, trackId, destPath, callback, data) != 0)
     {
         LibMtpException.CheckErrorStack (handle);
         throw new LibMtpException (ErrorCode.General, "Could not download track from the device");
     }
 }
예제 #25
0
 private static extern int LIBMTP_Get_Supported_Filetypes (MtpDeviceHandle handle, ref IntPtr types, ref ushort count); // uint16_t **const
예제 #26
0
 private static extern int LIBMTP_Create_New_Playlist(MtpDeviceHandle handle, ref PlaylistStruct metadata);
예제 #27
0
 private static extern IntPtr LIBMTP_Get_Playlist_List(MtpDeviceHandle handle);
예제 #28
0
 internal static extern int LIBMTP_Create_New_Album (MtpDeviceHandle handle, ref AlbumStruct album, uint parentId);
예제 #29
0
파일: File.cs 프로젝트: gclark916/banshee
 private static extern IntPtr LIBMTP_Get_Filelisting (MtpDeviceHandle handle); // LIBMTP_file_t *
예제 #30
0
파일: Track.cs 프로젝트: ptrimble/banshee
 private static extern IntPtr LIBMTP_Get_Tracklisting_With_Callback(MtpDeviceHandle handle, ProgressFunction callback, IntPtr data);
예제 #31
0
파일: File.cs 프로젝트: gclark916/banshee
 private static extern int LIBMTP_Get_Representative_Sample_Format (MtpDeviceHandle handle, FileType type, IntPtr data_array);
예제 #32
0
파일: Track.cs 프로젝트: ptrimble/banshee
 private static extern int LIBMTP_Get_Track_To_File(MtpDeviceHandle handle, uint trackId, string path, ProgressFunction callback, IntPtr data);
예제 #33
0
 private static extern int LIBMTP_Update_Playlist(MtpDeviceHandle handle, ref PlaylistStruct playlist);
예제 #34
0
파일: Track.cs 프로젝트: ptrimble/banshee
 private static extern int LIBMTP_Send_Track_From_File(MtpDeviceHandle handle, string path, ref TrackStruct track, ProgressFunction callback, IntPtr data);
 private static extern int LIBMTP_Send_Representative_Sample(MtpDeviceHandle handle, uint id, ref FileSampleData sample);
예제 #36
0
파일: Track.cs 프로젝트: ptrimble/banshee
 private static extern int LIBMTP_Update_Track_Metadata(MtpDeviceHandle handle, ref TrackStruct metadata);
예제 #37
0
 private static extern IntPtr LIBMTP_Get_Folder_List(MtpDeviceHandle handle);  // LIBMTP_folder_t*
예제 #38
0
 private static extern IntPtr LIBMTP_Get_Errorstack (MtpDeviceHandle handle); // LIBMTP_error_t *
예제 #39
0
 private static extern int LIBMTP_Update_Playlist(MtpDeviceHandle handle, ref PlaylistStruct playlist);
예제 #40
0
 private static extern int LIBMTP_Set_Friendlyname (MtpDeviceHandle handle, string name);
예제 #41
0
 private static extern int LIBMTP_Create_New_Playlist(MtpDeviceHandle handle, ref PlaylistStruct metadata, uint parentHandle);
예제 #42
0
파일: Album.cs 프로젝트: thoja21/banshee-1
 internal static extern int LIBMTP_Create_New_Album(MtpDeviceHandle handle, ref AlbumStruct album);
예제 #43
0
 static extern IntPtr LIBMTP_Get_Album (MtpDeviceHandle handle, uint albumId); // LIBMTP_album_t*
예제 #44
0
파일: Folder.cs 프로젝트: gclark916/banshee
 internal static uint CreateFolder (MtpDeviceHandle handle, string name, uint parentId)
 {
     uint result = LIBMTP_Create_Folder (handle, name, parentId, 0);
     if (result == 0)
     {
         LibMtpException.CheckErrorStack(handle);
         throw new LibMtpException(ErrorCode.General, "Could not create folder on the device");
     }
     
     return result;
 }
예제 #45
0
 static extern int LIBMTP_Update_Album (MtpDeviceHandle handle, ref AlbumStruct album);
예제 #46
0
파일: Folder.cs 프로젝트: gclark916/banshee
 private static extern IntPtr LIBMTP_Get_Folder_List (MtpDeviceHandle handle); // LIBMTP_folder_t*
예제 #47
0
파일: File.cs 프로젝트: gclark916/banshee
 private static extern IntPtr LIBMTP_Get_Filelisting_With_Callback (MtpDeviceHandle handle, ProgressFunction function, IntPtr data); // LIBMTP_file_t *
예제 #48
0
 private static extern IntPtr LIBMTP_Get_Friendlyname (MtpDeviceHandle handle); // char *
예제 #49
0
파일: File.cs 프로젝트: gclark916/banshee
 private static extern int LIBMTP_Get_File_To_File (MtpDeviceHandle handle, uint fileId, string path, ProgressFunction function, IntPtr data);
 private static extern IntPtr LIBMTP_Get_Filelisting_With_Callback(MtpDeviceHandle handle, ProgressFunction function, IntPtr data);  // LIBMTP_file_t *
예제 #51
0
파일: File.cs 프로젝트: gclark916/banshee
 private static extern int LIBMTP_Send_Representative_Sample (MtpDeviceHandle handle, uint id, ref FileSampleData sample);
 private static extern IntPtr LIBMTP_Get_Filemetadata(MtpDeviceHandle handle, uint fileid);  // LIBMTP_file_t *
예제 #53
0
파일: Album.cs 프로젝트: thoja21/banshee-1
 static extern IntPtr LIBMTP_Get_Album(MtpDeviceHandle handle, uint albumId);  // LIBMTP_album_t*
 private static extern int LIBMTP_Get_File_To_File(MtpDeviceHandle handle, uint fileId, string path, ProgressFunction function, IntPtr data);
예제 #55
0
파일: Album.cs 프로젝트: thoja21/banshee-1
 static extern int LIBMTP_Update_Album(MtpDeviceHandle handle, ref AlbumStruct album);
예제 #56
0
 private static extern int LIBMTP_Send_Track_From_File(MtpDeviceHandle handle, string path, ref TrackStruct track, ProgressFunction callback, IntPtr data);
예제 #57
0
파일: Folder.cs 프로젝트: gclark916/banshee
 internal static IntPtr GetFolderList (MtpDeviceHandle handle)
 {
     return LIBMTP_Get_Folder_List (handle);
 }
예제 #58
0
 private static extern int LIBMTP_Update_Track_Metadata(MtpDeviceHandle handle, ref TrackStruct metadata);
예제 #59
0
파일: Folder.cs 프로젝트: gclark916/banshee
 private static extern uint LIBMTP_Create_Folder (MtpDeviceHandle handle, string name, uint parentId, uint storageId);
 private static extern IntPtr LIBMTP_Get_Filelisting(MtpDeviceHandle handle);  // LIBMTP_file_t *