示例#1
0
        public void CreateDirectory()
        {
            if (Directory.Exists(Default.Directory))
            {
                Directory.Delete(Default.Directory, true);
            }

            UVDirectory.Create(Default.Directory, 511, (e) => {
                Assert.IsNull(e);
                Assert.IsTrue(Directory.Exists(Default.Directory));
                Directory.Delete(Default.Directory);
            });

            Loop.Default.Run();
        }
        public static Task Create(Loop loop, string name, int mode)
        {
            var tcs = new TaskCompletionSource <object>();

            try {
                UVDirectory.Create(loop, name, mode, (e) => {
                    if (e == null)
                    {
                        tcs.SetResult(null);
                    }
                    else
                    {
                        tcs.SetException(e);
                    }
                });
            } catch (Exception e) {
                tcs.SetException(e);
            }
            return(tcs.Task);
        }