代码之家  ›  专栏  ›  技术社区  ›  Marakusa

Zip文件下载已损坏

  •  -1
  • Marakusa  · 技术社区  · 6 年前

    我对“.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 回复  |  直到 6 年前
        1
  •  0
  •   Marakusa    6 年前

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