Code
Oke hier is de complete code.
letiop hij is best lang:
[CPP]Imports System.IO
Imports System
Imports System.Net
Imports Ionic.Zip
Public Class Home
Dim WithEvents WC As New WebClient
Dim request As WebRequest = WebRequest.Create("http://dl.dropbox.com/u/46890213/Island%20Craft/version.txt")
Dim bestandnaam As String = "minecraft.jar"
Dim response As WebResponse = request.GetResponse
Dim reader As StreamReader = New StreamReader(response.GetResponseStream())
Dim stext As String = reader.ReadToEnd
Private WithEvents Downloader As WebClient
Private WithEvents httpclient As WebClient
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Not Directory.Exists(Environ("AppData") + "\.minecraft\Backup") Then
Directory.CreateDirectory(Environ("AppData") + "\.minecraft\Backup")
End If
If File.Exists(Environ("AppData") + "\.minecraft\Backup\minecraft(Old jar).jar") Then
Else
My.Computer.FileSystem.MoveFile(Environ("AppData") + "\.minecraft\bin\minecraft.jar", _
Environ("AppData") + "\.minecraft\Backup\minecraft(Old jar).jar", _
FileIO.UIOption.AllDialogs, _
FileIO.UICancelOption.ThrowException)
End If
If File.Exists(Environ("AppData") + "\.minecraft\saves\Island_Craft.zip") Then
Else
WC.DownloadFileAsync(New Uri("http://dl.dropbox.com/u/46890213/Island%20Craft/Island_Craft.zip"), Environ("AppData") + "\.minecraft\saves\Island_Craft.zip")
End If
WC.DownloadFileAsync(New Uri("http://dl.dropbox.com/u/46890213/Island%20Craft/minecraft.jar"), Environ("AppData") + "\.minecraft\bin\minecraft.jar")
End Sub
Private Sub Home_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label2.Text = "Version: "
Label3.Text = stext
End Sub
Private Sub Extractor_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Extractor.Tick
Dim ZipToUnpack As String = Environ("AppData") + "\.minecraft\saves\Island_craft.zip"
Dim UnpackDirectory As String = Environ("AppData") + "\.minecraft\saves\"
Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
Dim XD As ZipEntry
' here, we extract every entry, but we could extract conditionally,
' based on entry name, size, date, checkbox status, etc.
For Each XD In zip1
XD.Extract(UnpackDirectory, ExtractExistingFileAction.OverwriteSilently)
Next
End Using
End Sub
Private Sub Version_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Version.Tick
End Sub
Private Sub WC_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles WC.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
If ProgressBar1.Value = ProgressBar1.Maximum Then
Extractor.Start()
End If
End Sub
End Class
[/CPP]