restructuring for gtk-sharp/gnome-sharp split
svn path=/trunk/gtk-sharp/; revision=63086
This commit is contained in:
parent
d7070f0da9
commit
e54d850625
37 changed files with 0 additions and 14155 deletions
|
@ -1,112 +0,0 @@
|
|||
// Async.cs - Bindings for gnome-vfs asynchronized file operations.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class Async {
|
||||
public enum Priority {
|
||||
Min = -10,
|
||||
Default = 0,
|
||||
Max = 10
|
||||
}
|
||||
|
||||
private Async () {}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_cancel (IntPtr handle);
|
||||
|
||||
public static void Cancel (Handle handle)
|
||||
{
|
||||
gnome_vfs_async_cancel (handle.Handle);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_close (IntPtr handle, AsyncCallbackNative callback, IntPtr data);
|
||||
|
||||
public static void Close (Handle handle, AsyncCallback callback)
|
||||
{
|
||||
AsyncCallbackWrapper wrapper = new AsyncCallbackWrapper (callback, null);
|
||||
gnome_vfs_async_close (handle.Handle, wrapper.NativeDelegate, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_create (out IntPtr handle, string uri, OpenMode mode, bool exclusive, uint perm, int priority, AsyncCallbackNative callback, IntPtr data);
|
||||
|
||||
public static Handle Create (string uri, OpenMode mode, bool exclusive, FilePermissions perm, int priority, AsyncCallback callback)
|
||||
{
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
AsyncCallbackWrapper wrapper = new AsyncCallbackWrapper (callback, null);
|
||||
gnome_vfs_async_create (out handle, uri, mode, exclusive, (uint)perm, priority, wrapper.NativeDelegate, IntPtr.Zero);
|
||||
return new Handle (handle);
|
||||
}
|
||||
|
||||
public static Handle Create (Uri uri, OpenMode mode, bool exclusive, FilePermissions perm, int priority, AsyncCallback callback)
|
||||
{
|
||||
return Create (uri.ToString (), mode, exclusive, perm, priority, callback);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_open (out IntPtr handle, string uri, OpenMode mode, int priority, AsyncCallbackNative callback, IntPtr data);
|
||||
|
||||
public static Handle Open (string uri, OpenMode mode, int priority, AsyncCallback callback)
|
||||
{
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
AsyncCallbackWrapper wrapper = new AsyncCallbackWrapper (callback, null);
|
||||
gnome_vfs_async_open (out handle, uri, mode, priority, wrapper.NativeDelegate, IntPtr.Zero);
|
||||
return new Handle (handle);
|
||||
}
|
||||
|
||||
public static Handle Open (Uri uri, OpenMode mode, int priority, AsyncCallback callback)
|
||||
{
|
||||
return Open (uri.ToString (), mode, priority, callback);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_read (IntPtr handle, out byte buffer, uint bytes, AsyncReadCallbackNative callback, IntPtr data);
|
||||
|
||||
public static void Read (Handle handle, out byte buffer, uint bytes, AsyncReadCallback callback)
|
||||
{
|
||||
AsyncReadCallbackWrapper wrapper = new AsyncReadCallbackWrapper (callback, null);
|
||||
gnome_vfs_async_read (handle.Handle, out buffer, bytes, wrapper.NativeDelegate, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_seek (IntPtr handle, SeekPosition whence, long offset, AsyncCallbackNative callback, IntPtr data);
|
||||
|
||||
public static void Seek (Handle handle, SeekPosition whence, long offset, AsyncCallback callback)
|
||||
{
|
||||
AsyncCallbackWrapper wrapper = new AsyncCallbackWrapper (callback, null);
|
||||
gnome_vfs_async_seek (handle.Handle, whence, offset, wrapper.NativeDelegate, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_write (IntPtr handle, out byte buffer, uint bytes, AsyncWriteCallbackNative callback, IntPtr data);
|
||||
|
||||
public static void Write (Handle handle, out byte buffer, uint bytes, AsyncWriteCallback callback)
|
||||
{
|
||||
AsyncWriteCallbackWrapper wrapper = new AsyncWriteCallbackWrapper (callback, null);
|
||||
gnome_vfs_async_write (handle.Handle, out buffer, bytes, wrapper.NativeDelegate, IntPtr.Zero);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
// AsyncCallback.cs - GnomeVFSAsyncCallback delegate.
|
||||
//
|
||||
// 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.
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public delegate void AsyncCallback (Handle handle, Result result);
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
// AsyncCallbackNative.cs - GnomeVFSAsyncCallback native wrapper.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
internal delegate void AsyncCallbackNative (IntPtr handle, Result result, IntPtr data);
|
||||
|
||||
internal class AsyncCallbackWrapper : GLib.DelegateWrapper {
|
||||
|
||||
public void NativeCallback (IntPtr handle, Result result, IntPtr data)
|
||||
{
|
||||
_managed (new Handle (handle), result);
|
||||
}
|
||||
|
||||
internal AsyncCallbackNative NativeDelegate;
|
||||
protected AsyncCallback _managed;
|
||||
|
||||
public AsyncCallbackWrapper (AsyncCallback managed, object o) : base (o)
|
||||
{
|
||||
NativeDelegate = new AsyncCallbackNative (NativeCallback);
|
||||
_managed = managed;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
// AsyncDirectoryLoadCallback.cs - GnomeVFSAsyncDirectoryLoadCallback delegate.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public delegate void AsyncDirectoryLoadCallback (Result result, FileInfo[] infos, uint entries_read);
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
// AsyncDirectoryLoadCallbackNative.cs - GnomeVFSAsyncDirectoryLoadCallback
|
||||
// native wrapper.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
internal delegate void AsyncDirectoryLoadCallbackNative (IntPtr handle, Result result, IntPtr list, uint entries_read, IntPtr data);
|
||||
|
||||
internal class AsyncDirectoryLoadCallbackWrapper : GLib.DelegateWrapper {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
internal AsyncDirectoryLoadCallbackNative NativeDelegate;
|
||||
protected AsyncDirectoryLoadCallback _managed;
|
||||
|
||||
public AsyncDirectoryLoadCallbackWrapper (AsyncDirectoryLoadCallback managed, object o) : base (o)
|
||||
{
|
||||
NativeDelegate = new AsyncDirectoryLoadCallbackNative (NativeCallback);
|
||||
_managed = managed;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
// AsyncReadCallback.cs - GnomeVFSAsyncReadCallback delegate.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public delegate void AsyncReadCallback (Handle handle, Result result, byte[] buffer, ulong bytes_requested, ulong bytes_read);
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
// AsyncReadCallbackNative.cs - GnomeVFSAsyncReadCallback native wrapper.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// VfsAsyncReadCallbackNative.cs: Utility class for accessing gnome-vfs methods.
|
||||
//
|
||||
// Author:
|
||||
// Jeroen Zwartepoorte <jeroen@xs4all.nl>
|
||||
//
|
||||
// (C) Copyright Jeroen Zwartepoorte 2004
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
internal delegate void AsyncReadCallbackNative (IntPtr handle, Result result, IntPtr buffer, ulong bytes_requested, ulong bytes_read, IntPtr data);
|
||||
|
||||
internal class AsyncReadCallbackWrapper : GLib.DelegateWrapper {
|
||||
|
||||
public void NativeCallback (IntPtr handle, Result result, IntPtr buffer, ulong bytes_requested, ulong bytes_read, IntPtr data)
|
||||
{
|
||||
byte[] bytes = new byte[bytes_read];
|
||||
Marshal.Copy (buffer, bytes, 0, (int)bytes_read);
|
||||
_managed (new Handle (handle), result, bytes, bytes_requested, bytes_read);
|
||||
}
|
||||
|
||||
internal AsyncReadCallbackNative NativeDelegate;
|
||||
protected AsyncReadCallback _managed;
|
||||
|
||||
public AsyncReadCallbackWrapper (AsyncReadCallback managed, object o) : base (o)
|
||||
{
|
||||
NativeDelegate = new AsyncReadCallbackNative (NativeCallback);
|
||||
_managed = managed;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
// AsyncWriteCallback.cs - GnomeVFSAsyncWriteCallback delegate.
|
||||
//
|
||||
// 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.
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public delegate void AsyncWriteCallback (Handle handle, Result result, byte[] buffer, ulong bytes_requested, ulong bytes_written);
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
// AsyncWriteCallbackNative.cs - Native wrapper for GnomeVFSAsyncWriteCallback.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
internal delegate void AsyncWriteCallbackNative (IntPtr handle, Result result, IntPtr buffer, ulong bytes_requested, ulong bytes_written, IntPtr data);
|
||||
|
||||
internal class AsyncWriteCallbackWrapper : GLib.DelegateWrapper {
|
||||
|
||||
public void NativeCallback (IntPtr handle, Result result, IntPtr buffer, ulong bytes_requested, ulong bytes_written, IntPtr data)
|
||||
{
|
||||
byte[] bytes = new byte[bytes_written];
|
||||
Marshal.Copy (buffer, bytes, 0, (int)bytes_written);
|
||||
_managed (new Handle (handle), result, bytes, bytes_requested, bytes_written);
|
||||
}
|
||||
|
||||
internal AsyncWriteCallbackNative NativeDelegate;
|
||||
protected AsyncWriteCallback _managed;
|
||||
|
||||
public AsyncWriteCallbackWrapper (AsyncWriteCallback managed, object o) : base (o)
|
||||
{
|
||||
NativeDelegate = new AsyncWriteCallbackNative (NativeCallback);
|
||||
_managed = managed;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
// Directory.cs - Bindings for gnome-vfs directory functions calls.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class Directory {
|
||||
private Directory () {}
|
||||
|
||||
public static FileInfo[] GetEntries (Uri uri)
|
||||
{
|
||||
return GetEntries (uri.ToString ());
|
||||
}
|
||||
|
||||
public static FileInfo[] GetEntries (Uri uri, FileInfoOptions options)
|
||||
{
|
||||
return GetEntries (uri.ToString (), options);
|
||||
}
|
||||
|
||||
public static FileInfo[] GetEntries (string text_uri)
|
||||
{
|
||||
return GetEntries (text_uri, FileInfoOptions.Default);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_directory_list_load (out IntPtr list, string uri, FileInfoOptions options);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public static void GetEntries (Uri uri, FileInfoOptions options,
|
||||
uint itemsPerNotification, int priority,
|
||||
AsyncDirectoryLoadCallback callback)
|
||||
{
|
||||
GetEntries (uri.ToString (), options, itemsPerNotification, priority, callback);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_make_directory_for_uri (IntPtr raw, uint perm);
|
||||
|
||||
public static Result Create (Uri uri, FilePermissions perm)
|
||||
{
|
||||
return gnome_vfs_make_directory_for_uri (uri.Handle, (uint)perm);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_make_directory (string uri, uint perm);
|
||||
|
||||
public static Result Create (string uri, FilePermissions perm)
|
||||
{
|
||||
return gnome_vfs_make_directory (uri, (uint)perm);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_remove_directory_from_uri (IntPtr raw);
|
||||
|
||||
public static Result Delete (Uri uri)
|
||||
{
|
||||
return gnome_vfs_remove_directory_from_uri (uri.Handle);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_remove_directory (string uri);
|
||||
|
||||
public static Result Delete (string uri)
|
||||
{
|
||||
return gnome_vfs_remove_directory (uri);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,359 +0,0 @@
|
|||
// FileInfo.cs - Class wrapping the GnomeVFSFileInfo struct.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class FileInfo {
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct FileInfoNative {
|
||||
public IntPtr name;
|
||||
public FileInfoFields valid_fields;
|
||||
public FileType type;
|
||||
public FilePermissions permissions;
|
||||
public FileFlags flags;
|
||||
public long dev_t;
|
||||
public long inode;
|
||||
public uint link_count;
|
||||
public uint uid;
|
||||
public uint gid;
|
||||
public long size;
|
||||
public long block_count;
|
||||
public uint io_block_size;
|
||||
public IntPtr atime;
|
||||
public IntPtr mtime;
|
||||
public IntPtr ctime;
|
||||
public IntPtr symlink_name;
|
||||
public IntPtr mime_type;
|
||||
public uint refcount;
|
||||
public IntPtr reserved1;
|
||||
public IntPtr reserved2;
|
||||
public IntPtr reserved3;
|
||||
public IntPtr reserved4;
|
||||
public IntPtr reserved5;
|
||||
}
|
||||
|
||||
IntPtr handle;
|
||||
bool needs_dispose = false;
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_file_info_unref (IntPtr handle);
|
||||
|
||||
~FileInfo ()
|
||||
{
|
||||
if (needs_dispose)
|
||||
gnome_vfs_file_info_unref (Handle);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern IntPtr gnome_vfs_file_info_new ();
|
||||
|
||||
public FileInfo ()
|
||||
{
|
||||
needs_dispose = true;
|
||||
handle = gnome_vfs_file_info_new ();
|
||||
}
|
||||
|
||||
public FileInfo (IntPtr handle)
|
||||
{
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
public FileInfo (string uri) : this (uri, FileInfoOptions.Default) {}
|
||||
|
||||
public FileInfo (string uri, FileInfoOptions options) : this (new Uri (uri), options) {}
|
||||
|
||||
public FileInfo (Uri uri) : this (uri, FileInfoOptions.Default) {}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_get_file_info_uri (IntPtr uri, IntPtr info, int options);
|
||||
|
||||
public FileInfo (Uri uri, FileInfoOptions options) : this ()
|
||||
{
|
||||
Result result = gnome_vfs_get_file_info_uri (uri.Handle, Handle, (int) options);
|
||||
Vfs.ThrowException (uri, result);
|
||||
}
|
||||
|
||||
FileInfoNative Native {
|
||||
get {
|
||||
return (FileInfoNative) Marshal.PtrToStructure (handle, typeof (FileInfoNative));
|
||||
}
|
||||
}
|
||||
|
||||
public IntPtr Handle {
|
||||
get {
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get {
|
||||
FileInfoNative info = Native;
|
||||
if (info.name != IntPtr.Zero)
|
||||
return GLib.Marshaller.Utf8PtrToString (info.name);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public FileInfoFields ValidFields {
|
||||
get {
|
||||
return Native.valid_fields;
|
||||
}
|
||||
}
|
||||
|
||||
public FileType Type {
|
||||
get {
|
||||
if ((ValidFields & FileInfoFields.Type) != 0)
|
||||
return Native.type;
|
||||
else
|
||||
throw new ArgumentException ("Type is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public FilePermissions Permissions {
|
||||
get {
|
||||
if ((ValidFields & FileInfoFields.Permissions) != 0)
|
||||
return Native.permissions;
|
||||
else
|
||||
throw new ArgumentException ("Permissions is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public FileFlags Flags {
|
||||
get {
|
||||
if ((ValidFields & FileInfoFields.Flags) != 0)
|
||||
return Native.flags;
|
||||
else
|
||||
throw new ArgumentException ("Flags is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public long Device {
|
||||
get {
|
||||
if ((ValidFields & FileInfoFields.Device) != 0)
|
||||
return Native.dev_t;
|
||||
else
|
||||
throw new ArgumentException ("Device is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public long Inode {
|
||||
get {
|
||||
if ((ValidFields & FileInfoFields.Inode) != 0)
|
||||
return Native.inode;
|
||||
else
|
||||
throw new ArgumentException ("Inode is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public uint LinkCount {
|
||||
get {
|
||||
if ((ValidFields & FileInfoFields.LinkCount) != 0)
|
||||
return Native.link_count;
|
||||
else
|
||||
throw new ArgumentException ("LinkCount is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public uint Uid {
|
||||
get {
|
||||
return Native.uid;
|
||||
}
|
||||
}
|
||||
|
||||
public uint Gid {
|
||||
get {
|
||||
return Native.gid;
|
||||
}
|
||||
}
|
||||
|
||||
public long Size {
|
||||
get {
|
||||
if ((ValidFields & FileInfoFields.Size) != 0)
|
||||
return Native.size;
|
||||
else
|
||||
throw new ArgumentException ("Size is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public long BlockCount {
|
||||
get {
|
||||
if ((ValidFields & FileInfoFields.BlockCount) != 0)
|
||||
return Native.block_count;
|
||||
else
|
||||
throw new ArgumentException ("BlockCount is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public uint IoBlockSize {
|
||||
get {
|
||||
if ((ValidFields & FileInfoFields.IoBlockSize) != 0)
|
||||
return Native.io_block_size;
|
||||
else
|
||||
throw new ArgumentException ("IoBlockSize is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public System.DateTime Atime {
|
||||
get {
|
||||
if ((ValidFields & FileInfoFields.Atime) != 0)
|
||||
return GLib.Marshaller.time_tToDateTime (Native.atime);
|
||||
else
|
||||
throw new ArgumentException ("Atime is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public System.DateTime Mtime {
|
||||
get {
|
||||
if ((ValidFields & FileInfoFields.Mtime) != 0)
|
||||
return GLib.Marshaller.time_tToDateTime (Native.mtime);
|
||||
else
|
||||
throw new ArgumentException ("Mtime is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public System.DateTime Ctime {
|
||||
get {
|
||||
if ((ValidFields & FileInfoFields.Ctime) != 0)
|
||||
return GLib.Marshaller.time_tToDateTime (Native.ctime);
|
||||
else
|
||||
throw new ArgumentException ("Ctime is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public string SymlinkName {
|
||||
get {
|
||||
FileInfoNative info = Native;
|
||||
if ((ValidFields & FileInfoFields.SymlinkName) != 0 &&
|
||||
info.symlink_name != IntPtr.Zero)
|
||||
return GLib.Marshaller.Utf8PtrToString (info.symlink_name);
|
||||
else
|
||||
throw new ArgumentException ("SymlinkName is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public string MimeType {
|
||||
get {
|
||||
FileInfoNative info = Native;
|
||||
if ((ValidFields & FileInfoFields.MimeType) != 0 &&
|
||||
info.mime_type != IntPtr.Zero)
|
||||
return GLib.Marshaller.Utf8PtrToString (info.mime_type);
|
||||
else
|
||||
throw new ArgumentException ("MimeType is not set");
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSymlink {
|
||||
get {
|
||||
FileFlags flags = Flags;
|
||||
return (flags & FileFlags.Symlink) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsLocal {
|
||||
get {
|
||||
FileFlags flags = Flags;
|
||||
return (flags & FileFlags.Local) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasSuid {
|
||||
get {
|
||||
FilePermissions perms = Permissions;
|
||||
return (perms & FilePermissions.Suid) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasSgid {
|
||||
get {
|
||||
FilePermissions perms = Permissions;
|
||||
return (perms & FilePermissions.Sgid) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSticky {
|
||||
get {
|
||||
FilePermissions perms = Permissions;
|
||||
return (perms & FilePermissions.Sticky) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_file_info_clear (IntPtr info);
|
||||
|
||||
public void Clear ()
|
||||
{
|
||||
gnome_vfs_file_info_clear (Handle);
|
||||
}
|
||||
|
||||
public override String ToString ()
|
||||
{
|
||||
FileInfoNative info = Native;
|
||||
string result = "Name = " + Name + "\n" +
|
||||
"ValidFields = " + info.valid_fields + "\n";
|
||||
if ((ValidFields & FileInfoFields.Type) != 0)
|
||||
result += "Type = " + info.type + "\n";
|
||||
if ((ValidFields & FileInfoFields.Permissions) != 0)
|
||||
result += "Permissions = " + info.permissions + "\n";
|
||||
if ((ValidFields & FileInfoFields.Flags) != 0) {
|
||||
result += "Flags = ";
|
||||
bool flag = false;
|
||||
if (Flags == FileFlags.None) {
|
||||
result += "None";
|
||||
flag = true;
|
||||
}
|
||||
if ((Flags & FileFlags.Symlink) != 0) {
|
||||
result += flag ? ", Symlink" : "Symlink";
|
||||
flag = true;
|
||||
}
|
||||
if ((Flags & FileFlags.Local) != 0)
|
||||
result += flag ? ", Local" : "Local";
|
||||
result += "\n";
|
||||
}
|
||||
if ((ValidFields & FileInfoFields.Device) != 0)
|
||||
result += "Device = " + info.dev_t + "\n";
|
||||
if ((ValidFields & FileInfoFields.Inode) != 0)
|
||||
result += "Inode = " + info.inode + "\n";
|
||||
if ((ValidFields & FileInfoFields.LinkCount) != 0)
|
||||
result += "LinkCount = " + info.link_count + "\n";
|
||||
result += "Uid = " + info.uid + "\n";
|
||||
result += "Gid = " + info.gid + "\n";
|
||||
if ((ValidFields & FileInfoFields.Size) != 0)
|
||||
result += "Size = " + info.size + "\n";
|
||||
if ((ValidFields & FileInfoFields.BlockCount) != 0)
|
||||
result += "BlockCount = " + info.block_count + "\n";
|
||||
if ((ValidFields & FileInfoFields.IoBlockSize) != 0)
|
||||
result += "IoBlockSize = " + info.io_block_size + "\n";
|
||||
if ((ValidFields & FileInfoFields.Atime) != 0)
|
||||
result += "Atime = " + Atime + "\n";
|
||||
if ((ValidFields & FileInfoFields.Mtime) != 0)
|
||||
result += "Mtime = " + Mtime + "\n";
|
||||
if ((ValidFields & FileInfoFields.Ctime) != 0)
|
||||
result += "Ctime = " + Ctime + "\n";
|
||||
if ((ValidFields & FileInfoFields.SymlinkName) != 0)
|
||||
result += "SymlinkName = " + SymlinkName + "\n";
|
||||
if ((ValidFields & FileInfoFields.MimeType) != 0)
|
||||
result += "MimeType = " + MimeType + "\n";
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<metadata>
|
||||
<attr path="/api/namespace" name="name">Gnome.Vfs</attr>
|
||||
<attr path="/api/namespace/alias[@cname='XdgUchar8T']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/alias[@cname='XdgUint16T']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/alias[@cname='XdgUint32T']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/alias[@cname='XdgUnicharT']" name="hidden">1</attr>
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSAsyncCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSAsyncDirectoryLoadCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSAsyncFileControlCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSAsyncGetFileInfoCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSAsyncModuleCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSAsyncOpenAsChannelCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSAsyncReadCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSAsyncSetFileInfoCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSAsyncWriteCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSAsyncXferProgressCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSDirectoryVisitFunc']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSModuleCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSModuleCallbackResponse']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSMonitorCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSProcessCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSProcessInitFunc']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSSniffBufferReadCall']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSSniffBufferSeekCall']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSSocketCloseFunc']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSSocketReadFunc']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSSocketWriteFunc']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSUnixMountCallback']" />
|
||||
<remove-node path="/api/namespace/callback[@cname='GnomeVFSXferProgressCallback']" />
|
||||
<attr path="/api/namespace/callback[@cname='GnomeVFSVolumeOpCallback']/*/*[@type='char*']" name="type">const-char*</attr>
|
||||
<remove-node path="/api/namespace/class[@cname='GnomeVfsAsync_']" />
|
||||
<remove-node path="/api/namespace/class[@cname='GnomeVfsDirectory_']" />
|
||||
<attr path="/api/namespace/class[@cname='GnomeVfsMime_']/method[@name='GetAllApplications']/return-type" name="element_type">GnomeVFSMimeApplication*</attr>
|
||||
<attr path="/api/namespace/class[@cname='GnomeVfsMime_']/method[@name='GetAllApplications']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/class[@cname='GnomeVfsMime_']/method[@name='GetAllApplications']/return-type" name="elements_owned">true</attr>
|
||||
<remove-node path="/api/namespace/class[@cname='GnomeVfsMonitor_']" />
|
||||
<remove-node path="/api/namespace/class[@cname='GnomeVfsXfer_']" />
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSDirectoryVisitOptions']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='Suid']" name="value">1 << 11</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='Sgid']" name="value">1 << 10</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='Sticky']" name="value">1 << 9</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='UserRead']" name="value">1 << 8</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='UserWrite']" name="value">1 << 7</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='UserExec']" name="value">1 << 6</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='UserAll']" name="value">UserRead | UserWrite | UserExec</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='GroupRead']" name="value">1 << 5</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='GroupWrite']" name="value">1 << 4</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='GroupExec']" name="value">1 << 3</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='GroupAll']" name="value">GroupRead | GroupWrite | GroupExec</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='OtherRead']" name="value">1 << 2</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='OtherWrite']" name="value">1 << 1</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='OtherExec']" name="value">1</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFilePermissions']/member[@name='OtherAll']" name="value">OtherRead | OtherWrite | OtherExec</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSFindDirectoryKind']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSMakeURIDirs']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSMonitorEventType']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSProcessOptions']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSProcessResult']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSProcessRunResult']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GnomeVFSURIHideOptions']" name="name">UriHideOptions</attr>
|
||||
<attr path="/api/namespace/enum[@cname='XdgGlobType']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSACE']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSClient']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSClientCall']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSDrive']/method[@name='Ref']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSDrive']/method[@name='Unref']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSMIMEMonitor']" name="name">MimeMonitor</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSVolume']/method[@name='HandlesTrash']" name="name">GetHandlesTrash</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSVolume']/method[@name='Ref']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSVolume']/method[@name='Unref']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSVolumeMonitor']/method[@name='GetConnectedDrives']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSVolumeMonitor']/method[@name='GetMountedVolumes']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSVolumeMonitor']/method[@name='Ref']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSVolumeMonitor']/method[@name='Unref']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSVolumeMonitorClient']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GnomeVFSVolumeMonitorDaemon']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSCancellation']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSContext']/method[@name='Free']" name="deprecated">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSDirectoryHandle']" name="hidden">1</attr>
|
||||
<remove-node path="/api/namespace/struct[@cname='GnomeVFSFileInfo']" />
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSFindDirectoryResult']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSGetFileInfoResult']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSInetConnection']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSMimeAction']/field[@cname='action']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSMimeApplication']/field" name="access">private</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSMimeSniffBuffer']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackAdditionalHeadersIn']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackAdditionalHeadersOut']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackAuthenticationIn']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackAuthenticationOut']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackFillAuthenticationIn']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackFillAuthenticationOut']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackFullAuthenticationIn']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackFullAuthenticationOut']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackReceivedHeadersIn']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackReceivedHeadersOut']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackSaveAuthenticationIn']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackSaveAuthenticationOut']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackStatusMessageIn']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackStatusMessageOut']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSMonitorHandle']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSProcess']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSProgressCallbackState']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSSSL']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSSocket']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSSocketBuffer']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSSocketImpl']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSToplevelURI']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']" name="name">Uri</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='Dup']" name="name">Clone</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='Exists']" name="name">GetExists</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='Equal']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='GetToplevel']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='Hash']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='Hequal']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='ListCopy']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='ListFree']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='ListParse']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='ListRef']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='ListUnref']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSUnixMount']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GnomeVFSUnixMountPoint']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='XdgGlobHash']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='XdgMimeMagic']" name="hidden">1</attr>
|
||||
<add-node path="/api"><symbol type="manual" cname="GnomeVFSFileInfo" name="Gnome.Vfs.FileInfo"/></add-node>
|
||||
</metadata>
|
|
@ -1,51 +0,0 @@
|
|||
SUBDIRS = .
|
||||
|
||||
if ENABLE_GNOMEVFS
|
||||
pkg = gnome-vfs
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = gnome-vfs-sharp-2.0.pc
|
||||
else
|
||||
pkg=
|
||||
endif
|
||||
|
||||
SYMBOLS = gnomevfs-symbols.xml
|
||||
METADATA = Gnomevfs.metadata
|
||||
references = ../glib/glib-sharp.dll
|
||||
|
||||
sources = \
|
||||
Async.cs \
|
||||
AsyncCallback.cs \
|
||||
AsyncCallbackNative.cs \
|
||||
AsyncDirectoryLoadCallback.cs \
|
||||
AsyncDirectoryLoadCallbackNative.cs \
|
||||
AsyncReadCallback.cs \
|
||||
AsyncReadCallbackNative.cs \
|
||||
AsyncWriteCallback.cs \
|
||||
AsyncWriteCallbackNative.cs \
|
||||
Directory.cs \
|
||||
FileInfo.cs \
|
||||
MimeType.cs \
|
||||
ModuleCallback.cs \
|
||||
ModuleCallbackAuthentication.cs \
|
||||
ModuleCallbackFillAuthentication.cs \
|
||||
ModuleCallbackFullAuthentication.cs \
|
||||
ModuleCallbackSaveAuthentication.cs \
|
||||
ModuleCallbackStatusMessage.cs \
|
||||
Monitor.cs \
|
||||
Sync.cs \
|
||||
Vfs.cs \
|
||||
VfsException.cs \
|
||||
VfsStream.cs \
|
||||
VfsStreamAsyncResult.cs \
|
||||
Xfer.cs \
|
||||
XferProgressCallback.cs \
|
||||
XferProgressCallbackNative.cs
|
||||
|
||||
customs = \
|
||||
Uri.custom \
|
||||
VolumeMonitor.custom
|
||||
|
||||
add_dist = gnome-vfs-sharp-2.0.pc.in
|
||||
|
||||
include ../Makefile.include
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
// MimeType.cs - Mime-type bindings.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class MimeType {
|
||||
public static readonly string UnknownMimeType = "application/octet-stream";
|
||||
private string mimetype;
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern IntPtr gnome_vfs_get_mime_type (IntPtr uri);
|
||||
|
||||
public MimeType (Uri uri)
|
||||
{
|
||||
IntPtr uri_native = GLib.Marshaller.StringToPtrGStrdup (uri.ToString ());
|
||||
mimetype = GLib.Marshaller.PtrToStringGFree (gnome_vfs_get_mime_type (uri_native));
|
||||
GLib.Marshaller.Free (uri_native);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern bool gnome_vfs_mime_type_is_known (IntPtr mime_type);
|
||||
|
||||
public MimeType (string mimetype)
|
||||
{
|
||||
IntPtr mimetype_native = GLib.Marshaller.StringToPtrGStrdup (mimetype);
|
||||
if (!gnome_vfs_mime_type_is_known (mimetype_native))
|
||||
throw new ArgumentException ("Unknown mimetype");
|
||||
this.mimetype = mimetype;
|
||||
GLib.Marshaller.Free (mimetype_native);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern IntPtr gnome_vfs_get_mime_type_for_data (ref byte data, int size);
|
||||
|
||||
public MimeType (byte[] buffer, int size)
|
||||
{
|
||||
mimetype = GLib.Marshaller.Utf8PtrToString (gnome_vfs_get_mime_type_for_data (ref buffer[0], size));
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern MimeActionType gnome_vfs_mime_get_default_action_type (IntPtr mime_type);
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern Result gnome_vfs_mime_set_default_action_type (IntPtr mime_type, MimeActionType action_type);
|
||||
|
||||
public MimeActionType DefaultActionType {
|
||||
get {
|
||||
IntPtr mimetype_native = GLib.Marshaller.StringToPtrGStrdup (mimetype);
|
||||
MimeActionType result = gnome_vfs_mime_get_default_action_type (mimetype_native);
|
||||
GLib.Marshaller.Free (mimetype_native);
|
||||
return result;
|
||||
}
|
||||
set {
|
||||
IntPtr mimetype_native = GLib.Marshaller.StringToPtrGStrdup (mimetype);
|
||||
Result result = gnome_vfs_mime_set_default_action_type (mimetype_native, value);
|
||||
GLib.Marshaller.Free (mimetype_native);
|
||||
Vfs.ThrowException (result);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern MimeAction gnome_vfs_mime_get_default_action (IntPtr mime_type);
|
||||
|
||||
public MimeAction DefaultAction {
|
||||
get {
|
||||
IntPtr mimetype_native = GLib.Marshaller.StringToPtrGStrdup (mimetype);
|
||||
MimeAction result = gnome_vfs_mime_get_default_action (mimetype_native);
|
||||
GLib.Marshaller.Free (mimetype_native);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern IntPtr gnome_vfs_mime_get_description (IntPtr mime_type);
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern Result gnome_vfs_mime_set_description (IntPtr mime_type, IntPtr description);
|
||||
|
||||
public string Description {
|
||||
get {
|
||||
IntPtr mimetype_native = GLib.Marshaller.StringToPtrGStrdup (mimetype);
|
||||
string result = GLib.Marshaller.Utf8PtrToString (gnome_vfs_mime_get_description (mimetype_native));
|
||||
GLib.Marshaller.Free (mimetype_native);
|
||||
return result;
|
||||
}
|
||||
set {
|
||||
IntPtr mimetype_native = GLib.Marshaller.StringToPtrGStrdup (mimetype);
|
||||
IntPtr desc_native = GLib.Marshaller.StringToPtrGStrdup (value);
|
||||
Result result = gnome_vfs_mime_set_description (mimetype_native, desc_native);
|
||||
GLib.Marshaller.Free (mimetype_native);
|
||||
GLib.Marshaller.Free (desc_native);
|
||||
Vfs.ThrowException (result);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern IntPtr gnome_vfs_mime_get_icon (IntPtr mime_type);
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern Result gnome_vfs_mime_set_icon (IntPtr mime_type, IntPtr filename);
|
||||
|
||||
public string Icon {
|
||||
get {
|
||||
IntPtr mimetype_native = GLib.Marshaller.StringToPtrGStrdup (mimetype);
|
||||
string result = GLib.Marshaller.Utf8PtrToString (gnome_vfs_mime_get_icon (mimetype_native));
|
||||
GLib.Marshaller.Free (mimetype_native);
|
||||
return result;
|
||||
}
|
||||
set {
|
||||
IntPtr mimetype_native = GLib.Marshaller.StringToPtrGStrdup (mimetype);
|
||||
IntPtr icon_native = GLib.Marshaller.StringToPtrGStrdup (value);
|
||||
Result result = gnome_vfs_mime_set_icon (mimetype_native, icon_native);
|
||||
GLib.Marshaller.Free (mimetype_native);
|
||||
GLib.Marshaller.Free (icon_native);
|
||||
Vfs.ThrowException (result);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern bool gnome_vfs_mime_can_be_executable (IntPtr mime_type);
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern Result gnome_vfs_mime_set_can_be_executable (IntPtr mime_type, bool value);
|
||||
|
||||
public bool CanBeExecutable {
|
||||
get {
|
||||
IntPtr mimetype_native = GLib.Marshaller.StringToPtrGStrdup (mimetype);
|
||||
bool result = gnome_vfs_mime_can_be_executable (mimetype_native);
|
||||
GLib.Marshaller.Free (mimetype_native);
|
||||
return result;
|
||||
}
|
||||
set {
|
||||
IntPtr mimetype_native = GLib.Marshaller.StringToPtrGStrdup (mimetype);
|
||||
Result result = gnome_vfs_mime_set_can_be_executable (mimetype_native, value);
|
||||
GLib.Marshaller.Free (mimetype_native);
|
||||
Vfs.ThrowException (result);
|
||||
}
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get {
|
||||
return mimetype;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return mimetype;
|
||||
}
|
||||
|
||||
public static string GetMimeTypeForUri (string uri)
|
||||
{
|
||||
IntPtr uri_native = GLib.Marshaller.StringToPtrGStrdup (uri.ToString ());
|
||||
string mimetype = GLib.Marshaller.PtrToStringGFree (gnome_vfs_get_mime_type (uri_native));
|
||||
GLib.Marshaller.Free (uri_native);
|
||||
return mimetype;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
// ModuleCallback.cs - GnomeVfsModuleCallback* bindings.
|
||||
//
|
||||
// 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.
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public delegate void ModuleCallbackHandler (ModuleCallback cb);
|
||||
|
||||
abstract public class ModuleCallback {
|
||||
abstract public event ModuleCallbackHandler Callback;
|
||||
|
||||
abstract public void Push ();
|
||||
|
||||
abstract public void Pop ();
|
||||
|
||||
abstract public void SetDefault ();
|
||||
|
||||
abstract public void PushAsync ();
|
||||
|
||||
abstract public void PopAsync ();
|
||||
|
||||
abstract public void SetDefaultAsync ();
|
||||
}
|
||||
}
|
|
@ -1,184 +0,0 @@
|
|||
// ModuleCallbackAuthentication.cs - GnomeVfsModuleCallback* bindings.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class ModuleCallbackAuthentication : ModuleCallback {
|
||||
public enum AuthenticationType {
|
||||
Basic,
|
||||
Digest
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ModuleCallbackAuthenticationIn {
|
||||
public string Uri;
|
||||
public string Realm;
|
||||
public bool PreviousAttemptFailed;
|
||||
public AuthenticationType AuthType;
|
||||
private IntPtr _reserved1;
|
||||
private IntPtr _reserved2;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ModuleCallbackAuthenticationOut {
|
||||
public string Username;
|
||||
public string Password;
|
||||
private IntPtr _reserved1;
|
||||
private IntPtr _reserved2;
|
||||
}
|
||||
|
||||
private delegate void ModuleCallbackAuthenticationNative (ref ModuleCallbackAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackAuthenticationOut authOut, int outSize,
|
||||
IntPtr data);
|
||||
|
||||
private delegate void ModuleCallbackAsyncAuthenticationNative (ref ModuleCallbackAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackAuthenticationOut authOut, int outSize,
|
||||
IntPtr data, IntPtr resp, IntPtr resp_data);
|
||||
|
||||
private string uri;
|
||||
private string realm;
|
||||
private bool previousAttemptFailed;
|
||||
private AuthenticationType authType;
|
||||
private string username;
|
||||
private string password;
|
||||
|
||||
public string Uri {
|
||||
get {
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
|
||||
public string Realm {
|
||||
get {
|
||||
return realm;
|
||||
}
|
||||
}
|
||||
|
||||
public bool PreviousAttemptFailed {
|
||||
get {
|
||||
return previousAttemptFailed;
|
||||
}
|
||||
}
|
||||
|
||||
public AuthenticationType AuthType {
|
||||
get {
|
||||
return authType;
|
||||
}
|
||||
}
|
||||
|
||||
public string Username {
|
||||
set {
|
||||
username = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Password {
|
||||
set {
|
||||
password = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override event ModuleCallbackHandler Callback;
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_push (string callback_name, ModuleCallbackAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void Push ()
|
||||
{
|
||||
gnome_vfs_module_callback_push ("simple-authentication",
|
||||
new ModuleCallbackAuthenticationNative (OnNativeCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_pop (string callback_name);
|
||||
|
||||
public override void Pop ()
|
||||
{
|
||||
gnome_vfs_module_callback_pop ("simple-authentication");
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_set_default (string callback_name, ModuleCallbackAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void SetDefault ()
|
||||
{
|
||||
gnome_vfs_module_callback_set_default ("simple-authentication",
|
||||
new ModuleCallbackAuthenticationNative (OnNativeCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_push (string callback_name, ModuleCallbackAsyncAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void PushAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_push ("simple-authentication",
|
||||
new ModuleCallbackAsyncAuthenticationNative (OnNativeAsyncCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_pop (string callback_name);
|
||||
|
||||
public override void PopAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_pop ("simple-authentication");
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_set_default (string callback_name, ModuleCallbackAsyncAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void SetDefaultAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_set_default ("simple-authentication",
|
||||
new ModuleCallbackAsyncAuthenticationNative (OnNativeAsyncCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
private void OnNativeAsyncCallback (ref ModuleCallbackAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackAuthenticationOut authOut, int outSize,
|
||||
IntPtr data, IntPtr resp, IntPtr resp_data)
|
||||
{
|
||||
OnNativeCallback (ref authIn, inSize, ref authOut, outSize, data);
|
||||
}
|
||||
|
||||
private void OnNativeCallback (ref ModuleCallbackAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackAuthenticationOut authOut, int outSize, IntPtr data)
|
||||
{
|
||||
// Copy the authIn fields.
|
||||
uri = authIn.Uri;
|
||||
realm = authIn.Realm;
|
||||
previousAttemptFailed = authIn.PreviousAttemptFailed;
|
||||
authType = authIn.AuthType;
|
||||
|
||||
// Activate the callback.
|
||||
ModuleCallbackHandler handler = Callback;
|
||||
if (handler != null) {
|
||||
handler (this);
|
||||
// Copy the values back to the authOut.
|
||||
authOut.Username = username;
|
||||
authOut.Password = password;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,227 +0,0 @@
|
|||
// ModuleCallbackFillAuthentication.cs - GnomeVfsModuleCallback* bindings.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class ModuleCallbackFillAuthentication : ModuleCallback {
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ModuleCallbackFillAuthenticationIn {
|
||||
public string Uri;
|
||||
public string Protocol;
|
||||
public string Server;
|
||||
public string Object;
|
||||
public int Port;
|
||||
public string Authtype;
|
||||
public string Username;
|
||||
public string Domain;
|
||||
private IntPtr _reserved1;
|
||||
private IntPtr _reserved2;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ModuleCallbackFillAuthenticationOut {
|
||||
public bool Valid;
|
||||
public string Username;
|
||||
public string Domain;
|
||||
public string Password;
|
||||
private IntPtr _reserved1;
|
||||
private IntPtr _reserved2;
|
||||
}
|
||||
|
||||
private delegate void ModuleCallbackFillAuthenticationNative (ref ModuleCallbackFillAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackFillAuthenticationOut authOut, int outSize,
|
||||
IntPtr data);
|
||||
|
||||
private delegate void ModuleCallbackAsyncFillAuthenticationNative (ref ModuleCallbackFillAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackFillAuthenticationOut authOut, int outSize,
|
||||
IntPtr data, IntPtr resp, IntPtr resp_data);
|
||||
|
||||
// ModuleCallbackFillAuthenticationIn fields.
|
||||
private string uri;
|
||||
private string protocol;
|
||||
private string server;
|
||||
private string obj;
|
||||
private int port;
|
||||
private string authtype;
|
||||
private string username;
|
||||
private string domain;
|
||||
// ModuleCallbackFillAuthenticationOut fields.
|
||||
private bool valid;
|
||||
private string password;
|
||||
|
||||
public string Uri {
|
||||
get {
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
|
||||
public string Protocol {
|
||||
get {
|
||||
return protocol;
|
||||
}
|
||||
}
|
||||
|
||||
public string Server {
|
||||
get {
|
||||
return server;
|
||||
}
|
||||
}
|
||||
|
||||
public string Object {
|
||||
get {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
public int Port {
|
||||
get {
|
||||
return port;
|
||||
}
|
||||
}
|
||||
|
||||
public string AuthType {
|
||||
get {
|
||||
return authtype;
|
||||
}
|
||||
}
|
||||
|
||||
public string Username {
|
||||
get {
|
||||
return username;
|
||||
}
|
||||
set {
|
||||
username = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Domain {
|
||||
get {
|
||||
return domain;
|
||||
}
|
||||
set {
|
||||
domain = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Valid {
|
||||
set {
|
||||
valid = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Password {
|
||||
set {
|
||||
password = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override event ModuleCallbackHandler Callback;
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_push (string callback_name, ModuleCallbackFillAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void Push ()
|
||||
{
|
||||
gnome_vfs_module_callback_push ("fill-authentication",
|
||||
new ModuleCallbackFillAuthenticationNative (OnNativeCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_pop (string callback_name);
|
||||
|
||||
public override void Pop ()
|
||||
{
|
||||
gnome_vfs_module_callback_pop ("fill-authentication");
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_set_default (string callback_name, ModuleCallbackFillAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void SetDefault ()
|
||||
{
|
||||
gnome_vfs_module_callback_set_default ("fill-authentication",
|
||||
new ModuleCallbackFillAuthenticationNative (OnNativeCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_push (string callback_name, ModuleCallbackAsyncFillAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void PushAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_push ("fill-authentication",
|
||||
new ModuleCallbackAsyncFillAuthenticationNative (OnNativeAsyncCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_pop (string callback_name);
|
||||
|
||||
public override void PopAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_pop ("fill-authentication");
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_set_default (string callback_name, ModuleCallbackAsyncFillAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void SetDefaultAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_set_default ("fill-authentication",
|
||||
new ModuleCallbackAsyncFillAuthenticationNative (OnNativeAsyncCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
private void OnNativeAsyncCallback (ref ModuleCallbackFillAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackFillAuthenticationOut authOut, int outSize,
|
||||
IntPtr data, IntPtr resp, IntPtr resp_data)
|
||||
{
|
||||
OnNativeCallback (ref authIn, inSize, ref authOut, outSize, data);
|
||||
}
|
||||
|
||||
private void OnNativeCallback (ref ModuleCallbackFillAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackFillAuthenticationOut authOut, int outSize, IntPtr data)
|
||||
{
|
||||
// Copy the authIn fields.
|
||||
uri = authIn.Uri;
|
||||
protocol = authIn.Protocol;
|
||||
server = authIn.Server;
|
||||
obj = authIn.Object;
|
||||
port = authIn.Port;
|
||||
authtype = authIn.Authtype;
|
||||
username = authIn.Username;
|
||||
domain = authIn.Domain;
|
||||
|
||||
// Activate the callback.
|
||||
ModuleCallbackHandler handler = Callback;
|
||||
if (handler != null) {
|
||||
handler (this);
|
||||
// Copy the values back to the authOut.
|
||||
authOut.Valid = valid;
|
||||
authOut.Username = username;
|
||||
authOut.Domain = domain;
|
||||
authOut.Password = password;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,287 +0,0 @@
|
|||
// ModuleCallbackFullAuthentication.cs - GnomeVfsModuleCallback* bindings.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class ModuleCallbackFullAuthentication : ModuleCallback {
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ModuleCallbackFullAuthenticationIn {
|
||||
public ModuleCallbackFullAuthenticationFlags Flags;
|
||||
public string Uri;
|
||||
public string Protocol;
|
||||
public string Server;
|
||||
public string Object;
|
||||
public int Port;
|
||||
public string Authtype;
|
||||
public string Username;
|
||||
public string Domain;
|
||||
public string DefaultUser;
|
||||
public string DefaultDomain;
|
||||
private IntPtr _reserved1;
|
||||
private IntPtr _reserved2;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ModuleCallbackFullAuthenticationOut {
|
||||
public bool AbortAuth;
|
||||
public string Username;
|
||||
public string Domain;
|
||||
public string Password;
|
||||
public bool SavePassword;
|
||||
public string Keyring;
|
||||
private IntPtr _reserved1;
|
||||
private IntPtr _reserved2;
|
||||
}
|
||||
|
||||
private delegate void ModuleCallbackFullAuthenticationNative (ref ModuleCallbackFullAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackFullAuthenticationOut authOut, int outSize,
|
||||
IntPtr data);
|
||||
|
||||
private delegate void ModuleCallbackAsyncFullAuthenticationNative (ref ModuleCallbackFullAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackFullAuthenticationOut authOut, int outSize,
|
||||
IntPtr data, IntPtr resp, IntPtr resp_data);
|
||||
|
||||
// ModuleCallbackFullAuthenticationIn fields.
|
||||
private ModuleCallbackFullAuthenticationFlags flags;
|
||||
private string uri;
|
||||
private string protocol;
|
||||
private string server;
|
||||
private string obj;
|
||||
private int port;
|
||||
private string authtype;
|
||||
private string username;
|
||||
private string domain;
|
||||
private string defaultUser;
|
||||
private string defaultDomain;
|
||||
// ModuleCallbackFullAuthenticationOut fields.
|
||||
private bool abortAuth;
|
||||
private string password;
|
||||
private bool savePassword;
|
||||
private string keyring;
|
||||
|
||||
public ModuleCallbackFullAuthenticationFlags Flags {
|
||||
get {
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
|
||||
public string Uri {
|
||||
get {
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
|
||||
public string Protocol {
|
||||
get {
|
||||
return protocol;
|
||||
}
|
||||
}
|
||||
|
||||
public string Server {
|
||||
get {
|
||||
return server;
|
||||
}
|
||||
}
|
||||
|
||||
public string Object {
|
||||
get {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
public int Port {
|
||||
get {
|
||||
return port;
|
||||
}
|
||||
}
|
||||
|
||||
public string AuthType {
|
||||
get {
|
||||
return authtype;
|
||||
}
|
||||
}
|
||||
|
||||
public string Username {
|
||||
get {
|
||||
return username;
|
||||
}
|
||||
set {
|
||||
username = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Domain {
|
||||
get {
|
||||
return domain;
|
||||
}
|
||||
set {
|
||||
domain = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string DefaultUser {
|
||||
get {
|
||||
return defaultUser;
|
||||
}
|
||||
}
|
||||
|
||||
public string DefaultDomain {
|
||||
get {
|
||||
return defaultDomain;
|
||||
}
|
||||
}
|
||||
|
||||
public bool AbortAuth {
|
||||
set {
|
||||
abortAuth = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Password {
|
||||
set {
|
||||
password = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool SavePassword {
|
||||
set {
|
||||
savePassword = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Keyring {
|
||||
set {
|
||||
keyring = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override event ModuleCallbackHandler Callback;
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_push (string callback_name, ModuleCallbackFullAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void Push ()
|
||||
{
|
||||
gnome_vfs_module_callback_push ("full-authentication",
|
||||
new ModuleCallbackFullAuthenticationNative (OnNativeCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_pop (string callback_name);
|
||||
|
||||
public override void Pop ()
|
||||
{
|
||||
gnome_vfs_module_callback_pop ("full-authentication");
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_set_default (string callback_name, ModuleCallbackFullAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void SetDefault ()
|
||||
{
|
||||
gnome_vfs_module_callback_set_default ("full-authentication",
|
||||
new ModuleCallbackFullAuthenticationNative (OnNativeCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_push (string callback_name, ModuleCallbackAsyncFullAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void PushAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_push ("full-authentication",
|
||||
new ModuleCallbackAsyncFullAuthenticationNative (OnNativeAsyncCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_pop (string callback_name);
|
||||
|
||||
public override void PopAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_pop ("full-authentication");
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_set_default (string callback_name, ModuleCallbackAsyncFullAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void SetDefaultAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_set_default ("full-authentication",
|
||||
new ModuleCallbackAsyncFullAuthenticationNative (OnNativeAsyncCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
private void OnNativeAsyncCallback (ref ModuleCallbackFullAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackFullAuthenticationOut authOut, int outSize,
|
||||
IntPtr data, IntPtr resp, IntPtr resp_data)
|
||||
{
|
||||
OnNativeCallback (ref authIn, inSize, ref authOut, outSize, data);
|
||||
}
|
||||
|
||||
private void OnNativeCallback (ref ModuleCallbackFullAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackFullAuthenticationOut authOut, int outSize, IntPtr data)
|
||||
{
|
||||
// Copy the authIn fields.
|
||||
flags = authIn.Flags;
|
||||
uri = authIn.Uri;
|
||||
protocol = authIn.Protocol;
|
||||
server = authIn.Server;
|
||||
obj = authIn.Object;
|
||||
port = authIn.Port;
|
||||
authtype = authIn.Authtype;
|
||||
username = authIn.Username;
|
||||
domain = authIn.Domain;
|
||||
defaultUser = authIn.DefaultUser;
|
||||
defaultDomain = authIn.DefaultDomain;
|
||||
|
||||
// Activate the callback.
|
||||
ModuleCallbackHandler handler = Callback;
|
||||
if (handler != null) {
|
||||
handler (this);
|
||||
// Copy the values back to the authOut.
|
||||
authOut.AbortAuth = abortAuth;
|
||||
authOut.Username = username;
|
||||
authOut.Domain = domain;
|
||||
authOut.Password = password;
|
||||
authOut.SavePassword = savePassword;
|
||||
authOut.Keyring = keyring;
|
||||
}
|
||||
}
|
||||
|
||||
private void DumpAuthIn (ref ModuleCallbackFullAuthenticationIn authIn)
|
||||
{
|
||||
Console.WriteLine ("Flags: {0}", authIn.Flags);
|
||||
Console.WriteLine ("Uri: {0}", authIn.Uri);
|
||||
Console.WriteLine ("Protocol: {0}", authIn.Protocol);
|
||||
Console.WriteLine ("Server: {0}", authIn.Server);
|
||||
Console.WriteLine ("Object: {0}", authIn.Object);
|
||||
Console.WriteLine ("Port: {0}", authIn.Port);
|
||||
Console.WriteLine ("Authtype: {0}", authIn.Authtype);
|
||||
Console.WriteLine ("Username: {0}", authIn.Username);
|
||||
Console.WriteLine ("Domain: {0}", authIn.Domain);
|
||||
Console.WriteLine ("DefaultUser: {0}", authIn.DefaultUser);
|
||||
Console.WriteLine ("DefaultDomain: {0}", authIn.DefaultDomain);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,221 +0,0 @@
|
|||
// ModuleCallbackSaveAuthentication.cs - GnomeVfsModuleCallback* bindings.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class ModuleCallbackSaveAuthentication : ModuleCallback {
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ModuleCallbackSaveAuthenticationIn {
|
||||
public string Keyring;
|
||||
public string Uri;
|
||||
public string Protocol;
|
||||
public string Server;
|
||||
public string Object;
|
||||
public int Port;
|
||||
public string Authtype;
|
||||
public string Username;
|
||||
public string Domain;
|
||||
public string Password;
|
||||
private IntPtr _reserved1;
|
||||
private IntPtr _reserved2;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ModuleCallbackSaveAuthenticationOut {
|
||||
private IntPtr _reserved1;
|
||||
private IntPtr _reserved2;
|
||||
}
|
||||
|
||||
private delegate void ModuleCallbackSaveAuthenticationNative (ref ModuleCallbackSaveAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackSaveAuthenticationOut authOut, int outSize,
|
||||
IntPtr data);
|
||||
|
||||
private delegate void ModuleCallbackAsyncSaveAuthenticationNative (ref ModuleCallbackSaveAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackSaveAuthenticationOut authOut, int outSize,
|
||||
IntPtr data, IntPtr resp, IntPtr resp_data);
|
||||
|
||||
// ModuleCallbackSaveAuthenticationIn fields.
|
||||
private string keyring;
|
||||
private string uri;
|
||||
private string protocol;
|
||||
private string server;
|
||||
private string obj;
|
||||
private int port;
|
||||
private string authtype;
|
||||
private string username;
|
||||
private string domain;
|
||||
private string password;
|
||||
|
||||
public string Keyring {
|
||||
get {
|
||||
return keyring;
|
||||
}
|
||||
}
|
||||
|
||||
public string Uri {
|
||||
get {
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
|
||||
public string Protocol {
|
||||
get {
|
||||
return protocol;
|
||||
}
|
||||
}
|
||||
|
||||
public string Server {
|
||||
get {
|
||||
return server;
|
||||
}
|
||||
}
|
||||
|
||||
public string Object {
|
||||
get {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
public int Port {
|
||||
get {
|
||||
return port;
|
||||
}
|
||||
}
|
||||
|
||||
public string AuthType {
|
||||
get {
|
||||
return authtype;
|
||||
}
|
||||
}
|
||||
|
||||
public string Username {
|
||||
get {
|
||||
return username;
|
||||
}
|
||||
set {
|
||||
username = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Domain {
|
||||
get {
|
||||
return domain;
|
||||
}
|
||||
set {
|
||||
domain = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Password {
|
||||
get {
|
||||
return password;
|
||||
}
|
||||
}
|
||||
|
||||
public override event ModuleCallbackHandler Callback;
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_push (string callback_name, ModuleCallbackSaveAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void Push ()
|
||||
{
|
||||
gnome_vfs_module_callback_push ("save-authentication",
|
||||
new ModuleCallbackSaveAuthenticationNative (OnNativeCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_pop (string callback_name);
|
||||
|
||||
public override void Pop ()
|
||||
{
|
||||
gnome_vfs_module_callback_pop ("save-authentication");
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_set_default (string callback_name, ModuleCallbackSaveAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void SetDefault ()
|
||||
{
|
||||
gnome_vfs_module_callback_set_default ("save-authentication",
|
||||
new ModuleCallbackSaveAuthenticationNative (OnNativeCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_push (string callback_name, ModuleCallbackAsyncSaveAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void PushAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_push ("save-authentication",
|
||||
new ModuleCallbackAsyncSaveAuthenticationNative (OnNativeAsyncCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_pop (string callback_name);
|
||||
|
||||
public override void PopAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_pop ("save-authentication");
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_set_default (string callback_name, ModuleCallbackAsyncSaveAuthenticationNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void SetDefaultAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_set_default ("save-authentication",
|
||||
new ModuleCallbackAsyncSaveAuthenticationNative (OnNativeAsyncCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
private void OnNativeAsyncCallback (ref ModuleCallbackSaveAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackSaveAuthenticationOut authOut, int outSize,
|
||||
IntPtr data, IntPtr resp, IntPtr resp_data)
|
||||
{
|
||||
OnNativeCallback (ref authIn, inSize, ref authOut, outSize, data);
|
||||
}
|
||||
|
||||
private void OnNativeCallback (ref ModuleCallbackSaveAuthenticationIn authIn, int inSize,
|
||||
ref ModuleCallbackSaveAuthenticationOut authOut, int outSize, IntPtr data)
|
||||
{
|
||||
// Copy the authIn fields.
|
||||
keyring = authIn.Keyring;
|
||||
uri = authIn.Uri;
|
||||
protocol = authIn.Protocol;
|
||||
server = authIn.Server;
|
||||
obj = authIn.Object;
|
||||
port = authIn.Port;
|
||||
authtype = authIn.Authtype;
|
||||
username = authIn.Username;
|
||||
domain = authIn.Domain;
|
||||
password = authIn.Password;
|
||||
|
||||
// Activate the callback.
|
||||
ModuleCallbackHandler handler = Callback;
|
||||
if (handler != null) {
|
||||
handler (this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
// ModuleCallbackStatusMessage.cs - GnomeVfsModuleCallback* bindings.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class ModuleCallbackStatusMessage : ModuleCallback {
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ModuleCallbackStatusMessageIn {
|
||||
public string Uri;
|
||||
public string Message;
|
||||
public int Percentage;
|
||||
private IntPtr _reserved1;
|
||||
private IntPtr _reserved2;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ModuleCallbackStatusMessageOut {
|
||||
private int Dummy;
|
||||
private IntPtr _reserved1;
|
||||
private IntPtr _reserved2;
|
||||
}
|
||||
|
||||
private delegate void ModuleCallbackStatusMessageNative (ref ModuleCallbackStatusMessageIn authIn, int inSize,
|
||||
ref ModuleCallbackStatusMessageOut authOut, int outSize,
|
||||
IntPtr data);
|
||||
|
||||
private delegate void ModuleCallbackAsyncStatusMessageNative (ref ModuleCallbackStatusMessageIn authIn, int inSize,
|
||||
ref ModuleCallbackStatusMessageOut authOut, int outSize,
|
||||
IntPtr data, IntPtr resp, IntPtr resp_data);
|
||||
|
||||
// ModuleCallbackStatusMessageIn fields.
|
||||
private string uri;
|
||||
private string message;
|
||||
private int percentage;
|
||||
|
||||
public string Uri {
|
||||
get {
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
|
||||
public string Message {
|
||||
get {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
public int Percentage {
|
||||
get {
|
||||
return percentage;
|
||||
}
|
||||
}
|
||||
|
||||
public override event ModuleCallbackHandler Callback;
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_push (string callback_name, ModuleCallbackStatusMessageNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void Push ()
|
||||
{
|
||||
gnome_vfs_module_callback_push ("status-message",
|
||||
new ModuleCallbackStatusMessageNative (OnNativeCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_pop (string callback_name);
|
||||
|
||||
public override void Pop ()
|
||||
{
|
||||
gnome_vfs_module_callback_pop ("status-message");
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_module_callback_set_default (string callback_name, ModuleCallbackStatusMessageNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void SetDefault ()
|
||||
{
|
||||
gnome_vfs_module_callback_set_default ("status-message",
|
||||
new ModuleCallbackStatusMessageNative (OnNativeCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_push (string callback_name, ModuleCallbackAsyncStatusMessageNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void PushAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_push ("status-message",
|
||||
new ModuleCallbackAsyncStatusMessageNative (OnNativeAsyncCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_pop (string callback_name);
|
||||
|
||||
public override void PopAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_pop ("status-message");
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern void gnome_vfs_async_module_callback_set_default (string callback_name, ModuleCallbackAsyncStatusMessageNative callback, IntPtr data, IntPtr destroy);
|
||||
|
||||
public override void SetDefaultAsync ()
|
||||
{
|
||||
gnome_vfs_async_module_callback_set_default ("status-message",
|
||||
new ModuleCallbackAsyncStatusMessageNative (OnNativeAsyncCallback),
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
private void OnNativeAsyncCallback (ref ModuleCallbackStatusMessageIn authIn, int inSize,
|
||||
ref ModuleCallbackStatusMessageOut authOut, int outSize,
|
||||
IntPtr data, IntPtr resp, IntPtr resp_data)
|
||||
{
|
||||
OnNativeCallback (ref authIn, inSize, ref authOut, outSize, data);
|
||||
}
|
||||
|
||||
private void OnNativeCallback (ref ModuleCallbackStatusMessageIn authIn, int inSize,
|
||||
ref ModuleCallbackStatusMessageOut authOut, int outSize, IntPtr data)
|
||||
{
|
||||
// Copy the authIn fields.
|
||||
uri = authIn.Uri;
|
||||
message = authIn.Message;
|
||||
percentage = authIn.Percentage;
|
||||
|
||||
// Activate the callback.
|
||||
ModuleCallbackHandler handler = Callback;
|
||||
if (handler != null) {
|
||||
handler (this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,124 +0,0 @@
|
|||
// Monitor.cs - gnome_vfs_monitor_* bindings.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public delegate void MonitorHandler (string monitor, string uri);
|
||||
|
||||
internal delegate void MonitorCallback (string monitorUri, string uri, MonitorEventType eventType);
|
||||
|
||||
internal delegate void MonitorCallbackNative (IntPtr handle, string monitorUri, string uri, MonitorEventType eventType, IntPtr data);
|
||||
|
||||
internal class MonitorCallbackWrapper : GLib.DelegateWrapper {
|
||||
|
||||
public void NativeCallback (IntPtr handle, string monitorUri, string uri, MonitorEventType eventType, IntPtr data)
|
||||
{
|
||||
_managed (monitorUri, uri, eventType);
|
||||
}
|
||||
|
||||
internal MonitorCallbackNative NativeDelegate;
|
||||
protected MonitorCallback _managed;
|
||||
|
||||
public MonitorCallbackWrapper (MonitorCallback managed, object o) : base (o)
|
||||
{
|
||||
NativeDelegate = new MonitorCallbackNative (NativeCallback);
|
||||
_managed = managed;
|
||||
}
|
||||
}
|
||||
|
||||
internal enum MonitorEventType {
|
||||
Changed,
|
||||
Deleted,
|
||||
Startexecuting,
|
||||
Stopexecuting,
|
||||
Created,
|
||||
MetadataChanged,
|
||||
}
|
||||
|
||||
public class Monitor {
|
||||
private IntPtr handle;
|
||||
private MonitorCallbackWrapper wrapper;
|
||||
|
||||
public event MonitorHandler Changed;
|
||||
public event MonitorHandler Deleted;
|
||||
public event MonitorHandler Startexecuting;
|
||||
public event MonitorHandler Stopexecuting;
|
||||
public event MonitorHandler Created;
|
||||
public event MonitorHandler MetadataChanged;
|
||||
|
||||
public Monitor ()
|
||||
{
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_monitor_add (out IntPtr handle, string uri, MonitorType type, MonitorCallbackNative callback, IntPtr user_data);
|
||||
|
||||
public Result Add (string uri, MonitorType type)
|
||||
{
|
||||
handle = IntPtr.Zero;
|
||||
if (wrapper == null)
|
||||
wrapper = new MonitorCallbackWrapper (new MonitorCallback (OnMonitorEvent), null);
|
||||
Result result = gnome_vfs_monitor_add (out handle, uri, type, wrapper.NativeDelegate, IntPtr.Zero);
|
||||
return result;
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_monitor_cancel (IntPtr handle);
|
||||
|
||||
public Result Cancel ()
|
||||
{
|
||||
if (handle == IntPtr.Zero)
|
||||
throw new InvalidOperationException ("Nothing to cancel");
|
||||
|
||||
return gnome_vfs_monitor_cancel (handle);
|
||||
}
|
||||
|
||||
private void OnMonitorEvent (string monitorUri, string uri, MonitorEventType eventType)
|
||||
{
|
||||
MonitorHandler handler = null;
|
||||
|
||||
switch (eventType) {
|
||||
case MonitorEventType.Changed:
|
||||
handler = Changed;
|
||||
break;
|
||||
case MonitorEventType.Deleted:
|
||||
handler = Deleted;
|
||||
break;
|
||||
case MonitorEventType.Startexecuting:
|
||||
handler = Startexecuting;
|
||||
break;
|
||||
case MonitorEventType.Stopexecuting:
|
||||
handler = Stopexecuting;
|
||||
break;
|
||||
case MonitorEventType.Created:
|
||||
handler = Created;
|
||||
break;
|
||||
case MonitorEventType.MetadataChanged:
|
||||
handler = MetadataChanged;
|
||||
break;
|
||||
}
|
||||
|
||||
if (handler != null)
|
||||
handler (monitorUri, uri);
|
||||
}
|
||||
}
|
||||
}
|
156
gnomevfs/Sync.cs
156
gnomevfs/Sync.cs
|
@ -1,156 +0,0 @@
|
|||
// Sync.cs - Bindings for gnome-vfs synchronized file operations.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class Sync {
|
||||
private Sync () {}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_close (IntPtr handle);
|
||||
|
||||
public static Result Close (Handle handle)
|
||||
{
|
||||
return gnome_vfs_close (handle.Handle);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_create (out IntPtr handle, string uri, OpenMode mode, bool exclusive, uint perm);
|
||||
|
||||
public static Handle Create (string uri, OpenMode mode, bool exclusive, FilePermissions perm)
|
||||
{
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
Result result = gnome_vfs_create (out handle, uri, mode, exclusive, (uint)perm);
|
||||
if (result != Result.Ok) {
|
||||
Vfs.ThrowException (uri, result);
|
||||
return null;
|
||||
} else {
|
||||
return new Handle (handle);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_create_uri (out IntPtr handle, IntPtr uri, OpenMode mode, bool exclusive, uint perm);
|
||||
|
||||
public static Handle Create (Uri uri, OpenMode mode, bool exclusive, FilePermissions perm)
|
||||
{
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
Result result = gnome_vfs_create_uri (out handle, uri.Handle, mode, exclusive, (uint)perm);
|
||||
if (result != Result.Ok) {
|
||||
Vfs.ThrowException (uri, result);
|
||||
return null;
|
||||
} else {
|
||||
return new Handle (handle);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_open (out IntPtr handle, string uri, OpenMode mode);
|
||||
|
||||
public static Handle Open (string uri, OpenMode mode)
|
||||
{
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
Result result = gnome_vfs_open (out handle, uri, mode);
|
||||
if (result != Result.Ok) {
|
||||
Vfs.ThrowException (uri, result);
|
||||
return null;
|
||||
} else {
|
||||
return new Handle (handle);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_open_uri (out IntPtr handle, IntPtr uri, OpenMode mode);
|
||||
|
||||
public static Handle Open (Uri uri, OpenMode mode)
|
||||
{
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
Result result = gnome_vfs_open_uri (out handle, uri.Handle, mode);
|
||||
if (result != Result.Ok) {
|
||||
Vfs.ThrowException (uri, result);
|
||||
return null;
|
||||
} else {
|
||||
return new Handle (handle);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_read (IntPtr handle, out byte buffer, ulong bytes, out ulong bytes_read);
|
||||
|
||||
public static Result Read (Handle handle, out byte buffer, ulong bytes, out ulong bytes_read)
|
||||
{
|
||||
return gnome_vfs_read (handle.Handle, out buffer, bytes, out bytes_read);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_seek (IntPtr handle, SeekPosition whence, long offset);
|
||||
|
||||
public static Result Seek (Handle handle, SeekPosition whence, long offset)
|
||||
{
|
||||
return gnome_vfs_seek (handle.Handle, whence, offset);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_write (IntPtr handle, out byte buffer, ulong bytes, out ulong bytes_written);
|
||||
|
||||
public static Result Write (Handle handle, out byte buffer, ulong bytes, out ulong bytes_written)
|
||||
{
|
||||
return gnome_vfs_write (handle.Handle, out buffer, bytes, out bytes_written);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_tell (IntPtr handle, out ulong offset);
|
||||
|
||||
public static Result Tell (Handle handle, out ulong offset)
|
||||
{
|
||||
return gnome_vfs_tell (handle.Handle, out offset);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_truncate (string uri, ulong length);
|
||||
|
||||
public static Result Truncate (string uri, ulong length)
|
||||
{
|
||||
return gnome_vfs_truncate (uri, length);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_truncate_handle (IntPtr handle, ulong length);
|
||||
|
||||
public static Result Truncate (Handle handle, ulong length)
|
||||
{
|
||||
return gnome_vfs_truncate_handle (handle.Handle, length);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_file_control (IntPtr handle, string operation, out string data);
|
||||
|
||||
// TODO: data parameter only works when you want a string back,
|
||||
// like in the case of a "file:test" operation. Unknown at this
|
||||
// time what other possible uses/parameters this method has.
|
||||
public static Result FileControl (Handle handle, string operation, out string data)
|
||||
{
|
||||
return gnome_vfs_file_control (handle.Handle, operation, out data);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
// 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, IntPtr info, SetFileInfoMask mask);
|
||||
|
||||
public Result SetFileInfo (FileInfo info, SetFileInfoMask mask)
|
||||
{
|
||||
return gnome_vfs_set_file_info_uri (Handle, info.Handle, 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 IntPtr gnome_vfs_get_local_path_from_uri (IntPtr uri);
|
||||
|
||||
public static string GetLocalPathFromUri (string uri)
|
||||
{
|
||||
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (uri);
|
||||
IntPtr result = gnome_vfs_get_local_path_from_uri (native);
|
||||
GLib.Marshaller.Free (native);
|
||||
return GLib.Marshaller.PtrToStringGFree (result);
|
||||
}
|
||||
|
||||
[DllImport("gnomevfs-2")]
|
||||
static extern IntPtr gnome_vfs_get_uri_from_local_path (IntPtr path);
|
||||
|
||||
public static string GetUriFromLocalPath (string path)
|
||||
{
|
||||
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (path);
|
||||
IntPtr result = gnome_vfs_get_uri_from_local_path (native);
|
||||
GLib.Marshaller.Free (native);
|
||||
return GLib.Marshaller.PtrToStringGFree (result);
|
||||
}
|
||||
|
||||
[DllImport("gnomevfs-2")]
|
||||
static extern IntPtr gnome_vfs_uri_list_parse(IntPtr uri_list);
|
||||
|
||||
public static Uri[] ParseList (string uri_list) {
|
||||
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (uri_list);
|
||||
IntPtr raw_ret = gnome_vfs_uri_list_parse(native);
|
||||
GLib.Marshaller.Free (native);
|
||||
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;
|
||||
}
|
112
gnomevfs/Vfs.cs
112
gnomevfs/Vfs.cs
|
@ -1,112 +0,0 @@
|
|||
// Vfs.cs - Generic gnome-vfs method bindings.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class Vfs {
|
||||
private Vfs () {}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern bool gnome_vfs_init ();
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern bool gnome_vfs_initialized ();
|
||||
|
||||
public static bool Initialized {
|
||||
get {
|
||||
return gnome_vfs_initialized ();
|
||||
}
|
||||
}
|
||||
|
||||
static Vfs ()
|
||||
{
|
||||
if (!gnome_vfs_initialized ())
|
||||
gnome_vfs_init ();
|
||||
}
|
||||
|
||||
public static bool Initialize ()
|
||||
{
|
||||
return gnome_vfs_init ();
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
static extern void gnome_vfs_shutdown ();
|
||||
|
||||
public static void Shutdown ()
|
||||
{
|
||||
gnome_vfs_shutdown ();
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_move (string old_uri, string new_uri, bool force_replace);
|
||||
|
||||
public static Result Move (string source, string dest, bool force_replace)
|
||||
{
|
||||
return gnome_vfs_move (source, dest, force_replace);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern IntPtr gnome_vfs_result_to_string (int result);
|
||||
|
||||
public static string ResultToString (Result result)
|
||||
{
|
||||
return ResultToString ((int)result);
|
||||
}
|
||||
|
||||
internal static string ResultToString (int result)
|
||||
{
|
||||
IntPtr ptr = gnome_vfs_result_to_string (result);
|
||||
return GLib.Marshaller.Utf8PtrToString (ptr);
|
||||
}
|
||||
|
||||
public static void ThrowException (Result result)
|
||||
{
|
||||
ThrowException ((string)null, result);
|
||||
}
|
||||
|
||||
public static void ThrowException (Uri uri, Result result)
|
||||
{
|
||||
ThrowException (uri.ToString (), result);
|
||||
}
|
||||
|
||||
public static void ThrowException (string uri, Result result)
|
||||
{
|
||||
switch (result) {
|
||||
case Result.Ok:
|
||||
return;
|
||||
case Result.ErrorNotFound:
|
||||
throw new FileNotFoundException (uri);
|
||||
default:
|
||||
throw new VfsException (result);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern string gnome_vfs_format_file_size_for_display (long size);
|
||||
|
||||
public static string FormatFileSizeForDisplay (long size)
|
||||
{
|
||||
return gnome_vfs_format_file_size_for_display (size);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
// VfsException.cs - VfsException class encapsulating Result.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class VfsException : Exception {
|
||||
private Result result;
|
||||
|
||||
public VfsException (Result result)
|
||||
: base (Vfs.ResultToString (result))
|
||||
{
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public Result Result {
|
||||
get {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,640 +0,0 @@
|
|||
// VfsStream.cs - System.IO.Stream wrapper around gnome-vfs.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using GLib;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
class VfsStreamAsync {
|
||||
private Handle handle;
|
||||
private byte[] buffer;
|
||||
private int count;
|
||||
private int offset;
|
||||
private int bytesRemaining;
|
||||
private System.AsyncCallback cback;
|
||||
private object state;
|
||||
private VfsStreamAsyncResult asyncResult;
|
||||
|
||||
public VfsStreamAsync (Handle handle, byte[] buffer, int offset,
|
||||
int count, System.AsyncCallback cback, object state)
|
||||
{
|
||||
this.handle = handle;
|
||||
this.buffer = buffer;
|
||||
this.offset = offset;
|
||||
this.count = count;
|
||||
this.cback = cback;
|
||||
bytesRemaining = count;
|
||||
}
|
||||
|
||||
public VfsStreamAsyncResult BeginRead ()
|
||||
{
|
||||
asyncResult = new VfsStreamAsyncResult (state);
|
||||
Async.Read (handle, out buffer[offset], (uint)count, new AsyncReadCallback (AsyncRead));
|
||||
return asyncResult;
|
||||
}
|
||||
|
||||
public VfsStreamAsyncResult BeginWrite ()
|
||||
{
|
||||
asyncResult = new VfsStreamAsyncResult (state);
|
||||
Async.Write (handle, out buffer[offset], (uint)count, new AsyncWriteCallback (AsyncWrite));
|
||||
return asyncResult;
|
||||
}
|
||||
|
||||
private void AsyncRead (Handle handle, Result result, byte[] buf,
|
||||
ulong bytesRequested, ulong bytesRead)
|
||||
{
|
||||
if (result == Result.Ok) {
|
||||
Array.Copy (buf, 0, buffer, offset + count - bytesRemaining, (int)bytesRead);
|
||||
bytesRemaining -= (int)bytesRead;
|
||||
if (bytesRemaining > 0) {
|
||||
buf = new byte[bytesRemaining];
|
||||
Async.Read (handle, out buf[0], (uint)bytesRemaining,
|
||||
new AsyncReadCallback (AsyncRead));
|
||||
} else if (cback != null) {
|
||||
asyncResult.SetComplete (null, count);
|
||||
cback (asyncResult);
|
||||
}
|
||||
} else if (result == Result.ErrorEof) {
|
||||
Array.Copy (buf, 0, buffer, offset + count - bytesRemaining, (int)bytesRead);
|
||||
bytesRemaining -= (int)bytesRead;
|
||||
asyncResult.SetComplete (null, count - bytesRemaining);
|
||||
|
||||
if (cback != null)
|
||||
cback (asyncResult);
|
||||
} else if (cback != null) {
|
||||
Exception e = new IOException (Vfs.ResultToString (result));
|
||||
asyncResult.SetComplete (e, -1);
|
||||
cback (asyncResult);
|
||||
}
|
||||
}
|
||||
|
||||
private void AsyncWrite (Handle handle, Result result, byte[] buffer,
|
||||
ulong bytesRequested, ulong bytesWritten)
|
||||
{
|
||||
if (result == Result.Ok) {
|
||||
bytesRemaining -= (int)bytesWritten;
|
||||
if (bytesRemaining > 0) {
|
||||
Async.Write (handle, out buffer[offset + count - bytesRemaining],
|
||||
(uint)bytesRemaining, new AsyncWriteCallback (AsyncWrite));
|
||||
} else if (cback != null) {
|
||||
asyncResult.SetComplete (null, count);
|
||||
cback (asyncResult);
|
||||
}
|
||||
} else if (result == Result.ErrorEof) {
|
||||
bytesRemaining -= (int)bytesWritten;
|
||||
asyncResult.SetComplete (null, count - bytesRemaining);
|
||||
|
||||
if (cback != null)
|
||||
cback (asyncResult);
|
||||
} else if (cback != null) {
|
||||
Exception e = new IOException (Vfs.ResultToString (result));
|
||||
asyncResult.SetComplete (e, -1);
|
||||
cback (asyncResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class VfsStream : System.IO.Stream {
|
||||
private Gnome.Vfs.Uri uri;
|
||||
private Handle handle;
|
||||
private FileMode mode;
|
||||
private FileAccess access;
|
||||
private bool async;
|
||||
private bool canseek;
|
||||
|
||||
// Async state variables.
|
||||
private AsyncCallback callback;
|
||||
private AsyncReadCallback readCallback;
|
||||
private AsyncWriteCallback writeCallback;
|
||||
private bool asyncCompleted = false;
|
||||
private Result asyncResult;
|
||||
private ulong asyncBytesRead;
|
||||
private ulong asyncBytesWritten;
|
||||
|
||||
public VfsStream (string uri, FileMode mode)
|
||||
: this (uri, mode, false) { }
|
||||
|
||||
public VfsStream (string text_uri, FileMode mode, bool async)
|
||||
{
|
||||
if (text_uri == null)
|
||||
throw new ArgumentNullException ("uri");
|
||||
|
||||
if (text_uri == "")
|
||||
throw new ArgumentNullException ("Uri is empty");
|
||||
|
||||
if (mode < FileMode.CreateNew || mode > FileMode.Append)
|
||||
throw new ArgumentOutOfRangeException ("mode");
|
||||
|
||||
if (text_uri.IndexOfAny (Path.InvalidPathChars) != -1)
|
||||
throw new ArgumentException ("Uri has invalid chars");
|
||||
|
||||
uri = new Gnome.Vfs.Uri (text_uri);
|
||||
|
||||
if (mode == FileMode.Open && !uri.Exists)
|
||||
throw new FileNotFoundException ("Could not find uri \"" + text_uri + "\".");
|
||||
|
||||
if (mode == FileMode.CreateNew) {
|
||||
string dname = uri.ExtractDirname ();
|
||||
if (dname != "" && !new Uri (dname).Exists)
|
||||
throw new DirectoryNotFoundException ("Could not find a part of " +
|
||||
"the path \"" + dname + "\".");
|
||||
}
|
||||
|
||||
if (async) {
|
||||
callback = new AsyncCallback (OnAsyncCallback);
|
||||
readCallback = new AsyncReadCallback (OnAsyncReadCallback);
|
||||
writeCallback = new AsyncWriteCallback (OnAsyncWriteCallback);
|
||||
}
|
||||
|
||||
OpenMode om = OpenMode.None;
|
||||
switch (mode) {
|
||||
case FileMode.CreateNew:
|
||||
case FileMode.Create:
|
||||
case FileMode.Truncate:
|
||||
case FileMode.Append:
|
||||
om = OpenMode.Write;
|
||||
access = FileAccess.Write;
|
||||
break;
|
||||
case FileMode.OpenOrCreate:
|
||||
if (uri.Exists) {
|
||||
om = OpenMode.Read;
|
||||
access = FileAccess.Read;
|
||||
} else {
|
||||
om = OpenMode.Write;
|
||||
access = FileAccess.Write;
|
||||
}
|
||||
break;
|
||||
case FileMode.Open:
|
||||
om = OpenMode.Read;
|
||||
access = FileAccess.Read;
|
||||
break;
|
||||
}
|
||||
|
||||
/* 644 */
|
||||
FilePermissions perms = FilePermissions.UserRead |
|
||||
FilePermissions.UserWrite |
|
||||
FilePermissions.GroupRead |
|
||||
FilePermissions.OtherRead;
|
||||
|
||||
Result result;
|
||||
handle = null;
|
||||
switch (mode) {
|
||||
case FileMode.Append:
|
||||
if (uri.Exists) {
|
||||
if (async) {
|
||||
handle = Async.Open (uri, om,
|
||||
(int)Async.Priority.Default,
|
||||
callback);
|
||||
Wait ();
|
||||
Async.Seek (handle, SeekPosition.End, 0, callback);
|
||||
Wait ();
|
||||
} else {
|
||||
handle = Sync.Open (uri, om);
|
||||
result = Sync.Seek (handle, SeekPosition.End, 0);
|
||||
Vfs.ThrowException (uri, result);
|
||||
}
|
||||
} else {
|
||||
if (async) {
|
||||
handle = Async.Create (uri, om, true, perms,
|
||||
(int)Async.Priority.Default,
|
||||
callback);
|
||||
Wait ();
|
||||
} else {
|
||||
handle = Sync.Create (uri, om, true, perms);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FileMode.Create:
|
||||
if (uri.Exists) {
|
||||
if (async) {
|
||||
handle = Async.Open (uri, om,
|
||||
(int)Async.Priority.Default,
|
||||
callback);
|
||||
Wait ();
|
||||
} else {
|
||||
handle = Sync.Open (uri, om);
|
||||
result = uri.Truncate (0);
|
||||
Vfs.ThrowException (uri, result);
|
||||
}
|
||||
} else {
|
||||
handle = Sync.Create (uri, om, true, perms);
|
||||
}
|
||||
break;
|
||||
case FileMode.CreateNew:
|
||||
if (uri.Exists) {
|
||||
throw new IOException ("Uri \"" + text_uri + "\" already exists.");
|
||||
} else {
|
||||
if (async) {
|
||||
handle = Async.Create (uri, om, true, perms,
|
||||
(int)Async.Priority.Default,
|
||||
callback);
|
||||
Wait ();
|
||||
} else {
|
||||
handle = Sync.Create (uri, om, true, perms);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FileMode.Open:
|
||||
if (uri.Exists) {
|
||||
if (async) {
|
||||
handle = Async.Open (uri, om,
|
||||
(int)Async.Priority.Default,
|
||||
callback);
|
||||
Wait ();
|
||||
} else {
|
||||
handle = Sync.Open (uri, om);
|
||||
}
|
||||
} else {
|
||||
throw new FileNotFoundException (text_uri);
|
||||
}
|
||||
break;
|
||||
case FileMode.OpenOrCreate:
|
||||
if (uri.Exists) {
|
||||
if (async) {
|
||||
handle = Async.Open (uri, om,
|
||||
(int)Async.Priority.Default,
|
||||
callback);
|
||||
Wait ();
|
||||
} else {
|
||||
handle = Sync.Open (uri, om);
|
||||
}
|
||||
} else {
|
||||
if (async) {
|
||||
handle = Async.Create (uri, om, true, perms,
|
||||
(int)Async.Priority.Default,
|
||||
callback);
|
||||
Wait ();
|
||||
} else {
|
||||
handle = Sync.Create (uri, om, true, perms);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FileMode.Truncate:
|
||||
if (uri.Exists) {
|
||||
result = uri.Truncate (0);
|
||||
if (async) {
|
||||
handle = Async.Open (uri, om,
|
||||
(int)Async.Priority.Default,
|
||||
callback);
|
||||
Wait ();
|
||||
} else {
|
||||
handle = Sync.Open (uri, om);
|
||||
Vfs.ThrowException (uri, result);
|
||||
}
|
||||
} else {
|
||||
throw new FileNotFoundException (text_uri);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
this.mode = mode;
|
||||
this.canseek = true;
|
||||
this.async = async;
|
||||
}
|
||||
|
||||
public override bool CanRead {
|
||||
get {
|
||||
return access == FileAccess.Read ||
|
||||
access == FileAccess.ReadWrite;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanWrite {
|
||||
get {
|
||||
return access == FileAccess.Write ||
|
||||
access == FileAccess.ReadWrite;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanSeek {
|
||||
get {
|
||||
return canseek;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsAsync {
|
||||
get {
|
||||
return async;
|
||||
}
|
||||
}
|
||||
|
||||
public string Uri {
|
||||
get {
|
||||
return uri.ToString ();
|
||||
}
|
||||
}
|
||||
|
||||
public override long Length {
|
||||
get {
|
||||
FileInfo info = uri.GetFileInfo ();
|
||||
return info.Size;
|
||||
}
|
||||
}
|
||||
|
||||
public override long Position {
|
||||
get {
|
||||
if (IsAsync)
|
||||
throw new NotSupportedException ("Cannot tell what the offset is in async mode");
|
||||
ulong pos;
|
||||
Result result = Sync.Tell (handle, out pos);
|
||||
Vfs.ThrowException (Uri, result);
|
||||
return (long)pos;
|
||||
}
|
||||
set {
|
||||
Seek (value, SeekOrigin.Begin);
|
||||
}
|
||||
}
|
||||
|
||||
public override int ReadByte ()
|
||||
{
|
||||
if (!CanRead)
|
||||
throw new NotSupportedException ("The stream does not support reading");
|
||||
|
||||
byte[] buffer = new byte[1];
|
||||
ulong bytesRead;
|
||||
Result result;
|
||||
if (async) {
|
||||
Async.Read (handle, out buffer[0], 1, readCallback);
|
||||
Wait ();
|
||||
result = asyncResult;
|
||||
} else {
|
||||
result = Sync.Read (handle, out buffer[0], 1UL, out bytesRead);
|
||||
}
|
||||
if (result == Result.ErrorEof)
|
||||
return -1;
|
||||
|
||||
Vfs.ThrowException (Uri, result);
|
||||
return buffer[0];
|
||||
}
|
||||
|
||||
public override void WriteByte (byte value)
|
||||
{
|
||||
if (!CanWrite)
|
||||
throw new NotSupportedException ("The stream does not support writing");
|
||||
|
||||
byte[] buffer = new byte[1];
|
||||
buffer[0] = value;
|
||||
ulong bytesWritten;
|
||||
Result result;
|
||||
if (async) {
|
||||
Async.Write (handle, out buffer[0], 1, writeCallback);
|
||||
Wait ();
|
||||
result = asyncResult;
|
||||
} else {
|
||||
result = Sync.Write (handle, out buffer[0], 1UL, out bytesWritten);
|
||||
}
|
||||
Vfs.ThrowException (Uri, result);
|
||||
}
|
||||
|
||||
public override int Read (byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException ("buffer");
|
||||
else if (offset < 0)
|
||||
throw new ArgumentOutOfRangeException ("offset", "Must be >= 0");
|
||||
else if (count < 0)
|
||||
throw new ArgumentOutOfRangeException ("count", "Must be >= 0");
|
||||
else if (count > buffer.Length - offset)
|
||||
throw new ArgumentException ("Buffer too small, count/offset wrong");
|
||||
else if (!CanRead)
|
||||
throw new NotSupportedException ("The stream does not support reading");
|
||||
|
||||
ulong bytesRead;
|
||||
Result result;
|
||||
if (async) {
|
||||
Async.Read (handle, out buffer[offset], (uint)count, readCallback);
|
||||
Wait ();
|
||||
result = asyncResult;
|
||||
bytesRead = asyncBytesRead;
|
||||
} else {
|
||||
result = Sync.Read (handle, out buffer[offset], (ulong)count, out bytesRead);
|
||||
}
|
||||
if (result == Result.ErrorEof)
|
||||
return 0;
|
||||
|
||||
Vfs.ThrowException (Uri, result);
|
||||
return (int)bytesRead;
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count,
|
||||
System.AsyncCallback cback, object state)
|
||||
{
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException ("buffer");
|
||||
else if (offset < 0)
|
||||
throw new ArgumentOutOfRangeException ("offset", "Must be >= 0");
|
||||
else if (count < 0)
|
||||
throw new ArgumentOutOfRangeException ("count", "Must be >= 0");
|
||||
else if (count > buffer.Length - offset)
|
||||
throw new ArgumentException ("Buffer too small, count/offset wrong");
|
||||
else if (!CanRead)
|
||||
throw new NotSupportedException ("The stream does not support reading");
|
||||
|
||||
if (!IsAsync)
|
||||
return base.BeginRead (buffer, offset, count, cback, state);
|
||||
|
||||
VfsStreamAsync async = new VfsStreamAsync (handle, buffer, offset, count, cback, state);
|
||||
return async.BeginRead ();
|
||||
}
|
||||
|
||||
public override int EndRead (IAsyncResult result)
|
||||
{
|
||||
if (result == null)
|
||||
throw new ArgumentNullException ("result");
|
||||
|
||||
if (!IsAsync)
|
||||
base.EndRead (result);
|
||||
|
||||
if (!(result is VfsStreamAsyncResult))
|
||||
throw new ArgumentException ("Invalid IAsyncResult object", "result");
|
||||
|
||||
VfsStreamAsyncResult asyncResult = (VfsStreamAsyncResult)result;
|
||||
if (asyncResult.Done)
|
||||
throw new InvalidOperationException ("EndRead already called");
|
||||
asyncResult.Done = true;
|
||||
|
||||
while (!asyncResult.IsCompleted)
|
||||
MainContext.Iteration ();
|
||||
|
||||
if (asyncResult.Exception != null)
|
||||
throw asyncResult.Exception;
|
||||
|
||||
return asyncResult.NBytes;
|
||||
}
|
||||
|
||||
public override void Write (byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException ("buffer");
|
||||
else if (offset < 0)
|
||||
throw new ArgumentOutOfRangeException ("offset", "Must be >= 0");
|
||||
else if (count < 0)
|
||||
throw new ArgumentOutOfRangeException ("count", "Must be >= 0");
|
||||
else if (count > buffer.Length - offset)
|
||||
throw new ArgumentException ("Buffer too small, count/offset wrong");
|
||||
else if (!CanWrite)
|
||||
throw new NotSupportedException ("The stream does not support writing");
|
||||
|
||||
ulong bytesWritten;
|
||||
Result result;
|
||||
if (async) {
|
||||
Async.Write (handle, out buffer[offset], (uint)count, writeCallback);
|
||||
Wait ();
|
||||
result = asyncResult;
|
||||
bytesWritten = asyncBytesWritten;
|
||||
} else {
|
||||
result = Sync.Write (handle, out buffer[offset], (ulong)count, out bytesWritten);
|
||||
}
|
||||
Vfs.ThrowException (Uri, result);
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginWrite (byte [] buffer, int offset, int count,
|
||||
System.AsyncCallback cback, object state)
|
||||
{
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException ("buffer");
|
||||
else if (offset < 0)
|
||||
throw new ArgumentOutOfRangeException ("offset", "Must be >= 0");
|
||||
else if (count < 0)
|
||||
throw new ArgumentOutOfRangeException ("count", "Must be >= 0");
|
||||
else if (count > buffer.Length - offset)
|
||||
throw new ArgumentException ("Buffer too small, count/offset wrong");
|
||||
else if (!CanWrite)
|
||||
throw new NotSupportedException ("The stream does not support writing");
|
||||
|
||||
if (!IsAsync)
|
||||
return base.BeginRead (buffer, offset, count, cback, state);
|
||||
|
||||
VfsStreamAsync async = new VfsStreamAsync (handle, buffer, offset, count, cback, state);
|
||||
return async.BeginWrite ();
|
||||
}
|
||||
|
||||
public override void EndWrite (IAsyncResult result)
|
||||
{
|
||||
if (result == null)
|
||||
throw new ArgumentNullException ("result");
|
||||
|
||||
if (!IsAsync)
|
||||
base.EndWrite (result);
|
||||
|
||||
if (!(result is VfsStreamAsyncResult))
|
||||
throw new ArgumentException ("Invalid IAsyncResult object", "result");
|
||||
|
||||
VfsStreamAsyncResult asyncResult = (VfsStreamAsyncResult)result;
|
||||
if (asyncResult.Done)
|
||||
throw new InvalidOperationException ("EndWrite already called");
|
||||
asyncResult.Done = true;
|
||||
|
||||
while (!asyncResult.IsCompleted)
|
||||
MainContext.Iteration ();
|
||||
|
||||
if (asyncResult.Exception != null)
|
||||
throw asyncResult.Exception;
|
||||
}
|
||||
|
||||
public override long Seek (long offset, SeekOrigin origin)
|
||||
{
|
||||
if (!CanSeek)
|
||||
throw new NotSupportedException ("The stream does not support seeking");
|
||||
if (IsAsync && origin == SeekOrigin.Current)
|
||||
throw new NotSupportedException ("Cannot tell what the offset is in async mode");
|
||||
|
||||
SeekPosition seekPos = SeekPosition.Start;
|
||||
long newOffset = -1;
|
||||
switch (origin) {
|
||||
case SeekOrigin.Begin:
|
||||
seekPos = SeekPosition.Start;
|
||||
newOffset = offset;
|
||||
break;
|
||||
case SeekOrigin.Current:
|
||||
seekPos = SeekPosition.Current;
|
||||
break;
|
||||
case SeekOrigin.End:
|
||||
seekPos = SeekPosition.End;
|
||||
newOffset = Length + offset;
|
||||
break;
|
||||
}
|
||||
|
||||
Result result;
|
||||
if (async) {
|
||||
Async.Seek (handle, seekPos, offset, callback);
|
||||
Wait ();
|
||||
result = asyncResult;
|
||||
} else {
|
||||
result = Sync.Seek (handle, seekPos, offset);
|
||||
}
|
||||
Vfs.ThrowException (Uri, result);
|
||||
return newOffset;
|
||||
}
|
||||
|
||||
public override void SetLength (long length)
|
||||
{
|
||||
if (!CanSeek)
|
||||
throw new NotSupportedException ("The stream does not support seeking");
|
||||
else if (!CanWrite)
|
||||
throw new NotSupportedException ("The stream does not support writing");
|
||||
|
||||
Result result = Sync.Truncate (handle, (ulong)length);
|
||||
Vfs.ThrowException (Uri, result);
|
||||
}
|
||||
|
||||
public override void Flush ()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Close ()
|
||||
{
|
||||
Result result = Sync.Close (handle);
|
||||
Vfs.ThrowException (Uri, result);
|
||||
}
|
||||
|
||||
private void OnAsyncCallback (Handle handle, Result result)
|
||||
{
|
||||
asyncResult = result;
|
||||
asyncCompleted = true;
|
||||
}
|
||||
|
||||
private void OnAsyncReadCallback (Handle handle, Result result,
|
||||
byte[] buffer, ulong bytes_requested,
|
||||
ulong bytes_read)
|
||||
{
|
||||
asyncResult = result;
|
||||
asyncBytesRead = bytes_read;
|
||||
asyncCompleted = true;
|
||||
}
|
||||
|
||||
private void OnAsyncWriteCallback (Handle handle, Result result,
|
||||
byte[] buffer, ulong bytes_requested,
|
||||
ulong bytes_written)
|
||||
{
|
||||
asyncResult = result;
|
||||
asyncBytesWritten = bytes_written;
|
||||
asyncCompleted = true;
|
||||
}
|
||||
|
||||
private void Wait ()
|
||||
{
|
||||
while (!asyncCompleted)
|
||||
MainContext.Iteration ();
|
||||
asyncCompleted = false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
// VfsStreamAsyncResult.cs - IAsyncResult implementation for VfsStream.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class VfsStreamAsyncResult : IAsyncResult {
|
||||
private object state;
|
||||
private bool completed = false;
|
||||
private bool done = false;
|
||||
private Exception exception = null;
|
||||
private int nbytes = -1;
|
||||
|
||||
internal VfsStreamAsyncResult (object state)
|
||||
{
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public object AsyncState {
|
||||
get {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
public WaitHandle AsyncWaitHandle {
|
||||
get {
|
||||
throw new NotSupportedException (
|
||||
"Do NOT use the AsyncWaitHandle to " +
|
||||
"wait until a Begin[Read,Write] call " +
|
||||
"has finished since it will also block " +
|
||||
"the gnome-vfs callback which unlocks " +
|
||||
"the WaitHandle, causing a deadlock. " +
|
||||
"Instead, use \"while (!asyncResult.IsCompleted) " +
|
||||
"GLib.MainContext.Iteration ();\"");
|
||||
}
|
||||
}
|
||||
|
||||
public bool CompletedSynchronously {
|
||||
get {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool Done {
|
||||
get {
|
||||
return done;
|
||||
}
|
||||
set {
|
||||
done = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Exception Exception {
|
||||
get {
|
||||
return exception;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCompleted {
|
||||
get {
|
||||
return completed;
|
||||
}
|
||||
}
|
||||
|
||||
public int NBytes {
|
||||
get {
|
||||
return nbytes;
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetComplete (Exception e)
|
||||
{
|
||||
exception = e;
|
||||
completed = true;
|
||||
}
|
||||
|
||||
internal void SetComplete (Exception e, int nbytes)
|
||||
{
|
||||
this.nbytes = nbytes;
|
||||
SetComplete (e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
// VolumeMonitor.custom - VolumeMonitor 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.
|
||||
|
||||
[DllImport("gnomevfs-2")]
|
||||
static extern IntPtr gnome_vfs_volume_monitor_get_connected_drives(IntPtr raw);
|
||||
|
||||
public Drive[] ConnectedDrives {
|
||||
get {
|
||||
IntPtr raw_ret = gnome_vfs_volume_monitor_get_connected_drives(Handle);
|
||||
GLib.List list = new GLib.List(raw_ret);
|
||||
Drive[] result = new Drive [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = list [i] as Drive;
|
||||
list.Dispose ();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("gnomevfs-2")]
|
||||
static extern IntPtr gnome_vfs_volume_monitor_get_mounted_volumes(IntPtr raw);
|
||||
|
||||
public Volume[] MountedVolumes {
|
||||
get {
|
||||
IntPtr raw_ret = gnome_vfs_volume_monitor_get_mounted_volumes(Handle);
|
||||
GLib.List list = new GLib.List(raw_ret);
|
||||
Volume[] result = new Volume [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = list [i] as Volume;
|
||||
list.Dispose ();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("gnomevfs-2")]
|
||||
static extern IntPtr gnome_vfs_get_volume_monitor ();
|
||||
|
||||
public static VolumeMonitor Get ()
|
||||
{
|
||||
IntPtr raw_ret = gnome_vfs_get_volume_monitor ();
|
||||
if (raw_ret == IntPtr.Zero)
|
||||
return null;
|
||||
else
|
||||
return (VolumeMonitor) GLib.Object.GetObject (raw_ret);
|
||||
}
|
104
gnomevfs/Xfer.cs
104
gnomevfs/Xfer.cs
|
@ -1,104 +0,0 @@
|
|||
// Xfer.cs - Bindings for gnome_vfs_xfer_* methods.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public class Xfer {
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_xfer_uri_list (IntPtr source_uri_list,
|
||||
IntPtr target_uri_list,
|
||||
XferOptions xfer_options,
|
||||
XferErrorMode error_mode,
|
||||
XferOverwriteMode overwrite_mode,
|
||||
XferProgressCallbackNative progress_callback,
|
||||
IntPtr data);
|
||||
|
||||
public static Result XferUriList (Uri[] sources,
|
||||
Uri[] targets,
|
||||
XferOptions options,
|
||||
XferErrorMode errorMode,
|
||||
XferOverwriteMode overwriteMode,
|
||||
XferProgressCallback callback)
|
||||
{
|
||||
XferProgressCallbackWrapper wrapper = new XferProgressCallbackWrapper (callback, null);
|
||||
GLib.List sourcesList = new GLib.List (typeof (Uri));
|
||||
foreach (Uri uri in sources)
|
||||
sourcesList.Append (uri.Handle);
|
||||
|
||||
GLib.List targetsList = new GLib.List (typeof (Uri));
|
||||
foreach (Uri uri in targets)
|
||||
targetsList.Append (uri.Handle);
|
||||
|
||||
return gnome_vfs_xfer_uri_list (sourcesList.Handle,
|
||||
targetsList.Handle,
|
||||
options, errorMode,
|
||||
overwriteMode,
|
||||
wrapper.NativeDelegate,
|
||||
IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_xfer_uri (IntPtr source_uri,
|
||||
IntPtr target_uri,
|
||||
XferOptions xfer_options,
|
||||
XferErrorMode error_mode,
|
||||
XferOverwriteMode overwrite_mode,
|
||||
XferProgressCallbackNative progress_callback,
|
||||
IntPtr data);
|
||||
|
||||
public static Result XferUri (Uri source, Uri target,
|
||||
XferOptions options,
|
||||
XferErrorMode errorMode,
|
||||
XferOverwriteMode overwriteMode,
|
||||
XferProgressCallback callback)
|
||||
{
|
||||
XferProgressCallbackWrapper wrapper = new XferProgressCallbackWrapper (callback, null);
|
||||
return gnome_vfs_xfer_uri (source.Handle, target.Handle,
|
||||
options, errorMode, overwriteMode,
|
||||
wrapper.NativeDelegate, IntPtr.Zero);
|
||||
}
|
||||
|
||||
[DllImport ("gnomevfs-2")]
|
||||
private static extern Result gnome_vfs_xfer_delete_list (IntPtr source_uri_list,
|
||||
XferErrorMode error_mode,
|
||||
XferOptions xfer_options,
|
||||
XferProgressCallbackNative progress_callback,
|
||||
IntPtr data);
|
||||
|
||||
public static Result XferDeleteList (Uri[] sources,
|
||||
XferErrorMode errorMode,
|
||||
XferOptions options,
|
||||
XferProgressCallback callback)
|
||||
{
|
||||
XferProgressCallbackWrapper wrapper = new XferProgressCallbackWrapper (callback, null);
|
||||
GLib.List sourcesList = new GLib.List (typeof (Uri));
|
||||
foreach (Uri uri in sources)
|
||||
sourcesList.Append (uri.Handle);
|
||||
|
||||
return gnome_vfs_xfer_delete_list (sourcesList.Handle,
|
||||
errorMode, options,
|
||||
wrapper.NativeDelegate,
|
||||
IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
// XferProgressCallback.cs - GnomeVFSXferProgressCallback delegate.
|
||||
//
|
||||
// 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.
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
public delegate int XferProgressCallback (XferProgressInfo info);
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
// XferProgressCallbackNative.cs - GnomeVFSXferProgressCallback wrapper.
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Gnome.Vfs {
|
||||
internal delegate int XferProgressCallbackNative (ref XferProgressInfo info, IntPtr data);
|
||||
|
||||
internal class XferProgressCallbackWrapper : GLib.DelegateWrapper {
|
||||
|
||||
public int NativeCallback (ref XferProgressInfo info, IntPtr data)
|
||||
{
|
||||
return _managed (info);
|
||||
}
|
||||
|
||||
internal XferProgressCallbackNative NativeDelegate;
|
||||
protected XferProgressCallback _managed;
|
||||
|
||||
public XferProgressCallbackWrapper (XferProgressCallback managed, object o) : base (o)
|
||||
{
|
||||
NativeDelegate = new XferProgressCallbackNative (NativeCallback);
|
||||
_managed = managed;
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,11 +0,0 @@
|
|||
prefix=${pcfiledir}/../..
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
gapidir=${prefix}/share/gapi-2.0
|
||||
|
||||
|
||||
Name: GnomeVfs#
|
||||
Description: GnomeVfs# - GNOME-VFS .NET Binding
|
||||
Version: @VERSION@
|
||||
Cflags: -I:${gapidir}/gnome-vfs-api.xml
|
||||
Libs: -r:${libdir}/mono/@PACKAGE_VERSION@/gnome-vfs-sharp.dll
|
|
@ -1,3 +0,0 @@
|
|||
<configuration>
|
||||
<dllmap dll="gnomevfs-2" target="libgnomevfs-2@LIB_PREFIX@.0@LIB_SUFFIX@"/>
|
||||
</configuration>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<api>
|
||||
<symbol type="alias" cname="GnomeVFSFileSize" name="gint64"/>
|
||||
<symbol type="alias" cname="GnomeVFSFileOffset" name="guint64"/>
|
||||
</api>
|
||||
|
Loading…
Reference in a new issue