예제 #1
0
        private bool ExtractDownload(IDownloadable download, string destination)
        {
            bool succeeded = false;

            Program.Launcher.UpdateStatus("Extracting " + download.ToString());
            try {
                if (Directory.Exists(destination))
                {
                    Directory.Delete(destination, true);
                }
                UpdateProgressText($"Download {downloadQueue.IndexOf(download) + 1}/{downloadQueue.Count} completed. Extracting...");
                ZipFile.ExtractToDirectory(currentFilepath, destination);
                succeeded = true;
            } catch (InvalidDataException) {
                MessageBox.Show(
                    $"Could not unzip file{Environment.NewLine}{destination}.zip.{Environment.NewLine}The file appears to be invalid. Please report this issue. In the meantime, try a manual download.",
                    "Apex Launcher Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
            }

            return(succeeded);
        }