public static void OnUriRead(Gnome.Vfs.Handle handle, Gnome.Vfs.Result result, byte [] buffer, ulong bytesRequested, ulong bytesRead) { Console.WriteLine("Async.Read result\t= {0} ({1})", Gnome.Vfs.Vfs.ResultToString(result), result); if (result != Gnome.Vfs.Result.Ok) { return; } Console.WriteLine("bytesRequested\t\t= {0}", bytesRequested); Console.WriteLine("bytesRead\t\t= {0}", bytesRead); Console.Write("bytes\t\t\t= "); for (int i = 0; i < (int)bytesRead; i++) { Console.Write((char)buffer [i]); } Console.WriteLine(); Gnome.Vfs.AsyncReadCallback readCallback = new Gnome.Vfs.AsyncReadCallback(OnUriRead); byte [] buf = new byte [128]; Gnome.Vfs.Async.Read(handle, out buf [0], 128, readCallback); }
static void OnUriOpen(Gnome.Vfs.Handle handle, Gnome.Vfs.Result result) { Console.WriteLine("Async.Open result\t= {0} ({1})", Gnome.Vfs.Vfs.ResultToString(result), result); Gnome.Vfs.AsyncReadCallback readCallback = new Gnome.Vfs.AsyncReadCallback(OnUriRead); byte [] buffer = new byte [128]; Gnome.Vfs.Async.Read(handle, out buffer [0], 128, readCallback); }
public void OnUriCreate(Gnome.Vfs.Handle handle, Gnome.Vfs.Result result) { Console.WriteLine("Async.Create result\t= {0} ({1})", Gnome.Vfs.Vfs.ResultToString(result), result); if (result != Gnome.Vfs.Result.Ok) { return; } UTF8Encoding utf8 = new UTF8Encoding(); byte [] buffer = utf8.GetBytes("Testing 1 2 3 asdlfjalsjdfksjdf \nGustavo Giráldez\n"); Gnome.Vfs.AsyncWriteCallback writeCallback = new Gnome.Vfs.AsyncWriteCallback(OnUriWrite); Gnome.Vfs.Async.Write(handle, out buffer [0], (uint)buffer.Length, writeCallback); }
public static void OnUriWrite(Gnome.Vfs.Handle handle, Gnome.Vfs.Result result, byte [] buffer, ulong bytesRequested, ulong bytesWritten) { Console.WriteLine("Async.Write result\t= {0} ({1})", Gnome.Vfs.Vfs.ResultToString(result), result); }