Exemplo n.º 1
0
        static long Size(this GLib.File file)
        {
            IntPtr info = NativeInterop.GFileQueryInfo(file, "standard::size", FileQueryInfoFlags.None, null);
            long   size = NativeInterop.GFileInfoSize(info);

            NativeInterop.GObjectUnref(info);
            return(size);
        }
Exemplo n.º 2
0
        public static string Icon(this GLib.File file)
        {
            IntPtr info = NativeInterop.GFileQueryInfo(file, "standard::icon", FileQueryInfoFlags.None, null);

            GLib.Icon icon     = NativeInterop.GFileInfoIcon(info);
            string    iconName = DockServices.Drawing.IconFromGIcon(icon);

            NativeInterop.GObjectUnref(info);
            return(iconName);
        }
Exemplo n.º 3
0
        public static T QueryInfo <T> (this GLib.File file, string attribute)
        {
            IntPtr info = NativeInterop.GFileQueryInfo(file, attribute, FileQueryInfoFlags.None, null);

            Type   returnType = typeof(T);
            object ret;

            if (returnType == typeof(bool))
            {
                ret = QueryBoolAttr(info, attribute);
            }
            else if (returnType == typeof(string))
            {
                ret = QueryStringAttr(info, attribute);
            }
            else if (returnType == typeof(string[]))
            {
                ret = QueryStringVAttr(info, attribute);
            }
            else if (returnType == typeof(uint))
            {
                ret = QueryUIntAttr(info, attribute);
            }
            else if (returnType == typeof(ulong))
            {
                ret = QueryULongAttr(info, attribute);
            }
            else
            {
                ret = default(T);
            }

            NativeInterop.GObjectUnref(info);

            return((T)ret);
        }