<Type Name="Async" FullName="Gnome.Vfs.Async"> <TypeSignature Language="C#" Value="public class Async" Maintainer="auto" /> <AssemblyInfo> <AssemblyName>gnome-vfs-sharp</AssemblyName> <AssemblyPublicKey>[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]</AssemblyPublicKey> <AssemblyVersion>2.16.0.0</AssemblyVersion> </AssemblyInfo> <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement> <Docs> <summary>Asynchronous File Operations; POSIX-style file operations that run outside your main loop.</summary> <remarks>The members of this class are all static methods and use the <see cref="T:Gnome.Vfs.Handle" /> class to reference asynchronous operations in progress. <example><code lang="C#"> 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 (); } } } </code></example></remarks> </Docs> <Base> <BaseTypeName>System.Object</BaseTypeName> </Base> <Interfaces /> <Members> <Member MemberName="Cancel"> <MemberSignature Language="C#" Value="public static void Cancel (Gnome.Vfs.Handle handle);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="handle" Type="Gnome.Vfs.Handle" /> </Parameters> <Docs> <summary>Cancel an asynchronous operation and close all its callbacks. Its possible to still receive another call or two on the callback.</summary> <param name="handle"> <see cref="T:Gnome.Vfs.Handle" /> of the async operation to be cancelled</param> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="Close"> <MemberSignature Language="C#" Value="public static void Close (Gnome.Vfs.Handle handle, Gnome.Vfs.AsyncCallback callback);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="handle" Type="Gnome.Vfs.Handle" /> <Parameter Name="callback" Type="Gnome.Vfs.AsyncCallback" /> </Parameters> <Docs> <summary>Close a handle opened with <see cref="M:Gnome.Vfs.Async.Open" />. When the close has completed, <see cref="T:Gnome.Vfs.AsyncCallback" /> will be called with the <see cref="T:Gnome.Vfs.Result" /> of the operation.</summary> <param name="handle">a <see cref="T:Gnome.Vfs.Handle" /> to close</param> <param name="callback">a <see cref="T:Gnome.Vfs.AsyncCallback" /> to be called when the operation is complete</param> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="Create"> <MemberSignature Language="C#" Value="public static Gnome.Vfs.Handle Create (string uri, Gnome.Vfs.OpenMode mode, bool exclusive, Gnome.Vfs.FilePermissions perm, int priority, Gnome.Vfs.AsyncCallback callback);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>Gnome.Vfs.Handle</ReturnType> </ReturnValue> <Parameters> <Parameter Name="uri" Type="System.String" /> <Parameter Name="mode" Type="Gnome.Vfs.OpenMode" /> <Parameter Name="exclusive" Type="System.Boolean" /> <Parameter Name="perm" Type="Gnome.Vfs.FilePermissions" /> <Parameter Name="priority" Type="System.Int32" /> <Parameter Name="callback" Type="Gnome.Vfs.AsyncCallback" /> </Parameters> <Docs> <summary>Create a file at uri according to mode <see cref="T:Gnome.Vfs.OpenMode" />, with permissions <see cref="T:Gnome.Vfs.FilePermissions" />. When the create has been completed <see cref="T:Gnome.Vfs.AsyncCallback" /> will be called with the <see cref="T:Gnome.Vfs.Result" />.</summary> <param name="uri">the URI to create a file at.</param> <param name="mode">mode to leave the file opened in after creation (or <see cref="M:Gnome.Vfs.OpenMode.None" /> to leave the file closed after creation).</param> <param name="exclusive">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.</param> <param name="perm">Bitmap representing the permissions for the newly created file (Unix style).</param> <param name="priority">a value from <see cref="M:Gnome.Vfs.Async+Priority.Min" /> to <see cref="T:Gnome.Vfs.Async+Priority.Max" /> (normally should be <see cref="T:Gnome.Vfs.Async+Priority.Default" />) indicating the priority to assign this job in allocating threads from the thread pool.</param> <param name="callback">a <see cref="T:Gnome.Vfs.AsyncCallback" /> to be called when the operation is complete.</param> <returns>a <see cref="T:Gnome.Vfs.Handle" /></returns> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="Create"> <MemberSignature Language="C#" Value="public static Gnome.Vfs.Handle Create (Gnome.Vfs.Uri uri, Gnome.Vfs.OpenMode mode, bool exclusive, Gnome.Vfs.FilePermissions perm, int priority, Gnome.Vfs.AsyncCallback callback);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>Gnome.Vfs.Handle</ReturnType> </ReturnValue> <Parameters> <Parameter Name="uri" Type="Gnome.Vfs.Uri" /> <Parameter Name="mode" Type="Gnome.Vfs.OpenMode" /> <Parameter Name="exclusive" Type="System.Boolean" /> <Parameter Name="perm" Type="Gnome.Vfs.FilePermissions" /> <Parameter Name="priority" Type="System.Int32" /> <Parameter Name="callback" Type="Gnome.Vfs.AsyncCallback" /> </Parameters> <Docs> <summary>Create a file at <see cref="T:Gnome.Vfs.Uri" /> according to mode <see cref="T:Gnome.Vfs.OpenMode" />, with permissions <see cref="T:Gnome.Vfs.FilePermissions" />. When the create has been completed <see cref="T:Gnome.Vfs.AsyncCallback" /> will be called with the <see cref="T:Gnome.Vfs.Result" />.</summary> <param name="uri">the <see cref="T:Gnome.Vfs.Uri" /> to create a file at.</param> <param name="mode">mode to leave the file opened in after creation (or <see cref="M:Gnome.Vfs.OpenMode.None" /> to leave the file closed after creation).</param> <param name="exclusive">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.</param> <param name="perm">Bitmap representing the permissions for the newly created file (Unix style).</param> <param name="priority">a value from <see cref="M:Gnome.Vfs.Async+Priority.Min" /> to <see cref="T:Gnome.Vfs.Async+Priority.Max" /> (normally should be <see cref="T:Gnome.Vfs.Async+Priority.Default" />) indicating the priority to assign this job in allocating threads from the thread pool.</param> <param name="callback">a <see cref="T:Gnome.Vfs.AsyncCallback" /> to be called when the operation is complete.</param> <returns>a <see cref="T:Gnome.Vfs.Handle" /></returns> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="Open"> <MemberSignature Language="C#" Value="public static Gnome.Vfs.Handle Open (string uri, Gnome.Vfs.OpenMode mode, int priority, Gnome.Vfs.AsyncCallback callback);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>Gnome.Vfs.Handle</ReturnType> </ReturnValue> <Parameters> <Parameter Name="uri" Type="System.String" /> <Parameter Name="mode" Type="Gnome.Vfs.OpenMode" /> <Parameter Name="priority" Type="System.Int32" /> <Parameter Name="callback" Type="Gnome.Vfs.AsyncCallback" /> </Parameters> <Docs> <summary>Open uri according to mode <see cref="T:Gnome.Vfs.OpenMode" />. Once the file has been successfully opened, <see cref="T:Gnome.Vfs.AsyncCallback" /> will be called with the <see cref="T:Gnome.Vfs.Result" />.</summary> <param name="uri"> <see cref="T:System.String" /> of the URI to open.</param> <param name="mode"> <see cref="T:Gnome.Vfs.OpenMode" />.</param> <param name="priority">a value from <see cref="M:Gnome.Vfs.Async+Priority.Min" /> to <see cref="T:Gnome.Vfs.Async+Priority.Max" /> (normally should be <see cref="T:Gnome.Vfs.Async+Priority.Default" />) indicating the priority to assign this job in allocating threads from the thread pool.</param> <param name="callback">a <see cref="T:Gnome.Vfs.AsyncCallback" /> to be called when the operation is complete.</param> <returns>a <see cref="T:Gnome.Vfs.Handle" /></returns> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="Open"> <MemberSignature Language="C#" Value="public static Gnome.Vfs.Handle Open (Gnome.Vfs.Uri uri, Gnome.Vfs.OpenMode mode, int priority, Gnome.Vfs.AsyncCallback callback);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>Gnome.Vfs.Handle</ReturnType> </ReturnValue> <Parameters> <Parameter Name="uri" Type="Gnome.Vfs.Uri" /> <Parameter Name="mode" Type="Gnome.Vfs.OpenMode" /> <Parameter Name="priority" Type="System.Int32" /> <Parameter Name="callback" Type="Gnome.Vfs.AsyncCallback" /> </Parameters> <Docs> <summary>Open <see cref="T:Gnome.Vfs.Uri" /> according to mode <see cref="T:Gnome.Vfs.OpenMode" />. Once the file has been successfully opened, <see cref="T:Gnome.Vfs.AsyncCallback" /> will be called with the <see cref="T:Gnome.Vfs.Result" />.</summary> <param name="uri"> <see cref="T:Gnome.Vfs.Uri" /> to open.</param> <param name="mode"> <see cref="T:Gnome.Vfs.OpenMode" />.</param> <param name="priority">a value from <see cref="M:Gnome.Vfs.Async+Priority.Min" /> to <see cref="T:Gnome.Vfs.Async+Priority.Max" /> (normally should be <see cref="T:Gnome.Vfs.Async+Priority.Default" />) indicating the priority to assign this job in allocating threads from the thread pool.</param> <param name="callback">a <see cref="T:Gnome.Vfs.AsyncCallback" /> to be called when the operation is complete.</param> <returns>a <see cref="T:Gnome.Vfs.Handle" /></returns> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="Read"> <MemberSignature Language="C#" Value="public static void Read (Gnome.Vfs.Handle handle, out byte buffer, uint bytes, Gnome.Vfs.AsyncReadCallback callback);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="handle" Type="Gnome.Vfs.Handle" /> <Parameter Name="buffer" Type="System.Byte&" RefType="out" /> <Parameter Name="bytes" Type="System.UInt32" /> <Parameter Name="callback" Type="Gnome.Vfs.AsyncReadCallback" /> </Parameters> <Docs> <summary>Read number of bytes from the file pointed to by <see cref="T:Gnome.Vfs.Handle" /> into byte array buffer. When the operation is complete, <see cref="T:Gnome.Vfs.AsyncReadCallback" /> will be called with the <see cref="T:Gnome.Vfs.Result" /> of the operation.</summary> <param name="handle"> <see cref="T:Gnome.Vfs.Handle" /> for the file to be read.</param> <param name="buffer">allocated array of <see cref="T:System.Byte" /> to read into. Needs to be passed as "out buffer[0]".</param> <param name="bytes">number of bytes to read.</param> <param name="callback">a <see cref="T:Gnome.Vfs.AsyncReadCallback" /> to be called when the operation is complete.</param> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="Seek"> <MemberSignature Language="C#" Value="public static void Seek (Gnome.Vfs.Handle handle, Gnome.Vfs.SeekPosition whence, long offset, Gnome.Vfs.AsyncCallback callback);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="handle" Type="Gnome.Vfs.Handle" /> <Parameter Name="whence" Type="Gnome.Vfs.SeekPosition" /> <Parameter Name="offset" Type="System.Int64" /> <Parameter Name="callback" Type="Gnome.Vfs.AsyncCallback" /> </Parameters> <Docs> <summary>Set the current position for reading/writing through <see cref="T:Gnome.Vfs.Handle" />. When the operation is complete, <see cref="T:Gnome.Vfs.AsyncCallback" /> will be called with the <see cref="T:Gnome.Vfs.Result" /> of the operation.</summary> <param name="handle"> <see cref="T:Gnome.Vfs.Handle" /> for which the current position must be changed.</param> <param name="whence"> <see cref="T:Gnome.Vfs.SeekPosition" /> value representing the starting position.</param> <param name="offset">number of bytes to skip from the position specified by <see cref="T:Gnome.Vfs.SeekPosition" /> (a positive value means to move forward; a negative one to move backwards).</param> <param name="callback">a <see cref="T:Gnome.Vfs.AsyncCallback" /> to be called when the operation is complete.</param> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="Write"> <MemberSignature Language="C#" Value="public static void Write (Gnome.Vfs.Handle handle, out byte buffer, uint bytes, Gnome.Vfs.AsyncWriteCallback callback);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="handle" Type="Gnome.Vfs.Handle" /> <Parameter Name="buffer" Type="System.Byte&" RefType="out" /> <Parameter Name="bytes" Type="System.UInt32" /> <Parameter Name="callback" Type="Gnome.Vfs.AsyncWriteCallback" /> </Parameters> <Docs> <summary>Write number of bytes from buffer byte array into the file pointed to be <see cref="T:Gnome.Vfs.Handle" />. When the operation is complete, <see cref="T:Gnome.Vfs.AsyncWriteCallback" /> will be called with the <see cref="T:Gnome.Vfs.Result" /> of the operation.</summary> <param name="handle"> <see cref="T:Gnome.Vfs.Handle" /> for the file to be written.</param> <param name="buffer"> <see cref="T:System.Byte" /> array containing data to be written. Needs to be passed as "out buffer[0]".</param> <param name="bytes">number of bytes to write.</param> <param name="callback">a <see cref="T:Gnome.Vfs.AsyncWriteCallback" /> to be called when the operation is complete.</param> <remarks>To be added</remarks> </Docs> </Member> </Members> </Type>