public void Open(string path, UVFileAccess access, Action <Exception> callback) { Ensure.ArgumentNotNull(callback, "path"); switch (access) { case UVFileAccess.Read: Readable = true; break; case UVFileAccess.Write: Writeable = true; break; case UVFileAccess.ReadWrite: Writeable = true; Readable = true; break; default: throw new ArgumentException("access not supported"); } UVFile.Open(Loop, path, access, (ex, file) => { uvfile = file; if (callback != null) { callback(ex); } }); }
void Finish(Exception ex) { uvfile.Close((ex2) => { uvfile = null; IsClosing = false; if (shutdownCallback != null) { shutdownCallback(ex ?? ex2); } }); }
public static void Open(Loop loop, string path, UVFileAccess access, Action<Exception, UVFile> callback) { var fsr = new FileSystemRequest(path); fsr.Callback = (ex) => { UVFile file = null; if (fsr.Result != IntPtr.Zero) { file = new UVFile(loop, fsr.Result.ToInt32()); } Ensure.Success(ex, callback, file); }; int r = uv_fs_open(loop.NativeHandle, fsr.Handle, path, (int)access, 0, FileSystemRequest.CallbackDelegate); Ensure.Success(r); }
public static void Open(Loop loop, string path, UVFileAccess access, Action <Exception, UVFile> callback) { var fsr = new FileSystemRequest(path); fsr.Callback = (ex) => { UVFile file = null; if (fsr.Result != IntPtr.Zero) { file = new UVFile(loop, fsr.Result.ToInt32()); } Ensure.Success(ex, callback, file); }; int r = uv_fs_open(loop.NativeHandle, fsr.Handle, path, (int)access, 0, FileSystemRequest.CallbackDelegate); Ensure.Success(r); }
public static void Open(Loop loop, string path, FileAccess access, Action <Exception, UVFile> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { UVFile file = null; if (fsr.Result != IntPtr.Zero) { file = new UVFile(loop, fsr.Result); } if (callback != null) { callback(ex, file); } }; int r = uv_fs_open(loop.Handle, fsr.Handle, path, (int)access, 0, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public static void Open(Loop loop, string path, FileAccess access, Action<Exception, UVFile> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { UVFile file = null; if (fsr.Result != IntPtr.Zero) { file = new UVFile(loop, fsr.Result); } if (callback != null) { callback(ex, file); } }; int r = uv_fs_open(loop.Handle, fsr.Handle, path, (int)access, 0, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public void Open(string path, UVFileAccess access, Action<Exception> callback) { Ensure.ArgumentNotNull(callback, "path"); switch (access) { case UVFileAccess.Read: Readable = true; break; case UVFileAccess.Write: Writeable = true; break; default: throw new ArgumentException("access not supported"); } UVFile.Open(Loop, path, access, (ex, file) => { uvfile = file; if (callback != null) { callback(ex); } }); }