[Monodevelop-patches-list] r685 - in trunk/MonoDevelop: samples/VFS src/Libraries/MonoDevelop.Gui/VFS

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Tue Jan 27 17:10:02 EST 2004


Author: jluke
Date: 2004-01-27 17:10:02 -0500 (Tue, 27 Jan 2004)
New Revision: 685

Modified:
   trunk/MonoDevelop/samples/VFS/test.cs
   trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/VFS/Vfs.cs
Log:
get mime type from a string of data


Modified: trunk/MonoDevelop/samples/VFS/test.cs
===================================================================
--- trunk/MonoDevelop/samples/VFS/test.cs	2004-01-27 18:26:02 UTC (rev 684)
+++ trunk/MonoDevelop/samples/VFS/test.cs	2004-01-27 22:10:02 UTC (rev 685)
@@ -16,6 +16,10 @@
 			string icon = Vfs.GetIcon (mt);
 			Console.WriteLine (mt);
 			Console.WriteLine (icon);
+
+			string data = "<html></html>";
+			mt = Vfs.GetMimeTypeFromData (data);
+			Console.WriteLine (mt);
 		}
 		else
 		{

Modified: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/VFS/Vfs.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/VFS/Vfs.cs	2004-01-27 18:26:02 UTC (rev 684)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/VFS/Vfs.cs	2004-01-27 22:10:02 UTC (rev 685)
@@ -17,8 +17,8 @@
 		[DllImport ("gnomevfs-2")]
 		static extern string gnome_vfs_get_mime_type (string uri);
 		
-		//[DllImport ("gnomevfs-2")]
-		//static extern string gnome_vfs_get_mime_type_for_data (IntPtr data, int length);
+		[DllImport ("gnomevfs-2")]
+		static extern string gnome_vfs_get_mime_type_for_data (string data, int length);
 		
 		[DllImport ("gnomevfs-2")]
 		static extern string gnome_vfs_mime_get_icon (string mime_type);
@@ -42,6 +42,11 @@
 			return gnome_vfs_get_mime_type (filename);
 		}
 		
+		public static string GetMimeTypeFromData (string data)
+		{
+			return gnome_vfs_get_mime_type_for_data (data, data.Length);
+		}
+		
 		public static bool IsKnownType (string mimetype)
 		{
 			return gnome_vfs_mime_type_is_known (mimetype);




More information about the Monodevelop-patches-list mailing list