Esempio n. 1
0
 /// <summary>
 /// Constructs a new, default instance of the FileIcon
 /// class.  Specify the filename and call GetInfo()
 /// to retrieve an icon.
 /// </summary>
 public FileIcon()
 {
     flags =
         FileInfoOptions.Icon |
         FileInfoOptions.DisplayName |
         FileInfoOptions.TypeName |
         FileInfoOptions.Attributes |
         FileInfoOptions.ExeType;
 }
Esempio n. 2
0
 /// <summary>
 /// Constructs a new, default instance of the FileIcon
 /// class.  Specify the filename and call GetInfo()
 /// to retrieve an icon.
 /// </summary>
 public FileIcon()
 {
     flags =
         FileInfoOptions.Icon |
         FileInfoOptions.DisplayName |
         FileInfoOptions.TypeName |
         FileInfoOptions.Attributes |
         FileInfoOptions.ExeType;
 }
		public static void GetEntries (string uri, FileInfoOptions options,
					       uint itemsPerNotification, int priority,
					       AsyncDirectoryLoadCallback callback)
		{
			IntPtr handle = IntPtr.Zero;
			AsyncDirectoryLoadCallbackWrapper wrapper = new AsyncDirectoryLoadCallbackWrapper (callback, null);
			gnome_vfs_async_load_directory (out handle, uri, options, itemsPerNotification,
							priority, wrapper.NativeDelegate, IntPtr.Zero);
		}
Esempio n. 4
0
        public static void GetEntries(string uri, FileInfoOptions options,
                                      uint itemsPerNotification, int priority,
                                      AsyncDirectoryLoadCallback callback)
        {
            IntPtr handle = IntPtr.Zero;
            AsyncDirectoryLoadCallbackWrapper wrapper = new AsyncDirectoryLoadCallbackWrapper(callback, null);

            gnome_vfs_async_load_directory(out handle, uri, options, itemsPerNotification,
                                           priority, wrapper.NativeDelegate, IntPtr.Zero);
        }
		public static FileInfo[] GetEntries (string text_uri, FileInfoOptions options)
		{
			IntPtr raw_ret;
			Result result = gnome_vfs_directory_list_load (out raw_ret, text_uri, options);
			Vfs.ThrowException (text_uri, result);
			
			GLib.List list = new GLib.List (raw_ret, typeof (IntPtr));
			list.Managed = true;
			FileInfo[] entries = new FileInfo [list.Count];
			int i = 0;
			foreach (IntPtr info in list)
				entries[i++] = new FileInfo (info);
			
			return entries;
		}
Esempio n. 6
0
        public static FileInfo[] GetEntries(string text_uri, FileInfoOptions options)
        {
            IntPtr raw_ret;
            Result result = gnome_vfs_directory_list_load(out raw_ret, text_uri, options);

            Vfs.ThrowException(text_uri, result);

            GLib.List list = new GLib.List(raw_ret, typeof(IntPtr));
            list.Managed = true;
            FileInfo[] entries = new FileInfo [list.Count];
            int        i       = 0;

            foreach (IntPtr info in list)
            {
                entries[i++] = new FileInfo(info);
            }

            return(entries);
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage: TestInfo <uri>");
                return;
            }

            Gnome.Vfs.Vfs.Initialize();

            Gnome.Vfs.Uri uri = new Gnome.Vfs.Uri(args[0]);

            FileInfoOptions options = FileInfoOptions.GetMimeType |
                                      FileInfoOptions.FollowLinks |
                                      FileInfoOptions.GetAccessRights;
            FileInfo info = uri.GetFileInfo(options);

            Console.WriteLine(info.ToString());

            Gnome.Vfs.Vfs.Shutdown();
        }
Esempio n. 8
0
 public FileInfo GetFileInfo(FileInfoOptions options)
 {
     return(new FileInfo(this, options));
 }
Esempio n. 9
0
		public FileInfo (Uri uri, FileInfoOptions options) : this ()
		{
			Result result = gnome_vfs_get_file_info_uri (uri.Handle, Handle, (int) options);
			Vfs.ThrowException (uri, result);
		}
Esempio n. 10
0
		public FileInfo (string uri, FileInfoOptions options) : this (new Uri (uri), options) {}
Esempio n. 11
0
        private Icon getIcon(bool large)
        {
            // Get icon index and path:
            int           iconIndex = 0;
            StringBuilder iconPath  = new StringBuilder(260, 260);

            if (_linkA == null)
            {
                _linkW.GetIconLocation(iconPath, iconPath.Capacity, out iconIndex);
            }
            else
            {
                _linkA.GetIconLocation(iconPath, iconPath.Capacity, out iconIndex);
            }
            string iconFile = iconPath.ToString();

            // If there are no details set for the icon, then we must use
            // the shell to get the icon for the target:
            if (iconFile.Length == 0)
            {
                // Use the FileIcon object to get the icon:
                FileInfoOptions flags = FileInfoOptions.Icon | FileInfoOptions.Attributes;

                if (large)
                {
                    flags = flags | FileInfoOptions.LargeIcon;
                }
                else
                {
                    flags = flags | FileInfoOptions.SmallIcon;
                }
                FileIcon fileIcon = new FileIcon(Target, flags);
                return(fileIcon.ShellIcon);
            }
            else
            {
                // Use ExtractIconEx to get the icon:
                IntPtr[] hIconEx = new IntPtr[1] {
                    IntPtr.Zero
                };
                int iconCount;
                if (large)
                {
                    iconCount = NativeMethods.ExtractIconEx(
                        iconFile,
                        iconIndex,
                        hIconEx,
                        null,
                        1);
                }
                else
                {
                    iconCount = NativeMethods.ExtractIconEx(
                        iconFile,
                        iconIndex,
                        null,
                        hIconEx,
                        1);
                }
                // If success then return as a GDI+ object
                Icon icon = null;
                if (hIconEx[0] != IntPtr.Zero)
                {
                    icon = Icon.FromHandle(hIconEx[0]);
                    //UnManagedMethods.DestroyIcon(hIconEx[0]);
                }
                return(icon);
            }
        }
Esempio n. 12
0
 private static extern Result gnome_vfs_directory_list_load(out IntPtr list, string uri, FileInfoOptions options);
Esempio n. 13
0
 public FileInfo(string uri, FileInfoOptions options) : this(new Uri(uri), options)
 {
 }
Esempio n. 14
0
 public static void GetEntries(Uri uri, FileInfoOptions options,
                               uint itemsPerNotification, int priority,
                               AsyncDirectoryLoadCallback callback)
 {
     GetEntries(uri.ToString(), options, itemsPerNotification, priority, callback);
 }
Esempio n. 15
0
		private static extern Result gnome_vfs_directory_list_load (out IntPtr list, string uri, FileInfoOptions options);
Esempio n. 16
0
		public static FileInfo[] GetEntries (Uri uri, FileInfoOptions options)
		{
			return GetEntries (uri.ToString (), options);
		}
Esempio n. 17
0
 private static extern void gnome_vfs_async_load_directory(out IntPtr handle, string uri, FileInfoOptions options, uint items_per_notification, int priority, AsyncDirectoryLoadCallbackNative native, IntPtr data);
Esempio n. 18
0
 /// <summary>
 /// Constructs a new instance of the FileIcon class
 /// and retrieves the information specified in the
 /// flags.
 /// </summary>
 /// <param name="fileName">The filename to get information
 /// for</param>
 /// <param name="flags">The flags to use when extracting the
 /// icon and other shell information.</param>
 public FileIcon(string fileName, FileInfoOptions flags)
 {
     this.fileName = fileName;
     this.flags    = flags;
     GetInfo();
 }
Esempio n. 19
0
		public static void GetEntries (Uri uri, FileInfoOptions options,
					       uint itemsPerNotification, int priority,
					       AsyncDirectoryLoadCallback callback)
		{
			GetEntries (uri.ToString (), options, itemsPerNotification, priority, callback);
		}
Esempio n. 20
0
        public FileInfo(Uri uri, FileInfoOptions options) : this()
        {
            Result result = gnome_vfs_get_file_info_uri(uri.Handle, Handle, (int)options);

            Vfs.ThrowException(uri, result);
        }
Esempio n. 21
0
		private static extern void gnome_vfs_async_load_directory (out IntPtr handle, string uri, FileInfoOptions options, uint items_per_notification, int priority, AsyncDirectoryLoadCallbackNative native, IntPtr data);
Esempio n. 22
0
 /// <summary>
 /// Constructs a new instance of the FileIcon class
 /// and retrieves the information specified in the 
 /// flags.
 /// </summary>
 /// <param name="fileName">The filename to get information
 /// for</param>
 /// <param name="flags">The flags to use when extracting the
 /// icon and other shell information.</param>
 public FileIcon(string fileName, FileInfoOptions flags)
 {
     this.fileName = fileName;
     this.flags = flags;
     GetInfo();
 }
Esempio n. 23
0
 public static FileInfo[] GetEntries(Uri uri, FileInfoOptions options)
 {
     return(GetEntries(uri.ToString(), options));
 }