The code is giving this error:
A first chance exception of type 'Ionic.Zip.ZipException' occurred in Ionic.Zip.dll
Additional information: Can not read that as a ZipFileIf there is a handler for this exception, the program may be continued.
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Ionic.Zip;
using System.Net;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
private void button1_Click(object sender, System.EventArgs e)
{
string pastaJogo = @"C:\Game\Play.exe";
System.Diagnostics.Process.Start(pastaJogo);
MessageBox.Show("Espere Um Pouco");
Environment.Exit(0);
}
public void AUTOALIZAR_Click(object sender, EventArgs e)
{
WebClient wc = new WebClient();
string fileSave = @"C:\Game\Play.zip";
string zipFileSave = @"C:\Game\Play.zip";
string zipFileSaveExtract = @"C:\Game";
string downloadUrl = "https://www.dropbox.com/s/sq8s2bnyj5fqacv/plsay.zip?dl=1";
MessageBox.Show("Esta Autoalizando...");
wc.DownloadFileAsync(new Uri(downloadUrl), fileSave);
wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(c_DownloadProgress);
ZipFile zip = ZipFile.Read(zipFileSave);
zip.ExtractAll(zipFileSaveExtract);
wc.DownloadFileCompleted += new AsyncCompletedEventHandler(c_DownloadFileCompleted);
}
public void c_DownloadProgress(object sender, DownloadProgressChangedEventArgs e)
{
int bytesin = int.Parse(e.BytesReceived.ToString());
int totalbyte = int.Parse(e.TotalBytesToReceive.ToString());
int kb1 = bytesin / 1024;
int kb2 = totalbyte / 1024;
progressBar1.Value = e.ProgressPercentage;
label1.Text = kb1.ToString() + "KB Faltam " + kb2.ToString() + "KB " + e.ProgressPercentage.ToString() + "%";
}
public void c_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show("Complete");
}
private void Exit_Click(object sender, EventArgs e)
{
Environment.Exit(0);
}
}
}