gnome-vfs-sharp [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 71 EB 6C 55 75 52 9C BF 72 44 F7 A6 EA 05 62 84 F9 EA E0 3B CF F2 CC 13 2C 9C 49 0A B3 09 EA B0 B5 6B CE 44 9D F5 03 D9 C0 A8 1E 52 05 85 CD BE 70 E2 FB 90 43 4B AC 04 FA 62 22 A8 00 98 B7 A1 A7 B3 AF 99 1A 41 23 24 BB 43 25 F6 B8 65 BB 64 EB F6 D1 C2 06 D5 73 2D DF BC 70 A7 38 9E E5 3E 0C 24 6E 32 79 74 1A D0 05 03 E4 98 42 E1 9B F3 7B 19 8B 40 21 26 CB 36 89 C2 EA 64 96 A4 7C B4] 2.0.0.0 neutral Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. Asynchronous File Operations; POSIX-style file operations that run outside your main loop. The members of this class are all static methods and use the class to reference asynchronous operations in progress. using GLib; using Gnome.Vfs; using System; using System.Text; using System.Threading; namespace Test.Gnome.Vfs { public class TestAsync { private static MainLoop loop; private static Handle handle; static void Main (string[] args) { if (args.Length != 1) { Console.WriteLine ("Usage: TestAsync <uri>"); return; } Gnome.Vfs.Vfs.Initialize (); Gnome.Vfs.Uri uri = new Gnome.Vfs.Uri (args[0]); handle = Async.Open (uri, OpenMode.Read, (int)Async.Priority.Default, new Gnome.Vfs.AsyncCallback (OnOpen)); loop = new MainLoop (); loop.Run (); Gnome.Vfs.Vfs.Shutdown (); } private static void OnOpen (Handle handle, Result result) { Console.WriteLine ("Uri opened: {0}", result); if (result != Result.Ok) { loop.Quit (); return; } byte[] buffer = new byte[1024]; Async.Read (handle, out buffer[0], (uint)buffer.Length, new AsyncReadCallback (OnRead)); } private static void OnRead (Handle handle, Result result, byte[] buffer, ulong bytes_requested, ulong bytes_read) { Console.WriteLine ("Read: {0}", result); if (result != Result.Ok && result != Result.ErrorEof) { loop.Quit (); return; } UTF8Encoding utf8 = new UTF8Encoding (); Console.WriteLine ("read ({0} bytes) : '{1}'", bytes_read, utf8.GetString (buffer, 0, (int)bytes_read)); if (bytes_read != 0) Async.Read (handle, out buffer[0], (uint)buffer.Length, new AsyncReadCallback (OnRead)); else Async.Close (handle, new Gnome.Vfs.AsyncCallback (OnClose)); } private static void OnClose (Handle handle, Result result) { Console.WriteLine ("Close: {0}", result); loop.Quit (); } } } System.Object Method System.Void Cancel an asynchronous operation and close all its callbacks. Its possible to still receive another call or two on the callback. of the async operation to be cancelled To be added Method System.Void Close a handle opened with . When the close has completed, will be called with the of the operation. a to close a to be called when the operation is complete To be added Method Gnome.Vfs.Handle Create a file at uri according to mode , with permissions . When the create has been completed will be called with the . the URI to create a file at. mode to leave the file opened in after creation (or to leave the file closed after creation). Whether the file should be created in "exclusive" mode: i.e. if this flag is nonzero, operation will fail if a file with the same name already exists. Bitmap representing the permissions for the newly created file (Unix style). a value from to (normally should be ) indicating the priority to assign this job in allocating threads from the thread pool. a to be called when the operation is complete. a To be added Method Gnome.Vfs.Handle Create a file at according to mode , with permissions . When the create has been completed will be called with the . the to create a file at. mode to leave the file opened in after creation (or to leave the file closed after creation). Whether the file should be created in "exclusive" mode: i.e. if this flag is nonzero, operation will fail if a file with the same name already exists. Bitmap representing the permissions for the newly created file (Unix style). a value from to (normally should be ) indicating the priority to assign this job in allocating threads from the thread pool. a to be called when the operation is complete. a To be added Method Gnome.Vfs.Handle Open uri according to mode . Once the file has been successfully opened, will be called with the . of the URI to open. . a value from to (normally should be ) indicating the priority to assign this job in allocating threads from the thread pool. a to be called when the operation is complete. a To be added Method Gnome.Vfs.Handle Open according to mode . Once the file has been successfully opened, will be called with the . to open. . a value from to (normally should be ) indicating the priority to assign this job in allocating threads from the thread pool. a to be called when the operation is complete. a To be added Method System.Void Read number of bytes from the file pointed to by into byte array buffer. When the operation is complete, will be called with the of the operation. for the file to be read. allocated array of to read into. Needs to be passed as "out buffer[0]". number of bytes to read. a to be called when the operation is complete. To be added Method System.Void Set the current position for reading/writing through . When the operation is complete, will be called with the of the operation. for which the current position must be changed. value representing the starting position. number of bytes to skip from the position specified by (a positive value means to move forward; a negative one to move backwards). a to be called when the operation is complete. To be added Method System.Void Write number of bytes from buffer byte array into the file pointed to be . When the operation is complete, will be called with the of the operation. for the file to be written. array containing data to be written. Needs to be passed as "out buffer[0]". number of bytes to write. a to be called when the operation is complete. To be added