public static void Rename(Loop loop, string path, string newPath, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = callback; int r = uv_fs_rename(loop.NativeHandle, fsr.Handle, path, newPath, fsr.End); Ensure.Success(r); }
public static void Chown(Loop loop, string path, int uid, int gid, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = callback; int r = uv_fs_chown(loop.NativeHandle, fsr.Handle, path, uid, gid, FileSystemRequest.CallbackDelegate); Ensure.Success(r); }
public static void Create(Loop loop, string path, int mode, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = callback; int r = uv_fs_mkdir(loop.NativeHandle, fsr.Handle, path, mode, FileSystemRequest.CallbackDelegate); Ensure.Success(r); }
public static void Delete(Loop loop, string path, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = callback; int r = uv_fs_rmdir(loop.NativeHandle, fsr.Handle, path, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public void Close(Loop loop, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = callback; int r = uv_fs_close(loop.NativeHandle, fsr.Handle, FileDescriptor, FileSystemRequest.CallbackDelegate); Ensure.Success(r); }
public static void Chown(Loop loop, string path, int uid, int gid, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { callback(ex); }; int r = uv_fs_chown(loop.Handle, fsr.Handle, path, uid, gid, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public static void Delete(Loop loop, string path, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { if (callback != null) { callback(ex); }; }; int r = uv_fs_rmdir(loop.Handle, fsr.Handle, path, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public void Read(Loop loop, int offset, ArraySegment<byte> segment, Action<Exception, int> callback) { var datagchandle = GCHandle.Alloc(segment.Array, GCHandleType.Pinned); var fsr = new FileSystemRequest(); fsr.Callback = (ex) => { Ensure.Success(ex, callback, fsr.Result.ToInt32()); datagchandle.Free(); }; UnixBufferStruct[] buf = new UnixBufferStruct[1]; buf[0] = new UnixBufferStruct(datagchandle.AddrOfPinnedObject() + segment.Offset, segment.Count); int r = uv_fs_read(loop.NativeHandle, fsr.Handle, FileDescriptor, buf, 1, offset, 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 void Read(Loop loop, byte[] data, int index, int count, Action <Exception, int> callback, int offset) { GCHandle datagchandle = GCHandle.Alloc(data, GCHandleType.Pinned); var fsr = new FileSystemRequest(); fsr.Callback += (ex) => { callback(ex, fsr.Result.ToInt32()); datagchandle.Free(); }; var ptr = (IntPtr)(datagchandle.AddrOfPinnedObject().ToInt64() + index); int r = uv_fs_read(loop.NativeHandle, fsr.Handle, FileHandle, ptr, (IntPtr)count, offset, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public static void Delete(Loop loop, string path, Action <Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { if (callback != null) { callback(ex); } ; }; int r = uv_fs_rmdir(loop.Handle, fsr.Handle, path, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public void Send(Loop loop, Tcp socket, int offset, int length, Action <Exception, int> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { if (callback != null) { callback(ex, (int)fsr.Result); } ; }; int r = uv_fs_sendfile(loop.Handle, fsr.Handle, socket.handle, FileHandle, offset, length, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public void Write(Loop loop, int offset, ArraySegment <byte> segment, Action <Exception, int> callback) { var datagchandle = GCHandle.Alloc(segment.Array, GCHandleType.Pinned); var fsr = new FileSystemRequest(); fsr.Callback = (ex) => { Ensure.Success(ex, callback, fsr.Result.ToInt32()); datagchandle.Free(); }; var ptr = new IntPtr(datagchandle.AddrOfPinnedObject().ToInt64() + segment.Offset); var buf = new uv_buf_t[] { new uv_buf_t(ptr, segment.Count) }; int r = uv_fs_write(loop.NativeHandle, fsr.Handle, FileDescriptor, buf, segment.Count, offset, FileSystemRequest.CallbackDelegate); Ensure.Success(r); }
public void Read(Loop loop, int offset, ArraySegment <byte> segment, Action <Exception, int> callback) { var datagchandle = GCHandle.Alloc(segment.Array, GCHandleType.Pinned); var fsr = new FileSystemRequest(); fsr.Callback = (ex) => { Ensure.Success(ex, callback, fsr.Result.ToInt32()); datagchandle.Free(); }; UnixBufferStruct[] buf = new UnixBufferStruct[1]; buf[0] = new UnixBufferStruct(datagchandle.AddrOfPinnedObject() + segment.Offset, segment.Count); int r = uv_fs_read(loop.NativeHandle, fsr.Handle, FileDescriptor, buf, 1, offset, FileSystemRequest.CallbackDelegate); Ensure.Success(r); }
public static void Readlink(Loop loop, string path, Action <Exception, string> callback) { var fsr = new FileSystemRequest(path); fsr.Callback = (ex) => { string res = null; if (ex == null) { res = Marshal.PtrToStringAuto(fsr.Pointer); } Ensure.Success(ex, callback, res); }; int r = uv_fs_readlink(loop.NativeHandle, fsr.Handle, path, FileSystemRequest.CallbackDelegate); Ensure.Success(r); }
public void Write(Loop loop, byte[] data, int length, int offset, Action <Exception, int> callback) { var datagchandle = GCHandle.Alloc(data, GCHandleType.Pinned); var fsr = new FileSystemRequest(); fsr.Callback += (ex, fsr2) => { if (callback != null) { callback(ex, (int)fsr.Result); } datagchandle.Free(); }; int r = uv_fs_write(loop.Handle, fsr.Handle, FileHandle, datagchandle.AddrOfPinnedObject(), (IntPtr)length, offset, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
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); }
unsafe public static void Stat(Loop loop, string path, Action <Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { // TODO: do this lin_stat *stats = (lin_stat *)fsr.Pointer; if (callback != null) { callback(ex); } }; int r = uv_fs_stat(loop.Handle, fsr.Handle, path, 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 static unsafe void Read(Loop loop, string path, Action<Exception, string[]> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex) => { if (ex != null) { callback(ex, null); return; } int length = (int)fsr.Result; string[] res = new string[length]; sbyte *ptr = (sbyte *)fsr.Pointer; for (int i = 0; i < length; i++) { res[i] = new string(ptr); ptr += res[i].Length + 1; } callback(ex, res); }; uv_fs_readdir(loop.NativeHandle, fsr.Handle, path, 0, FileSystemRequest.StaticEnd); }
unsafe public void Stat(Loop loop, Action <Exception, UVFileStat> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex) => { if (callback != null) { UVFileStat stat = null; if (UV.isUnix) { stat = lin_stat.Convert(fsr.Pointer); } if (callback != null) { callback(ex, stat); } } }; int r = uv_fs_fstat(loop.NativeHandle, fsr.Handle, FileHandle, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
unsafe public static void Read(Loop loop, string path, Action <Exception, string[]> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex) => { if (ex != null) { callback(ex, null); return; } int length = (int)fsr.Result; string[] res = new string[length]; sbyte * ptr = (sbyte *)fsr.Pointer; for (int i = 0; i < length; i++) { res[i] = new string(ptr); ptr += res[i].Length + 1; } callback(ex, res); }; uv_fs_readdir(loop.NativeHandle, fsr.Handle, path, 0, FileSystemRequest.StaticEnd); }
unsafe public static void Read(Loop loop, string path, Action <Exception, string[]> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { if (ex != null) { callback(ex, null); return; } int length = (int)fsr.Result; List <string> list = new List <string>(length); sbyte * ptr = (sbyte *)fsr.Pointer; for (int i = 0; i < length; i++) { list.Add(new string(ptr)); ptr += strlen((IntPtr)ptr) + 1; } callback(ex, list.ToArray()); }; uv_fs_readdir(loop.Handle, fsr.Handle, path, 0, fsr.End); }
public static void Read(Loop loop, string path, Action <Exception, UVDirectoryEntity[]> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex) => { if (ex != null) { callback(ex, null); return; } var list = new List <UVDirectoryEntity>(); uv_dirent_t entity; while (UVException.Map(uv_fs_scandir_next(fsr.Handle, out entity)) != UVErrorCode.EOF) { list.Add(new UVDirectoryEntity(entity)); } Ensure.Success(ex, callback, list.ToArray()); }; int r = uv_fs_scandir(loop.NativeHandle, fsr.Handle, path, 0, FileSystemRequest.CallbackDelegate); Ensure.Success(r); }
public void Truncate(Loop loop, int offset, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = callback; int r = uv_fs_ftruncate(loop.NativeHandle, fsr.Handle, FileDescriptor, offset, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public void Sync(Loop loop, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex) => { if (callback != null) { callback(ex); } }; int r = uv_fs_fsync(loop.NativeHandle, fsr.Handle, FileDescriptor, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public unsafe void Stat(Loop loop, Action<Exception, UVFileStat> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex) => { if (callback != null) { UVFileStat stat = null; if (UV.isUnix) { stat = lin_stat.Convert(fsr.Pointer); } if (callback != null) { callback(ex, stat); } } }; int r = uv_fs_fstat(loop.NativeHandle, fsr.Handle, FileDescriptor, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public void Read(Loop loop, byte[] data, int length, int offset, Action<Exception, int> callback) { GCHandle datagchandle = GCHandle.Alloc(data, GCHandleType.Pinned); var fsr = new FileSystemRequest(); fsr.Callback += (ex, fsr2) => { callback(ex, fsr.Result.ToInt32()); datagchandle.Free(); }; int r = uv_fs_read(loop.Handle, fsr.Handle, FileHandle, datagchandle.AddrOfPinnedObject(), (IntPtr)length, offset, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public static void Symlink(Loop loop, string path, string newPath, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = callback; int r = uv_fs_symlink(loop.NativeHandle, fsr.Handle, path, newPath, 0, FileSystemRequest.CallbackDelegate); Ensure.Success(r); }
public static unsafe void Read(Loop loop, string path, Action<Exception, string[]> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { if (ex != null) { callback(ex, null); return; } int length = (int)fsr.Result; List<string> list = new List<string>(length); sbyte *ptr = (sbyte *)fsr.Pointer; for (int i = 0; i < length; i++) { list.Add(new string(ptr)); ptr += strlen((IntPtr)ptr) + 1; } callback(ex, list.ToArray()); }; uv_fs_readdir(loop.Handle, fsr.Handle, path, 0, fsr.End); }
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 Write(Loop loop, byte[] data, int length, int offset, Action<Exception, int> callback) { var datagchandle = GCHandle.Alloc(data, GCHandleType.Pinned); var fsr = new FileSystemRequest(); fsr.Callback += (ex, fsr2) => { if (callback != null) { callback(ex, (int)fsr.Result); } datagchandle.Free(); }; int r = uv_fs_write(loop.Handle, fsr.Handle, FileHandle, datagchandle.AddrOfPinnedObject(), (IntPtr)length, offset, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public void Truncate(Loop loop, int offset, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { callback(ex); }; int r = uv_fs_ftruncate(loop.Handle, fsr.Handle, FileHandle, offset, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public unsafe void Stat(Loop loop, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { lin_stat stats = new lin_stat(); uv_fs_req_stat(fsr.Handle, &stats); Console.WriteLine (stats); callback(ex); }; int r = uv_fs_fstat(loop.Handle, fsr.Handle, FileHandle, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public static unsafe void Stat(Loop loop, string path, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { // TODO: do this lin_stat *stats = (lin_stat *)fsr.Pointer; if (callback != null) { callback(ex); } }; int r = uv_fs_stat(loop.Handle, fsr.Handle, path, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public void Write(Loop loop, byte[] data, int index, int count, Action<Exception, int> callback, int offset) { var datagchandle = GCHandle.Alloc(data, GCHandleType.Pinned); var fsr = new FileSystemRequest(); fsr.Callback += (ex) => { if (callback != null) { callback(ex, (int)fsr.Result); } datagchandle.Free(); }; var ptr = (IntPtr)(datagchandle.AddrOfPinnedObject().ToInt64() + index); int r = uv_fs_write(loop.NativeHandle, fsr.Handle, FileDescriptor, ptr, (IntPtr)count, offset, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public static void Link(Loop loop, string path, string newPath, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { callback(ex); }; int r = uv_fs_link(loop.Handle, fsr.Handle, path, newPath, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public static void Readlink(Loop loop, string path, Action<Exception, string> callback) { var fsr = new FileSystemRequest(path); fsr.Callback = (ex) => { string res = null; if (ex == null) { res = Marshal.PtrToStringAuto(fsr.Pointer); } if (callback != null) { callback(ex, res); } }; int r = uv_fs_readlink(loop.NativeHandle, fsr.Handle, path, FileSystemRequest.StaticEnd); Ensure.Success(r); }
public void Stat(Loop loop, Action<Exception, UVFileStat> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex) => { if (callback != null) { Ensure.Success(ex, callback, new UVFileStat(fsr.stat)); } }; int r = uv_fs_fstat(loop.NativeHandle, fsr.Handle, FileDescriptor, FileSystemRequest.CallbackDelegate); Ensure.Success(r); }
public void Chown(Loop loop, int uid, int gid, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = callback; int r = uv_fs_fchown(loop.NativeHandle, fsr.Handle, FileDescriptor, uid, gid, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public void Read(Loop loop, byte[] data, int index, int count, Action<Exception, int> callback, int offset) { GCHandle datagchandle = GCHandle.Alloc(data, GCHandleType.Pinned); var fsr = new FileSystemRequest(); fsr.Callback += (ex) => { callback(ex, fsr.Result.ToInt32()); datagchandle.Free(); }; var ptr = (IntPtr)(datagchandle.AddrOfPinnedObject().ToInt64() + index); int r = uv_fs_read(loop.NativeHandle, fsr.Handle, FileHandle, ptr, (IntPtr)count, offset, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public void DataSync(Loop loop, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = callback; int r = uv_fs_fdatasync(loop.NativeHandle, fsr.Handle, FileDescriptor, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public void Send(Loop loop, Tcp socket, int offset, int length, Action<Exception, int> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { if (callback != null) { callback(ex, (int)fsr.Result); }; }; int r = uv_fs_sendfile(loop.Handle, fsr.Handle, socket.handle, FileHandle, offset, length, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }
public void DataSync(Loop loop, Action<Exception> callback) { var fsr = new FileSystemRequest(); fsr.Callback = (ex, fsr2) => { callback(ex); }; int r = uv_fs_fdatasync(loop.Handle, fsr.Handle, FileHandle, FileSystemRequest.StaticEnd); Ensure.Success(r, loop); }