Imports System.ComponentModel Imports System.IO Imports System.Net Imports System.Security.Cryptography Imports System.Text Public Class Form20 Private Sub Form20_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.Text = "Modification de " & Form2.TextBox8.Text ComboBox1.SelectedItem = "@gmail.com" End Sub Private Sub Form20_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing Form19.Close() Form18.Close() End Sub Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged End Sub Private Sub ComboBox1_SelectedValueChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedValueChanged If ComboBox1.SelectedItem = "autre" Then TextBox4.Show() ComboBox1.Hide() End If End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If TextBox1.Text = "" Then MsgBox("merci d'entre un adddress mail", MsgBoxStyle.Exclamation) Else If TextBox1.Text.Contains("@") Then MsgBox("merci d'entre le début adddress mail", MsgBoxStyle.Exclamation) Else If TextBox4.Visible = True Then If TextBox4.Text = "" Then MsgBox("merci d'entre le fin adddress mail", MsgBoxStyle.Exclamation) Else If TextBox4.Text.Contains("@") And TextBox4.Text.Contains(".") Then If TextBox2.Text = "" Then MsgBox("merci d'entre un mots de passe", MsgBoxStyle.Exclamation) Else If TextBox3.Text = "" Then MsgBox("merci de confirmer le mots de passe", MsgBoxStyle.Exclamation) Else If TextBox2.Text = TextBox3.Text Then MsgBox("une foit le code utiliser il sera supprimer", MsgBoxStyle.Information) Dim msg = MsgBox("voulez vous vraiment utiliser: " & Form18.ComboBox1.SelectedItem & " ?", MsgBoxStyle.YesNo) If msg = MsgBoxResult.Yes Then modifi() Else MsgBox("acction annuler le code n'a pas êtê supprimer", MsgBoxStyle.Information) End If Else MsgBox("les mots de passe ne corespond pas", MsgBoxStyle.Exclamation) End If End If End If Else MsgBox("merci d'entre le fin adddress mail", MsgBoxStyle.Exclamation) End If End If Else If TextBox2.Text = "" Then MsgBox("merci d'entre un mots de passe", MsgBoxStyle.Exclamation) Else If TextBox3.Text = "" Then MsgBox("merci de confirmer le mots de passe", MsgBoxStyle.Exclamation) Else If TextBox2.Text = TextBox3.Text Then MsgBox("une foit le code utiliser il sera supprimer", MsgBoxStyle.Information) Dim msg = MsgBox("voulez vous vraiment utiliser: " & Form18.ComboBox1.SelectedItem & " ?", MsgBoxStyle.YesNo) If msg = MsgBoxResult.Yes Then modifi2() Else MsgBox("acction annuler le code n'a pas êtê supprimer", MsgBoxStyle.Information) End If Else MsgBox("les mots de passe ne corespond pas", MsgBoxStyle.Exclamation) End If End If End If End If End If End If End Sub Sub modifi() Dim texteEnBytes1() As Byte = Encoding.UTF8.GetBytes(TextBox2.Text) Dim keyBytes1() As Byte = Encoding.UTF8.GetBytes("Jj@msms7") Dim Crypto1 As New DESCryptoServiceProvider() Crypto1.Key = keyBytes1 Crypto1.IV = keyBytes1 Dim Icrypto1 As ICryptoTransform = Crypto1.CreateEncryptor Dim Resultatbytes1() As Byte = Icrypto1.TransformFinalBlock(texteEnBytes1, 0, texteEnBytes1.Length) Dim passcrypt = Convert.ToBase64String(Resultatbytes1) Dim texteEnBytes2() As Byte = Encoding.UTF8.GetBytes(TextBox1.Text & TextBox4.Text) Dim keyBytes2() As Byte = Encoding.UTF8.GetBytes("Jj@msms7") Dim Crypto2 As New DESCryptoServiceProvider() Crypto2.Key = keyBytes2 Crypto2.IV = keyBytes2 Dim Icrypto2 As ICryptoTransform = Crypto2.CreateEncryptor Dim Resultatbytes2() As Byte = Icrypto2.TransformFinalBlock(texteEnBytes2, 0, texteEnBytes2.Length) Dim mailcrypt = Convert.ToBase64String(Resultatbytes2) Dim sw1 As New StreamWriter(dostemps & "pass.txt") sw1.WriteLine(passcrypt) sw1.Close() Dim sw2 As New StreamWriter(dostemps & "mail.txt") sw2.WriteLine(mailcrypt) sw2.Close() upmodifi() End Sub Sub modifi2() Dim texteEnBytes1() As Byte = Encoding.UTF8.GetBytes(TextBox2.Text) Dim keyBytes1() As Byte = Encoding.UTF8.GetBytes("Jj@msms7") Dim Crypto1 As New DESCryptoServiceProvider() Crypto1.Key = keyBytes1 Crypto1.IV = keyBytes1 Dim Icrypto1 As ICryptoTransform = Crypto1.CreateEncryptor Dim Resultatbytes1() As Byte = Icrypto1.TransformFinalBlock(texteEnBytes1, 0, texteEnBytes1.Length) Dim passcrypt = Convert.ToBase64String(Resultatbytes1) Dim texteEnBytes2() As Byte = Encoding.UTF8.GetBytes(TextBox1.Text & ComboBox1.SelectedItem) Dim keyBytes2() As Byte = Encoding.UTF8.GetBytes("Jj@msms7") Dim Crypto2 As New DESCryptoServiceProvider() Crypto2.Key = keyBytes2 Crypto2.IV = keyBytes2 Dim Icrypto2 As ICryptoTransform = Crypto2.CreateEncryptor Dim Resultatbytes2() As Byte = Icrypto2.TransformFinalBlock(texteEnBytes2, 0, texteEnBytes2.Length) Dim mailcrypt = Convert.ToBase64String(Resultatbytes2) Dim sw1 As New StreamWriter(dostemps & "pass.txt") sw1.WriteLine(passcrypt) sw1.Close() Dim sw2 As New StreamWriter(dostemps & "mail.txt") sw2.WriteLine(mailcrypt) sw2.Close() upmodifi() End Sub Sub upmodifi() Try For Each fichier As String In IO.Directory.GetFiles(dostemps) Dim info As New IO.FileInfo(fichier) My.Computer.Network.UploadFile(dostemps & info.Name, ipserver & "utilisateur/" & Form2.TextBox8.Text & "/" & info.Name) Next delfichier() 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 For Each fichier As String In IO.Directory.GetFiles(dostemps) Dim info As New IO.FileInfo(fichier) My.Computer.Network.UploadFile(dostemps & info.Name, ipserver & "utilisateur/" & Form2.TextBox8.Text & "/" & info.Name) Next delfichier() Catch ex As Exception Timer1.Start() End Try End Sub Sub delfichier() Try Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/utilisateur/" & Form2.TextBox8.Text & "/code de récupération/" & Form18.ComboBox1.SelectedItem) ftreq.Method = WebRequestMethods.Ftp.DeleteFile ftreq.Credentials = New NetworkCredential("extremedownloaders", passftp) Dim ftpresp As FtpWebResponse = ftreq.GetResponse For Each fichier As String In IO.Directory.GetFiles(dostemps) Dim info As New IO.FileInfo(fichier) File.Delete(dostemps & info.Name) Next MsgBox("la modification est terminer le code: " & Form18.ComboBox1.SelectedItem & " a êtê supprimer", MsgBoxStyle.Information) Form19.Close() Form18.Close() Close() Catch ex As Exception Timer2.Start() End Try End Sub Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick Timer2.Stop() Try Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/utilisateur/" & Form2.TextBox8.Text & "/code de récupération/" & Form18.ComboBox1.SelectedItem) ftreq.Method = WebRequestMethods.Ftp.DeleteFile ftreq.Credentials = New NetworkCredential("extremedownloaders", passftp) Dim ftpresp As FtpWebResponse = ftreq.GetResponse For Each fichier As String In IO.Directory.GetFiles(dostemps) Dim info As New IO.FileInfo(fichier) File.Delete(dostemps & info.Name) Next MsgBox("la modification est terminer le code: " & Form18.ComboBox1.SelectedItem & " a êtê supprimer", MsgBoxStyle.Information) Form19.Close() Form18.Close() Close() Catch ex As Exception Timer2.Start() End Try End Sub End Class