Zip文件下载已损坏

时间:2018-03-31 05:22:06

标签: c# file download zip

我的问题是" .zip"文件下载。我想制作一个游戏启动器,我需要添加游戏下载和安装功能。当我从服务器下载带有ZipFile.DownloadFile的打包游戏时,它会被破坏。

这是代码:

using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
// Installation folder will be set in the folder browse dialog
string installationFolder;

// I don't want to show the download url but its in Mediafire 
// and I tried to download it from Google Drive
string remoteUri = "the .zip file url";
string fileName = "gamename.zip", myStringWebResource = null;

// Create a new WebClient instance.
WebClient myWebClient = new WebClient();

// Concatenate the domain with the Web resource filename.
myStringWebResource = remoteUri + fileName;

// Download the Web resource and save it into the current filesystem folder.
myWebClient.DownloadFile(remoteUri, Application.StartupPath + "/gamesdownload/" + fileName);

ZipFile.ExtractToDirectory(Application.StartupPath + "/gamesdownload/gamename.zip", installationFolder);

代码有什么问题?

1 个答案:

答案 0 :(得分:0)

找到答案! 我从Mediafire改为GitHub! 这是出现错误的解决方案: The request was aborted: Could not create SSL/TLS secure channel