Esempio n. 1
0
        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);
                }
            });
        }
Esempio n. 2
0
		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);
		}
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
                }
                if (callback != null)
                {
                    callback(ex, file);
                }
            };
            int r = uv_fs_open(loop.NativeHandle, fsr.Handle, path, (int)access, 0, FileSystemRequest.StaticEnd);

            Ensure.Success(r, loop);
        }
Esempio n. 5
0
 public static Task <UVFile?> Open(Loop loop, string path, UVFileAccess access)
 {
     return(HelperFunctions.Wrap <Loop, string, UVFileAccess, UVFile>(loop, path, access, UVFile.Open));
 }
Esempio n. 6
0
 public static Task <UVFile?> Open(string path, UVFileAccess access)
 {
     return(Open(Loop.Constructor, path, access));
 }
Esempio n. 7
0
 public static void Open(string path, UVFileAccess access, Action <Exception, UVFile> callback)
 {
     Open(Loop.Constructor, path, access, callback);
 }
Esempio n. 8
0
 public static void Open(string path, UVFileAccess access, Action<Exception, UVFile> callback)
 {
     Open(Loop.Default, path, access, callback);
 }
Esempio n. 9
0
 public static Task <UVFile> Open(Loop loop, string path, UVFileAccess access)
 {
     return(FWrap <UVFile, string, UVFileAccess>(loop, path, access, UVFile.Open));
 }
Esempio n. 10
0
 public static Task <UVFile> Open(string path, UVFileAccess access)
 {
     return(Open(Loop.Default, path, access));
 }
 public static Task OpenAsync(this UVFileStream filestream, string path, UVFileAccess access)
 {
     return(HelperFunctions.Wrap(path, access, filestream.Open));
 }
		public static Task OpenAsync(this UVFileStream filestream, string path, UVFileAccess access)
		{
			return HelperFunctions.Wrap(path, access, filestream.Open);
		}
Esempio n. 13
0
        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);
                }
            });
        }
Esempio n. 14
0
		public static Task<UVFile> Open(Loop loop, string path, UVFileAccess access)
		{
			return HelperFunctions.Wrap<Loop, string, UVFileAccess, UVFile>(loop, path, access, UVFile.Open);
		}
Esempio n. 15
0
		public static Task<UVFile> Open(string path, UVFileAccess access)
		{
			return Open(Loop.Constructor, path, access);
		}
Esempio n. 16
0
 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);
         }
         if (callback != null) {
             callback(ex, file);
         }
     };
     int r = uv_fs_open(loop.NativeHandle, fsr.Handle, path, (int)access, 0, FileSystemRequest.StaticEnd);
     Ensure.Success(r, loop);
 }