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
 void Finish(Exception ex)
 {
     uvfile.Close((ex2) => {
         uvfile    = null;
         IsClosing = false;
         if (shutdownCallback != null)
         {
             shutdownCallback(ex ?? ex2);
         }
     });
 }
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.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. 5
0
        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);
        }
Esempio n. 6
0
 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);
 }
Esempio n. 7
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);
                }
            });
        }