185 lines
7.7 KiB
VB.net
185 lines
7.7 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Imports System.Net
|
|
Imports System.Security.Cryptography
|
|
Imports System.Text
|
|
|
|
Public Class Form185
|
|
Private Sub Form185_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
ComboBox1.Items.Clear()
|
|
Dim lines4() As String = File.ReadAllLines(théme)
|
|
If lines4(0) = 2 Then
|
|
Me.BackColor = Color.FromArgb(64, 64, 64)
|
|
Label1.BackColor = Color.FromArgb(64, 64, 64)
|
|
TextBox1.BackColor = Color.FromArgb(64, 64, 64)
|
|
ComboBox1.BackColor = Color.FromArgb(64, 64, 64)
|
|
Label1.ForeColor = Color.White
|
|
TextBox1.ForeColor = Color.White
|
|
ComboBox1.ForeColor = Color.White
|
|
Button1.BackColor = Color.FromArgb(64, 64, 64)
|
|
Button1.ForeColor = Color.White
|
|
ElseIf lines4(0) = 3 Then
|
|
Me.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Label1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
TextBox1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
ComboBox1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Label1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
TextBox1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
ComboBox1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Button1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Button1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
End If
|
|
|
|
Try
|
|
Dim fwr As FtpWebRequest
|
|
fwr = FtpWebRequest.Create(ipserver & "/" & "Utilisateur" & "/" & Form3.TextBox7.Text & "/")
|
|
fwr.Credentials = New NetworkCredential("yoannsafe", passftp)
|
|
fwr.Method = WebRequestMethods.Ftp.ListDirectory
|
|
Dim sr As New StreamReader(fwr.GetResponse().GetResponseStream())
|
|
|
|
Dim str As String = sr.ReadLine()
|
|
While Not str Is Nothing
|
|
|
|
If str.Contains("code") Then
|
|
ComboBox1.Items.Add(str.Replace(" " & Form3.TextBox7.Text & ".txt", ""))
|
|
End If
|
|
|
|
|
|
str = sr.ReadLine()
|
|
|
|
End While
|
|
|
|
ComboBox1.Show()
|
|
Button1.Hide()
|
|
|
|
sr.Close()
|
|
If ComboBox1.Items.Count = 0 Then
|
|
MsgBox("Aucun code de récupération est disponible", MsgBoxStyle.Critical)
|
|
Close()
|
|
Else
|
|
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
Timer2.Start()
|
|
End Try
|
|
|
|
End Sub
|
|
Private Sub ComboBox1_SelectedValueChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedValueChanged
|
|
Label1.Text = "Entrer le code de: " & ComboBox1.SelectedItem
|
|
Try
|
|
My.Computer.Network.DownloadFile(ipsite & "/utilisateur/" & Form3.TextBox7.Text & "/" & ComboBox1.SelectedItem & " " & Form3.TextBox7.Text & ".txt", cozip & ComboBox1.SelectedItem & " " & Form3.TextBox7.Text & ".txt")
|
|
veri()
|
|
Catch ex As Exception
|
|
Timer1.Start()
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
|
|
Timer1.Stop()
|
|
Try
|
|
My.Computer.Network.DownloadFile(ipsite & "/utilisateur/" & Form3.TextBox7.Text & "/" & ComboBox1.SelectedItem & " " & Form3.TextBox7.Text & ".txt", cozip & ComboBox1.SelectedItem)
|
|
veri()
|
|
Catch ex As Exception
|
|
Timer1.Start()
|
|
End Try
|
|
End Sub
|
|
Sub veri()
|
|
ComboBox1.Hide()
|
|
Button1.Show()
|
|
TextBox1.Show()
|
|
End Sub
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
Dim lines() As String = File.ReadAllLines(cozip & ComboBox1.SelectedItem & " " & Form3.TextBox7.Text & ".txt")
|
|
Dim Resultatbytes() As Byte = Convert.FromBase64String(lines(0))
|
|
Dim keyBytes() As Byte = Encoding.UTF8.GetBytes("Jj@msms7")
|
|
Dim Crypto As New DESCryptoServiceProvider()
|
|
Crypto.Key = keyBytes
|
|
Crypto.IV = keyBytes
|
|
Dim Icrypto As ICryptoTransform = Crypto.CreateDecryptor()
|
|
Dim donné() As Byte = Icrypto.TransformFinalBlock(Resultatbytes, 0, Resultatbytes.Length)
|
|
Dim maildecrypt = Encoding.UTF8.GetString(donné)
|
|
File.Delete(cozip & ComboBox1.SelectedItem & " " & Form3.TextBox7.Text & ".txt")
|
|
If TextBox1.Text = maildecrypt.ToString Then
|
|
Form186.ShowDialog()
|
|
Else
|
|
MsgBox("Code de récupération incorrect", MsgBoxStyle.Critical)
|
|
Close()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub Form185_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
|
TextBox1.Text = ""
|
|
TextBox1.Hide()
|
|
ComboBox1.Items.Clear()
|
|
Label1.Text = "Sélectionner un code ?"
|
|
End Sub
|
|
|
|
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
|
|
Timer2.Stop()
|
|
Try
|
|
ComboBox1.Items.Clear()
|
|
Dim fwr As FtpWebRequest
|
|
fwr = FtpWebRequest.Create(ipserver & "/" & "Utilisateur" & "/" & Form3.TextBox7.Text & "/")
|
|
fwr.Credentials = New NetworkCredential("yoannsafe", passftp)
|
|
fwr.Method = WebRequestMethods.Ftp.ListDirectory
|
|
Dim sr As New StreamReader(fwr.GetResponse().GetResponseStream())
|
|
|
|
Dim str As String = sr.ReadLine()
|
|
While Not str Is Nothing
|
|
|
|
ComboBox1.Items.Add(str)
|
|
Directory.CreateDirectory(cozip & str)
|
|
ComboBox1.Items.Remove("Dictée")
|
|
ComboBox1.Items.Remove("Dirve")
|
|
ComboBox1.Items.Remove("pc")
|
|
ComboBox1.Items.Remove("co.zip")
|
|
ComboBox1.Items.Remove("index.php")
|
|
ComboBox1.Items.Remove("photo.png")
|
|
ComboBox1.Items.Remove("mail.txt")
|
|
ComboBox1.Items.Remove("setting.txt")
|
|
ComboBox1.Items.Remove("pass.txt")
|
|
ComboBox1.Items.Remove("vérification.txt")
|
|
ComboBox1.Items.Remove("historique.txt")
|
|
|
|
str = sr.ReadLine()
|
|
|
|
End While
|
|
|
|
If Directory.Exists(cozip & "playlist") = True Then
|
|
ComboBox1.Items.Remove("playlist")
|
|
For Each fichier As String In IO.Directory.GetDirectories(cozip)
|
|
Dim info As New IO.FileInfo(fichier)
|
|
Directory.Delete(cozip & info.Name)
|
|
Next
|
|
Else
|
|
For Each fichier As String In IO.Directory.GetDirectories(cozip)
|
|
Dim info As New IO.FileInfo(fichier)
|
|
Directory.Delete(cozip & info.Name)
|
|
Next
|
|
End If
|
|
|
|
ComboBox1.Show()
|
|
Button1.Hide()
|
|
|
|
sr.Close()
|
|
If ComboBox1.Items.Count = 0 Then
|
|
MsgBox("Aucun code de récupération est disponible", MsgBoxStyle.Critical)
|
|
Close()
|
|
Else
|
|
|
|
End If
|
|
Catch ex As Exception
|
|
Timer2.Start()
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
|
|
|
|
End Sub
|
|
|
|
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
|
|
|
|
End Sub
|
|
End Class |