コード例 #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);
                }
            });
        }
コード例 #2
0
 void Finish(Exception ex)
 {
     uvfile.Close((ex2) => {
         uvfile    = null;
         IsClosing = false;
         if (shutdownCallback != null)
         {
             shutdownCallback(ex ?? ex2);
         }
     });
 }
コード例 #3
0
ファイル: UVFile.cs プロジェクト: lrdcasimir/LibuvSharp
		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);
		}
コード例 #4
0
ファイル: UVFile.cs プロジェクト: oskardahlberg/LibuvSharp
        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);
        }
コード例 #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);
        }
コード例 #6
0
ファイル: UVFile.cs プロジェクト: carlokok/LibuvSharp
 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);
 }
コード例 #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);
                }
            });
        }