1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
| Imports System.Net
Imports System.IO
Public Class Form1
Dim yop As VariantType
Dim NomFich As String
Dim act As String = "Alpha 1.2.2"
Dim NbFile As Integer
Dim fso As FileSystemObject
Private Property ProcID As Integer
Private Property ZipFile As Object
Private Property oFSO As Object
Private Sub LinkLabel1_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Form2.Show()
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
ProcID = Shell("C:\Arcanum\game.exe", AppWinStyle.NormalFocus)
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs)
End Sub
Sub checkupdates()
Me.Show()
Dim maj As New WebClient
Dim Vers As String = maj.DownloadString("http://chein.fr/arcanum/version.txt")
If My.Computer.FileSystem.FileExists("C:\arcanum\alpha1.2.3.txt") = False Then
MsgBox("mise à jour vers la version: " & Vers, MsgBoxStyle.Information)
My.Computer.FileSystem.DeleteDirectory("C:\arcanum", FileIO.UIOption.AllDialogs, FileIO.RecycleOption.SendToRecycleBin)
MsgBox("téléchargement de la nouvelle version en cours", MsgBoxStyle.Information)
Dim client As WebClient = New WebClient
AddHandler client.DownloadProgressChanged, AddressOf client_ProgressChanged
AddHandler client.DownloadFileCompleted, AddressOf client_DownloadCompleted
client.DownloadFileAsync(New Uri("http://chein.fr/arcanum/Aventure_install.exe"), "c:/aventure_install.exe")
Label3.Text = "téléchargement en cours"
Button1.Enabled = False
Else
MsgBox("Le jeu est à jour.!", MsgBoxStyle.Information)
End If
End Sub
Private Sub client_ProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs)
Dim bytesIn As Double = Double.Parse(e.BytesReceived.ToString())
Dim totalBytes As Double = Double.Parse(e.TotalBytesToReceive.ToString())
Dim percentage As Double = bytesIn / totalBytes * 100
ProgressBar1.Value = Int32.Parse(Math.Truncate(percentage).ToString())
Label2.Text = ProgressBar1.Value & (" %")
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim maj2 As New WebClient
Dim last As String = maj2.DownloadString("http://chein.fr/arcanum/dl.txt")
Dim maj As New WebClient
Dim Vers As String = maj.DownloadString("http://chein.fr/arcanum/version.txt")
MsgBox("La version du jeu est :" & Vers)
Label1.Text = (Vers)
Button1.Text = "jouer"
If My.Computer.FileSystem.FileExists("C:\arcanum\game.exe") = False Then
checkfile()
Else
checkupdates()
End If
End Sub
Private Function FileNotFoundException() As Boolean
Throw New NotImplementedException
End Function
Private Sub ProgressBar1_Click(sender As System.Object, e As System.EventArgs) Handles ProgressBar1.Click
End Sub
Private Sub client_DownloadCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs)
MessageBox.Show("Mise à jour réussie.")
Label3.Text = "Le jeu est à jour"
Button1.Text = "Jouer"
Button1.Enabled = True
Label2.Text = ProgressBar1.Value & (" %")
End Sub
Sub checkfile()
Dim maj As New WebClient
Dim Vers As String = maj.DownloadString("http://chein.fr/arcanum/version.txt")
MsgBox("Jeu introuvable, téléchargement de la version: " & Vers, MsgBoxStyle.Critical)
Dim client As WebClient = New WebClient
AddHandler client.DownloadProgressChanged, AddressOf client_ProgressChanged
AddHandler client.DownloadFileCompleted, AddressOf client_DownloadCompleted
client.DownloadFileAsync(New Uri("http://chein.fr/arcanum/Aventure_install.exe"), "c:/aventure_install.exe")
Label3.Text = "téléchargement en cours"
Button1.Enabled = False
End Sub
Private Sub Button2_Click_1(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Dim client As WebClient = New WebClient
AddHandler client.DownloadProgressChanged, AddressOf client_ProgressChanged
AddHandler client.DownloadFileCompleted, AddressOf client_DownloadCompleted
client.DownloadFileAsync(New Uri("http://chein.fr/arcanum/setup.exe"), "c:/setup.exe")
Label3.Text = "téléchargement en cours"
Button1.Enabled = False
End Sub
End Class |
Partager