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
| Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If My.Computer.FileSystem.FileExists(dlauncher & "UP.exe") Then
My.Computer.FileSystem.DeleteFile(dlauncher & "UP.exe")
End If
If My.Computer.FileSystem.FileExists(dlauncher & "update.txt") Then
My.Computer.FileSystem.DeleteFile(dlauncher & "update.txt")
End If
If My.Computer.FileSystem.FileExists(dlauncher & "site.txt") Then
My.Computer.FileSystem.DeleteFile(dlauncher & "site.txt")
End If
PositronTheme1.Text = "Launcher " & servername
downloadmods.Text = "Chargement... ! Mais cliquez pour télécharger"
versao.Text = "Version du launcher: " & Application.ProductVersion
updatemods.RunWorkerAsync() ' On vois si il n'y a pas de mise à jour des mods
My.Computer.FileSystem.CreateDirectory(appdata) 'On crée un dossier pour y placer tout ce don le launcher a besoin
user_log.Text = "Identifié en tant que : " & user ' Un truc pas utile :D
If My.Computer.FileSystem.FileExists(appdata & "destination.a3") Then ' On verifie si la destination à deja été choisi
destination = My.Computer.FileSystem.ReadAllText(appdata & "destination.a3")
destino.Text = "Destination d'Arma3: "" " & destination & " """
If My.Computer.FileSystem.FileExists(destination & "arma3.exe") Then
Else
MsgBox("La destination d'Arma3 n'est pas valide !")
End If
Else
If MsgBox("Aucune destination selectionné pour Arma3, voulez vous la selectionner ?", MsgBoxStyle.YesNo, "Destination Arma3 non dispo.") = vbYes Then
FolderBrowserDialog1.ShowDialog()
destination = FolderBrowserDialog1.SelectedPath & "\"
My.Computer.FileSystem.WriteAllText(appdata & "destination.a3", destination, False)
If My.Computer.FileSystem.FileExists(destination & "arma3.exe") Then
Else
MsgBox("La destination choisi n'est pas valide !")
End If
destino.Text = "Destination d'Arma3: "" " & destination & " """
downloadmods.Enabled = True
End If
End If
My.Computer.FileSystem.CreateDirectory("C:/Autres/Launcher/")
If My.Computer.FileSystem.FileExists("C:/Autres/Launcher/listpack.txt") Then
My.Computer.FileSystem.DeleteFile("C:/Autres/Launcher/listpack.txt") '<----------ERREUR ICI -------------
Else
End If
My.Computer.FileSystem.WriteAllText("C:/Autres/Launcher/listpack.txt", "updatepack.txt" & vbNewLine & "basepack.txt" & vbNewLine & "delete.txt", False)
Dim src As New StreamReader("C:/Autres/Launcher/listpack.txt")
While src.Peek <> -1
ligne = src.ReadLine()
If My.Computer.FileSystem.FileExists("C:/Autres/Launcher/" & ligne) Then
My.Computer.FileSystem.DeleteFile("C:/Autres/Launcher/" & ligne)
Else
End If
Dim Download As WebClient = New WebClient
AddHandler Download.DownloadProgressChanged, AddressOf client_ProgressChanged
AddHandler Download.DownloadFileCompleted, AddressOf client_DownloadCompleted
Download.DownloadFileAsync(New Uri(website & ligne), "C:/Autres/Launcher/" & ligne)
End While
Form2Load.RunWorkerAsync()
End Sub |
Partager