Пример #1
0
        public void RenameDirectory()
        {
            if (!Directory.Exists(Default.Directory))
            {
                Directory.CreateDirectory(Default.Directory);
            }

            UVDirectory.Rename(Default.Directory, Default.SecondDirectory, (e) => {
                Assert.IsNull(e);
                Assert.IsFalse(Directory.Exists(Default.Directory));
                Assert.IsTrue(Directory.Exists(Default.SecondDirectory));
                Directory.Delete(Default.SecondDirectory);
            });

            Loop.Default.Run();
        }
Пример #2
0
        public static Task Rename(Loop loop, string path, string newPath)
        {
            var tcs = new TaskCompletionSource <object>();

            try {
                UVDirectory.Rename(loop, path, newPath, (e) => {
                    if (e == null)
                    {
                        tcs.SetResult(null);
                    }
                    else
                    {
                        tcs.SetException(e);
                    }
                });
            } catch (Exception e) {
                tcs.SetException(e);
            }
            return(tcs.Task);
        }