Пример #1
0
 public void DeleteFile_RightParams_DeleteFile()
 {
     using (File.Create(@"C:\Home\Temp\1.txt"))
     {
     }
     fileSystemProvider.DeleteFile(@"C:\Home\Temp\1.txt");
     Assert.IsFalse(File.Exists(@"C:\Home\Temp\1.txt"));
 }
Пример #2
0
        void SyncSharedCallback()
        {
            var             local  = new FileSystemProvider(_context.LocalStorage, Provider.SharedDirectory);
            IRemoteProvider remote = CreateRemote(Provider.SharedDirectory);

            // download
            var remoteItems = new List <Item>(remote.Items);

            foreach (Item r in remoteItems)
            {
                if (!local.FileExists(r.RelativePath) || local.FindFile(r.RelativePath).Time < r.Time)
                {
                    Item item = r;
                    remote.LoadFile(r.RelativePath, stream => local.SaveFile(item.RelativePath, stream));
                }
            }

            // remove deleted
            var localItems = new List <Item>(local.Items);

            foreach (Item l in localItems)
            {
                if (!remote.Items.Exists(val => val.RelativePath == l.RelativePath))
                {
                    local.DeleteFile(l.RelativePath);
                }
            }
        }
Пример #3
0
        public async Task DeleteTest()
        {
            var provider = new FileSystemProvider(BaseDir);
            var filename = Path.GetRandomFileName();
            var add      = await provider.AddFile(RandomFileGenerator.RandomFileByteArray(1000), filename);

            Assert.IsTrue(await provider.DeleteFile(filename));
            Assert.IsFalse(await provider.FileExists(filename));
        }
Пример #4
0
 /// <summary>
 /// deletes a file by virtual path
 /// </summary>
 /// <param name="VirtualPath">virtual path</param>
 public static void DeleteFile(string VirtualPath)
 {
     FileSystemProvider.DeleteFile(VirtualPath);
 }