public void NativeCallback (IntPtr handle, Result result, IntPtr list, uint entries_read, IntPtr data) { GLib.List infos = new GLib.List (list, typeof (IntPtr)); FileInfo[] entries = new FileInfo [infos.Count]; int i = 0; foreach (IntPtr info in infos) entries[i++] = new FileInfo (info); _managed (result, entries, entries_read); }
private void ShowFileInfo() { // Ask for a file Gnome.Vfs.Uri uri = FileDialog.OpenFile ("Show File Info"); Console.WriteLine ("Selected uri\t= {0}", uri.ToString ()); // MimeType string mimeType = Gnome.Vfs.MimeType.GetMimeTypeForUri (uri.ToString ()); Console.WriteLine ("Mimetype\t= {0}", mimeType); // IsLocal Gnome.Vfs.FileInfoOptions options = Gnome.Vfs.FileInfoOptions.Default; Gnome.Vfs.FileInfo info = new Gnome.Vfs.FileInfo (uri.ToString (), options); Console.WriteLine ("IsLocal\t\t= {0}", info.IsLocal); }
private void ShowFileInfo() { // Ask for a file Gnome.Vfs.Uri uri = FileDialog.OpenFile("Show File Info"); Console.WriteLine("Selected uri\t= {0}", uri.ToString()); // MimeType string mimeType = Gnome.Vfs.MimeType.GetMimeTypeForUri(uri.ToString()); Console.WriteLine("Mimetype\t= {0}", mimeType); // IsLocal Gnome.Vfs.FileInfoOptions options = Gnome.Vfs.FileInfoOptions.Default; Gnome.Vfs.FileInfo info = new Gnome.Vfs.FileInfo(uri.ToString(), options); Console.WriteLine("IsLocal\t\t= {0}", info.IsLocal); }
public Photo CheckForDuplicate(System.Uri uri) { // Here we can go wild in comparing photos, // for now we check on uri and md5 Photo found = GetByUri(uri); if (found != null) { return(found); } string md5 = Photo.GenerateMD5(uri); Gnome.Vfs.FileInfo info = new Gnome.Vfs.FileInfo(uri.ToString(), FileInfoOptions.GetMimeType); Photo[] md5_matches = GetByMD5(md5); foreach (Photo match in md5_matches) { Gnome.Vfs.FileInfo match_info = new Gnome.Vfs.FileInfo(match.DefaultVersionUri.ToString(), FileInfoOptions.GetMimeType); // same mimetype? if (info.MimeType != match_info.MimeType) { continue; } // other comparisons? // TODO? load pixbuf and compare sizes? return(match); } return(null); }
public Photo CheckForDuplicate (System.Uri uri) { // Here we can go wild in comparing photos, // for now we check on uri and md5 Photo found = GetByUri (uri); if (found != null) return found; string md5 = Photo.GenerateMD5 (uri); Gnome.Vfs.FileInfo info = new Gnome.Vfs.FileInfo (uri.ToString (), FileInfoOptions.GetMimeType); Photo[] md5_matches = GetByMD5 (md5); foreach (Photo match in md5_matches) { Gnome.Vfs.FileInfo match_info = new Gnome.Vfs.FileInfo (match.DefaultVersionUri.ToString (), FileInfoOptions.GetMimeType); // same mimetype? if (info.MimeType != match_info.MimeType) continue; // other comparisons? // TODO? load pixbuf and compare sizes? return match; } return null; }
public static string GetMimeType (string file) { var file_info = new FileInfo (file, FileInfoOptions.GetMimeType); return file_info.MimeType; }