Пример #1
0
        /// <summary>
        /// Deletes the current folder.
        /// </summary>
        /// <returns></returns>
        public Task DeleteAsync()
        {
#if WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE
            return(_folder.DeleteAsync().AsTask());
#else
            return(DeleteAsync(StorageDeleteOption.Default));
#endif
        }
Пример #2
0
        /// <summary>
        /// removes the specified directory
        /// </summary>
        /// <param name="path"></param>
        public async Task <bool> RemoveDirectory(string fullPath)
        {
            bool bRes = await DirectoryExists(fullPath);

            if (bRes == true)
            {
                Windows.Storage.StorageFolder folder = await applicationData.LocalFolder.GetFolderAsync(fullPath);

                if (folder != null)
                {
                    await folder.DeleteAsync();

                    return(true);
                }
            }
            return(false);
        }
        public async Task Cleanup()
        {
            foreach (var filename in _filenames)
            {
                try
                {
                    var testFile = await _folderForTestFiles.GetFileAsync(filename);

                    if (testFile != null)
                    {
                        await testFile.DeleteAsync();
                    }
                }
                catch
                {
                    Assert.Fail("DeleteAsync (file) exception - error outside tested method");
                }
            }

            foreach (var foldername in _foldernames)
            {
                try
                {
                    var testFolder = await _folderForTestFiles.GetFolderAsync(foldername);

                    if (testFolder != null)
                    {
                        await testFolder.DeleteAsync();
                    }
                }
                catch
                {
                    Assert.Fail("DeleteAsync (folder) exception - error outside tested method");
                }
            }

            await _folderForTestFiles.DeleteAsync();
        }