144 lines
6.0 KiB
VB.net
144 lines
6.0 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Imports System.Net
|
|
|
|
Public Class Form72
|
|
Dim misa As Integer = 0
|
|
Public form72misdev As Integer = 0
|
|
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
|
Close()
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
If form72misdev = 0 And vrportable = 0 Then
|
|
My.Computer.Network.DownloadFile("http://lecteur2.lecteur-media.fr/lecteur/newversion.txt", misajours & "versiontemps.txt")
|
|
misa = 1
|
|
Button1.Enabled = False
|
|
Button2.Enabled = False
|
|
ProgressBar1.Show()
|
|
Label3.Show()
|
|
Dim maj As New WebClient
|
|
Dim download As String = maj.DownloadString("http://lecteur2.lecteur-media.fr/lecteur/telechargement%20v2.txt")
|
|
téléchargerfr = New WebClient
|
|
téléchargerfr.DownloadFileTaskAsync(New Uri(download), (misajours & "mis a jours.zip"))
|
|
ElseIf vrportable = 1 Then
|
|
misa = 1
|
|
Button1.Enabled = False
|
|
Button2.Enabled = False
|
|
ProgressBar1.Show()
|
|
Label3.Show()
|
|
téléchargerfr = New WebClient
|
|
téléchargerfr.DownloadFileTaskAsync(New Uri("http://lecteur2.lecteur-media.fr/lecteur/version portable.zip"), (misajours & "mis a jours.zip"))
|
|
Else
|
|
My.Computer.Network.DownloadFile("http://lecteur2.lecteur-media.fr/lecteur/newversion.txt", misajours & "versiontemps.txt")
|
|
misa = 1
|
|
Button1.Enabled = False
|
|
Button2.Enabled = False
|
|
ProgressBar1.Show()
|
|
Label3.Show()
|
|
téléchargerfr = New WebClient
|
|
téléchargerfr.DownloadFileTaskAsync(New Uri("http://lecteur2.lecteur-media.fr/lecteur/mis a jours dev.zip"), (misajours & "mis a jours.zip"))
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Form72_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Dim lines1a() As String = File.ReadAllLines(théme)
|
|
|
|
If lines1a(0) = 2 Then
|
|
Me.BackColor = Color.FromArgb(64, 64, 64)
|
|
Button1.BackColor = Color.FromArgb(64, 64, 64)
|
|
Button1.ForeColor = Color.White
|
|
Button2.BackColor = Color.FromArgb(64, 64, 64)
|
|
Button2.ForeColor = Color.White
|
|
Label1.ForeColor = Color.White
|
|
Label2.ForeColor = Color.White
|
|
Label3.ForeColor = Color.White
|
|
ElseIf lines1a(0) = 3 Then
|
|
Me.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Button1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Button1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Button2.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Button2.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Label1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Label2.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Label3.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Else
|
|
|
|
End If
|
|
|
|
Label3.Hide()
|
|
ProgressBar1.Hide()
|
|
Form4.Hide()
|
|
End Sub
|
|
|
|
Private Sub téléchargerfr_DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs) Handles téléchargerfr.DownloadProgressChanged
|
|
ProgressBar1.Value = e.ProgressPercentage
|
|
Label3.Text = e.ProgressPercentage & " %"
|
|
End Sub
|
|
|
|
Private Sub téléchargerfr_DownloadFileCompleted(sender As Object, e As AsyncCompletedEventArgs) Handles téléchargerfr.DownloadFileCompleted
|
|
Dim sw1 As New StreamWriter(dosparamètres & "\widgets\" & "mis a jours.txt")
|
|
sw1.WriteLine(0)
|
|
misa = 0
|
|
Dim dw9 As New StreamWriter(misajours & "appli.txt")
|
|
dw9.WriteLine(My.Application.Info.DirectoryPath)
|
|
dw9.Close()
|
|
Dim dw8 As New StreamWriter(lançer)
|
|
dw8.WriteLine(0)
|
|
dw8.Close()
|
|
Form1.NotifyIcon1.Visible = False
|
|
My.Computer.Network.DownloadFile("http://lecteur2.lecteur-media.fr/lecteur/lecteur média update.exe", misajours & "lecteur média update.exe")
|
|
Dim lines7() As String = File.ReadAllLines(dosparamètres & "\widgets\" & "lançer.txt")
|
|
If lines7(0) = 1 Then
|
|
killProcess("widgets.exe")
|
|
Else
|
|
|
|
End If
|
|
Dim dw18 As New StreamWriter(dosparamètres & "\widgets\" & "lançer.txt")
|
|
dw18.WriteLine(0)
|
|
dw18.Close()
|
|
|
|
Try
|
|
Process.Start(misajours & "lecteur média update.exe")
|
|
End
|
|
Catch ex As Exception
|
|
Timer1.Start()
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Form72_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
|
If misa = 1 Then
|
|
e.Cancel = True
|
|
MsgBox("Merci de patienter un téléchargement et en cours", MsgBoxStyle.Exclamation)
|
|
Else
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Dim WithEvents téléchargerfr As WebClient
|
|
Sub killProcess(ByVal ProcessName As String)
|
|
Dim svc As Object
|
|
Dim sQuery As String
|
|
Dim oproc
|
|
svc = GetObject("winmgmts:root\cimv2")
|
|
sQuery = "select * from win32_process where name='" & ProcessName & "'"
|
|
For Each oproc In svc.execquery(sQuery)
|
|
oproc.Terminate()
|
|
Next
|
|
|
|
svc = Nothing
|
|
|
|
End Sub
|
|
|
|
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
|
|
Timer1.Stop()
|
|
|
|
Try
|
|
Process.Start(misajours & "lecteur média update.exe")
|
|
End
|
|
Catch ex As Exception
|
|
Timer1.Start()
|
|
End Try
|
|
|
|
End Sub
|
|
End Class |