GtkSharp/gnomevfs/Uri.custom
Jeroen Zwartepoorte f3b891e758 2004-12-27 Jeroen Zwartepoorte <jeroen@xs4all.nl>
* gnomevfs/Directory.cs: s/uint/FilePermissions/.
	* gnomevfs/Gnomevfs.metadata: Make a bunch of API more user-friendly &
	C# like.
	* gnomevfs/Monitor.cs: Add internal MonitorEventType enum.
	* gnomevfs/Uri.custom: Move a bunch of API from Vfs.cs to Uri.
	* gnomevfs/Vfs.cs: Only put initialize & shutdown methods in here (plus
	some debug API).
	* gnomevfs/VfsStream.cs: Use new Uri API.
	* sample/gnomevfs/TestUnlink.cs: Fix sample.


svn path=/trunk/gtk-sharp/; revision=38112
2004-12-27 20:02:33 +00:00

89 lines
2.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);
}
}
public FileInfo GetFileInfo ()
{
return GetFileInfo (FileInfoOptions.Default);
}
public FileInfo GetFileInfo (FileInfoOptions options) {
return new FileInfo (this, options);
}
[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));
}
[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;
}
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);
}