[banshee] Mtp: Fix up File class and add it to the build



commit a1bbde410a9c0251f62d655beddc256cd23532a6
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sun Jan 8 15:20:54 2012 +0100

    Mtp: Fix up File class and add it to the build
    
    We don't use the Mtp.File class, but if we have it in the source tree
    we might as well build it.

 src/Libraries/Mtp/Makefile.am |    1 +
 src/Libraries/Mtp/Mtp.csproj  |    1 +
 src/Libraries/Mtp/Mtp/File.cs |   86 +++++++++++++++++++++-------------------
 3 files changed, 47 insertions(+), 41 deletions(-)
---
diff --git a/src/Libraries/Mtp/Makefile.am b/src/Libraries/Mtp/Makefile.am
index d357499..62f139f 100644
--- a/src/Libraries/Mtp/Makefile.am
+++ b/src/Libraries/Mtp/Makefile.am
@@ -17,6 +17,7 @@ SOURCES =  \
 	Mtp/Album.cs \
 	Mtp/Error.cs \
 	Mtp/ErrorCode.cs \
+	Mtp/File.cs \
 	Mtp/FileSampleData.cs \
 	Mtp/FileType.cs \
 	Mtp/Folder.cs \
diff --git a/src/Libraries/Mtp/Mtp.csproj b/src/Libraries/Mtp/Mtp.csproj
index 6dd2c69..dbf8998 100644
--- a/src/Libraries/Mtp/Mtp.csproj
+++ b/src/Libraries/Mtp/Mtp.csproj
@@ -45,6 +45,7 @@
     <Compile Include="Mtp\Track.cs" />
     <Compile Include="Mtp\AbstractTrackList.cs" />
     <Compile Include="Mtp\Playlist.cs" />
+    <Compile Include="Mtp\File.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>
diff --git a/src/Libraries/Mtp/Mtp/File.cs b/src/Libraries/Mtp/Mtp/File.cs
index e2adeff..6e43420 100644
--- a/src/Libraries/Mtp/Mtp/File.cs
+++ b/src/Libraries/Mtp/Mtp/File.cs
@@ -32,56 +32,60 @@ using System.Runtime.InteropServices;
 
 namespace Mtp
 {
-		[DllImport("libmtp.dll")]
-		private static extern IntPtr LIBMTP_new_file_t (); // LIBMTP_file_t *
+    public class File
+    {
+        [DllImport("libmtp.dll")]
+        private static extern IntPtr LIBMTP_new_file_t (); // LIBMTP_file_t *
 
-		[DllImport("libmtp.dll")]
-		private static extern void LIBMTP_destroy_file_t (ref File file); // LIBMTP_file_t *
+        [DllImport("libmtp.dll")]
+        private static extern void LIBMTP_destroy_file_t (ref File file); // LIBMTP_file_t *
 
-		[DllImport("libmtp.dll")]
-		private static extern string LIBMTP_Get_Filetype_Description (FileType type); // char const *
+        [DllImport("libmtp.dll")]
+        private static extern string LIBMTP_Get_Filetype_Description (FileType type); // char const *
 
-		[DllImport("libmtp.dll")]
-		private static extern IntPtr LIBMTP_Get_Filelisting (MtpDeviceHandle handle); // LIBMTP_file_t *
+        [DllImport("libmtp.dll")]
+        private static extern IntPtr LIBMTP_Get_Filelisting (MtpDeviceHandle handle); // LIBMTP_file_t *
 
-		[DllImport("libmtp.dll")]
-		private static extern IntPtr LIBMTP_Get_Filelisting_With_Callback (MtpDeviceHandle handle, ProgressFunction function, IntPtr data); // LIBMTP_file_t *
+        [DllImport("libmtp.dll")]
+        private static extern IntPtr LIBMTP_Get_Filelisting_With_Callback (MtpDeviceHandle handle, ProgressFunction function, IntPtr data); // LIBMTP_file_t *
 
-		[DllImport("libmtp.dll")]
-		private static extern IntPtr LIBMTP_Get_Filemetadata (MtpDeviceHandle handle, uint fileid); // LIBMTP_file_t *
+        [DllImport("libmtp.dll")]
+        private static extern IntPtr LIBMTP_Get_Filemetadata (MtpDeviceHandle handle, uint fileid); // LIBMTP_file_t *
 
-		[DllImport("libmtp.dll")]
-		private static extern int LIBMTP_Get_File_To_File (MtpDeviceHandle handle, uint fileId, string path, ProgressFunction function, IntPtr data);
+        [DllImport("libmtp.dll")]
+        private static extern int LIBMTP_Get_File_To_File (MtpDeviceHandle handle, uint fileId, string path, ProgressFunction function, IntPtr data);
 
-		[DllImport("libmtp.dll")]
-		public static extern void LIBMTP_destroy_filesampledata_t (ref FileSampleData data); // LIBMTP_filesampledata_t *
+        [DllImport("libmtp.dll")]
+        private static extern void LIBMTP_destroy_filesampledata_t (ref FileSampleData data); // LIBMTP_filesampledata_t *
 
-		[DllImport("libmtp.dll")]
-		public static extern int LIBMTP_Get_Representative_Sample_Format (MtpDeviceHandle handle, FileType type, IntPtr data_array);
+        [DllImport("libmtp.dll")]
+        private static extern int LIBMTP_Get_Representative_Sample_Format (MtpDeviceHandle handle, FileType type, IntPtr data_array);
 
-		[DllImport("libmtp.dll")]
-		public static extern int LIBMTP_Send_Representative_Sample (MtpDeviceHandle handle, uint id, ref FileSampleData sample);
+        [DllImport("libmtp.dll")]
+        private static extern int LIBMTP_Send_Representative_Sample (MtpDeviceHandle handle, uint id, ref FileSampleData sample);
 
-	[StructLayout(LayoutKind.Sequential)]
-	internal struct File
-	{
-		public int item_id;
-		public int parent_id;
-		public int storage_id;
+    }
 
-		[MarshalAs(UnmanagedType.LPStr)]public string filename;
-		public long filesize;
-		public FileType filetype;
-		public IntPtr next; // LIBMTP_file_t*
-		/*
-		public File? Next
-		{
-			get
-			{
-				if (next == IntPtr.Zero)
-					return null;
-				return (File)Marshal.PtrToStructure(next, typeof(File));
-			}
-		}*/
-	}
+    [StructLayout(LayoutKind.Sequential)]
+    internal struct FileStruct
+    {
+        public int item_id;
+        public int parent_id;
+        public int storage_id;
+
+        [MarshalAs(UnmanagedType.LPStr)]public string filename;
+        public long filesize;
+        public FileType filetype;
+        public IntPtr next; // LIBMTP_file_t*
+        /*
+        public File? Next
+        {
+            get
+            {
+                if (next == IntPtr.Zero)
+                    return null;
+                return (File)Marshal.PtrToStructure(next, typeof(File));
+            }
+        }*/
+    }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]