Sub Process_Globals
Private ProgressTimer As Timer
End Sub
Sub Globals
Dim ZipProgress As Int
Dim Zip As ArchiverPlusZip
Dim ZipPassWord As String="123456"
Dim ProgressPanel As Panel, ProgressLabel As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
ProgressTimer.Initialize("ProgressTimer",500)
End Sub
Sub DeZip(FileName As String,TargetName As String ) As String
ProgressTimer.Enabled=True
ZipProgress=0
ToastMessageShow("new file de-zipping",True)
Dim NeededTime As Long=DateTime.Now
Log("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZip START ")
Log("zip file= >" & FileName & "<" )
Log("wish target name=" & TargetName)
Zip.DecryptZipWithString(ZipPassWord)
Dim ZipFileName As String = File.Combine( File.DirInternal, FileName)
Dim lstEntries As List = Zip.ListZipEntries(ZipFileName)
Dim ZipInfo As ArchiverZipInfo = lstEntries.Get(0)
If TargetName="" Then
TargetName= ZipInfo.FileName
Zip.UnZip(ZipFileName,File.DirInternal,"ZipEvent")
Else
Log("contained file=" & ZipInfo.FileName)
Dim SourceFileName=ZipInfo.FileName
Zip.UnZipFile2(ZipFileName,SourceFileName,File.DirInternal,TargetName,"ZipEvent")
End If
Log("B finished" & (DateTime.Now-NeededTime ))
File.Delete(File.DirInternal,FileName)
Return TargetName
End Sub
Sub ZipEvent_ZipResult(Result As Int,Error As String )
Log("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZip RESULT")
Log("Zip ready" & Result & " " & Error)
ZipProgress= 101
End Sub
Sub ZipEvent_ZipProgression(Operation As Int,Filename As String, Percent As Float )
Log("de-zip working " & Operation & " " & Percent)
ZipProgress=Percent
End Sub
Sub ProgressTimer_Tick
If ZipProgress=101 Then
ProgressTimer.Enabled=False
ProgressPanel.Visible=False
Return
End If
ProgressLabel.Text=ZipProgress &"%"
End Sub