/// <summary> /// The ExpandFileAsync. /// </summary> /// <param name="zipFile">The zipFile<see cref="string"/>.</param> /// <param name="outputDirectory">The outputDirectory<see cref="string"/>.</param> /// <returns>The <see cref="Task"/>.</returns> public async Task ExpandFileAsync(string zipFile, string outputDirectory) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); string tempGuid = Guid.NewGuid().ToString("N"); string tempZipDir = Path.Combine(Path.GetDirectoryName(zipFile), tempGuid); ZipFile.ExtractToDirectory(zipFile, tempZipDir); var firstDirectory = Directory.GetDirectories(tempZipDir).SingleOrDefault(); try { _fileHelper.CopyDirectory(firstDirectory, outputDirectory, true, true); } catch (Exception ex) { Debug.Print(ex.Message); } if (Directory.Exists(tempZipDir)) { Directory.Delete(tempZipDir, true); } if (File.Exists(zipFile)) { File.Delete(zipFile); } }