I have a problem with the ".zip" file download. I want to make a game launcher and I need to add the game download and install feature. When I download the packed game with ZipFile.DownloadFile
from the server it gets corrupted.
This is the code:
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);
What is wrong with the code?