99 lines
4.2 KiB
VB.net
99 lines
4.2 KiB
VB.net
Imports System.IO
|
|
Imports System.Runtime.InteropServices
|
|
Imports System.Security.Cryptography
|
|
Imports System.Text
|
|
|
|
Public Class Form27
|
|
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
|
|
ComboBox1.Hide()
|
|
TextBox2.Show()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
If TextBox1.Text = "" Then
|
|
MsgBox("merci d'entrer votre address mail", MsgBoxStyle.Exclamation)
|
|
Else
|
|
If TextBox1.Text.Contains("@") Then
|
|
MsgBox("merci d'entrer que le début de votre address mail", MsgBoxStyle.Exclamation)
|
|
Else
|
|
If TextBox2.Visible = True Then
|
|
If TextBox2.Text = "" Then
|
|
MsgBox("merci d'entrer la finde votre address mail", MsgBoxStyle.Exclamation)
|
|
Else
|
|
If TextBox2.Text.Contains("@") Then
|
|
If TextBox2.Text.Contains(".") Then
|
|
mailcrypte2()
|
|
Else
|
|
MsgBox("merci d'entrer la fin de votre address mail", MsgBoxStyle.Exclamation)
|
|
End If
|
|
Else
|
|
MsgBox("merci d'entrer la fin de votre address mail", MsgBoxStyle.Exclamation)
|
|
End If
|
|
End If
|
|
Else
|
|
If ComboBox1.SelectedItem = "" Then
|
|
MsgBox("merci de selectionnez le fin de votre address mail", MsgBoxStyle.Exclamation)
|
|
Else
|
|
mailcrypte()
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
End Sub
|
|
Sub mailcrypte()
|
|
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 mailcrypte = Convert.ToBase64String(Resultatbytes2)
|
|
Dim sw1 As New StreamWriter(dostemps & "mail.txt")
|
|
sw1.WriteLine(mailcrypte)
|
|
sw1.Close()
|
|
mailup()
|
|
End Sub
|
|
Sub mailcrypte2()
|
|
Dim texteEnBytes2() As Byte = Encoding.UTF8.GetBytes(TextBox1.Text & TextBox2.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 mailcrypte = Convert.ToBase64String(Resultatbytes2)
|
|
Dim sw1 As New StreamWriter(dostemps & "mail.txt")
|
|
sw1.WriteLine(mailcrypte)
|
|
sw1.Close()
|
|
mailup()
|
|
End Sub
|
|
Sub mailup()
|
|
Try
|
|
My.Computer.Network.UploadFile(dostemps & "mail.txt", ipserver & "/utilisateur/" & nomutilisateur & "/mail.txt")
|
|
File.Delete(dostemps & "mail.txt")
|
|
MsgBox("votre mail est bien êtê modifier", MsgBoxStyle.Information)
|
|
Close()
|
|
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.UploadFile(dostemps & "mail.txt", ipserver & "/utilisateur/" & nomutilisateur & "/mail.txt")
|
|
File.Delete(dostemps & "mail.txt")
|
|
MsgBox("votre mail est bien êtê modifier", MsgBoxStyle.Information)
|
|
Close()
|
|
Catch ex As Exception
|
|
Timer1.Start()
|
|
End Try
|
|
End Sub
|
|
End Class |