dotnetzip, aplicação não responde..
É o seguinte galera, estou desenvolvendo uma aplicação que fará o download de um arquivo em zip. E depois este arquivo será extraído e assim, substituindo os arquivos antigos. Esse é um auto update..
O problema é o seguinte:
Até 76kb.. o programa funciona numa boa, eu consigo ver o progressbar funcionando e etc..
Quando o arquivo passa para o tamanho MB, ele trava a aplicação dá um erro de not responding mas continua realizando a extração, apenas o form parece dar erro.
Vídeo que melhor explica essa situação : https://www.youtube.com/watch?v=lOPdw2V9-Bc&feature=youtu.be
Meu código:
Imports Ionic.Zip
Imports System.IO
Imports Ionic.Crc
Public Class Form1
Private Sub MyExtract()
Try
Dim ZipToUnpack As String = Application.StartupPath & "\update.zip"
Dim UnpackDirectory As String = Application.StartupPath
Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
Dim e As ZipEntry
' here, we extract every entry, but we could extract conditionally,
' based on entry name, size, date, checkbox status, etc.
For Each e In zip1
e.Extract(UnpackDirectory, ExtractExistingFileAction.OverwriteSilently)
System.Threading.Thread.Sleep(20)
Next
' MsgBox("Atualização terminou.")
Me.ProgressBar1.Value = Me.ProgressBar1.Maximum.ToString
Timer1.Enabled = False
End Using
Catch exc1 As Exception
MsgBox("Atualização deu problema.")
Timer1.Enabled = False
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MyExtract()
Timer1.Enabled = True
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ZipToUnpack As String = Application.StartupPath & "\update.zip"
Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
ProgressBar1.Maximum = zip1.Entries.Count.ToString()
Label3.Text = zip1.Entries.Count.ToString()
End Using
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
' Dim ZipToUnpack As String = Application.StartupPath & "\update.zip"
' Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
'Label2.Text = zip1.Entries.Count.ToString ' +"De" + zip1.EntryFileNames.Count.ToString
' End Using
If Me.ProgressBar1.Maximum > Me.ProgressBar1.Value Then
Me.ProgressBar1.Value += 1
MyBase.Update()
End If
Label3.Text = ProgressBar1.Maximum
Label4.Text = ProgressBar1.Value
Label5.Text = Timer1.Enabled
End SubEnd Class
Desculpe-me pelo erro no título. Pensei que fosse tag.
Discussão (1)
Carregando comentários...