mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-25 02:15:33 +00:00
fa60ba6839
* gnomevfs/Directory.cs: PInvoke the _uri methods directory instead of using the ToString() methods. * gnomevfs/FileInfo.cs: Make the FileInfoNative field internal. * gnomevfs/Gnomevfs.metadata: Hide a bunch of unwanted API. * gnomevfs/Uri.custom: New API. * gnomevfs/Vfs.cs: Idem. svn path=/trunk/gtk-sharp/; revision=38126
125 lines
3.4 KiB
Plaintext
125 lines
3.4 KiB
Plaintext
// Uri.custom - Uri class customizations.
|
|
//
|
|
// Authors: Jeroen Zwartepoorte <jeroen@xs4all.nl>
|
|
//
|
|
// Copyright (c) 2004 Jeroen Zwartepoorte
|
|
//
|
|
// This program is free software; you can redistribute it and/or
|
|
// modify it under the terms of version 2 of the Lesser GNU General
|
|
// Public License as published by the Free Software Foundation.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
// Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
// License along with this program; if not, write to the
|
|
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
// Boston, MA 02111-1307, USA.
|
|
|
|
public MimeType MimeType {
|
|
get {
|
|
return new MimeType (this);
|
|
}
|
|
}
|
|
|
|
[DllImport("gnomevfs-2")]
|
|
static extern Result gnome_vfs_get_volume_free_space (IntPtr raw, out long size);
|
|
|
|
public long VolumeFreeSpace {
|
|
get {
|
|
long size = 0L;
|
|
Result result = gnome_vfs_get_volume_free_space (Handle, out size);
|
|
Vfs.ThrowException (this, result);
|
|
return size;
|
|
}
|
|
}
|
|
|
|
public FileInfo GetFileInfo ()
|
|
{
|
|
return GetFileInfo (FileInfoOptions.Default);
|
|
}
|
|
|
|
public FileInfo GetFileInfo (FileInfoOptions options)
|
|
{
|
|
return new FileInfo (this, options);
|
|
}
|
|
|
|
[DllImport("gnomevfs-2")]
|
|
static extern Result gnome_vfs_set_file_info_uri (IntPtr raw, ref FileInfo.FileInfoNative info, SetFileInfoMask mask);
|
|
|
|
public Result SetFileInfo (FileInfo info, SetFileInfoMask mask)
|
|
{
|
|
return gnome_vfs_set_file_info_uri (Handle, ref info.info, mask);
|
|
}
|
|
|
|
[DllImport("gnomevfs-2")]
|
|
static extern bool gnome_vfs_uri_equal(IntPtr raw, IntPtr b);
|
|
|
|
public override bool Equals (object o) {
|
|
if (o is Uri) {
|
|
Uri uri = o as Uri;
|
|
return gnome_vfs_uri_equal (Handle, uri.Handle);
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
[DllImport("gnomevfs-2")]
|
|
static extern uint gnome_vfs_uri_hash(IntPtr p);
|
|
|
|
public override int GetHashCode () {
|
|
return checked ((int)gnome_vfs_uri_hash (Handle));
|
|
}
|
|
|
|
public override string ToString ()
|
|
{
|
|
return ToString (UriHideOptions.None);
|
|
}
|
|
|
|
[DllImport ("gnomevfs-2")]
|
|
private static extern Result gnome_vfs_truncate_uri (IntPtr raw, ulong length);
|
|
|
|
public Result Truncate (ulong length)
|
|
{
|
|
return gnome_vfs_truncate_uri (Handle, length);
|
|
}
|
|
|
|
[DllImport ("gnomevfs-2")]
|
|
private static extern Result gnome_vfs_unlink_from_uri (IntPtr raw);
|
|
|
|
public Result Unlink ()
|
|
{
|
|
return gnome_vfs_unlink_from_uri (Handle);
|
|
}
|
|
|
|
[DllImport("gnomevfs-2")]
|
|
static extern string gnome_vfs_get_local_path_from_uri (string uri);
|
|
|
|
public static string GetLocalPathFromUri (string uri)
|
|
{
|
|
return gnome_vfs_get_local_path_from_uri (uri);
|
|
}
|
|
|
|
[DllImport("gnomevfs-2")]
|
|
static extern string gnome_vfs_get_uri_from_local_path (string path);
|
|
|
|
public static string GetUriFromLocalPath (string path)
|
|
{
|
|
return gnome_vfs_get_uri_from_local_path (path);
|
|
}
|
|
|
|
[DllImport("gnomevfs-2")]
|
|
static extern IntPtr gnome_vfs_uri_list_parse(string uri_list);
|
|
|
|
public static Uri[] ParseList (string uri_list) {
|
|
IntPtr raw_ret = gnome_vfs_uri_list_parse(uri_list);
|
|
GLib.List list = new GLib.List(raw_ret);
|
|
Uri[] uris = new Uri [list.Count];
|
|
for (int i = 0; i < list.Count; i++)
|
|
uris[i] = list[i] as Uri;
|
|
list.Dispose ();
|
|
return uris;
|
|
}
|