91 lines
3.9 KiB
VB.net
91 lines
3.9 KiB
VB.net
Imports System.Security.Cryptography
|
|
Imports System.Text
|
|
Imports System.IO
|
|
Imports System.ComponentModel
|
|
|
|
Public Class Form200
|
|
Dim closea As Integer = 1
|
|
Dim ess As Integer = 0
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
If ess = 3 Then
|
|
End
|
|
Else
|
|
Dim texteEnBytes() As Byte = Encoding.UTF8.GetBytes(TextBox1.Text)
|
|
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.CreateEncryptor
|
|
Dim Resultatbytes() As Byte = Icrypto.TransformFinalBlock(texteEnBytes, 0, texteEnBytes.Length)
|
|
Dim passecrypt = Convert.ToBase64String(Resultatbytes)
|
|
|
|
Dim lines1() As String = File.ReadAllLines(dosprofils & "/" & nomprofils & "\passe.txt")
|
|
|
|
If passecrypt = lines1(0) Then
|
|
Form197.Visible = True
|
|
Close()
|
|
Me.Visible = False
|
|
Form197.Timer1.Start()
|
|
Else
|
|
TextBox1.Clear()
|
|
ess = ess + 1
|
|
MsgBox("Mots de passe incorrect", MsgBoxStyle.Exclamation)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Form200_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
|
If closea = 1 Then
|
|
e.Cancel = True
|
|
Else
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown
|
|
If e.KeyData = Keys.Enter Then
|
|
If ess = 3 Then
|
|
End
|
|
Else
|
|
Dim texteEnBytes() As Byte = Encoding.UTF8.GetBytes(TextBox1.Text)
|
|
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.CreateEncryptor
|
|
Dim Resultatbytes() As Byte = Icrypto.TransformFinalBlock(texteEnBytes, 0, texteEnBytes.Length)
|
|
Dim passecrypt = Convert.ToBase64String(Resultatbytes)
|
|
|
|
Dim lines1() As String = File.ReadAllLines(dosprofils & "/" & nomprofils & "\passe.txt")
|
|
|
|
If passecrypt = lines1(0) Then
|
|
Form197.Visible = True
|
|
Close()
|
|
Me.Visible = False
|
|
Form197.Timer1.Start()
|
|
Else
|
|
TextBox1.Clear()
|
|
ess = ess + 1
|
|
MsgBox("Mots de passe incorrect", MsgBoxStyle.Exclamation)
|
|
End If
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Form200_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Dim lines1() As String = File.ReadAllLines(théme)
|
|
If lines1(0) = 2 Then
|
|
Me.BackColor = Color.FromArgb(64, 64, 64)
|
|
TextBox1.BackColor = Color.FromArgb(64, 64, 64)
|
|
Button1.BackColor = Color.FromArgb(64, 64, 64)
|
|
TextBox1.ForeColor = Color.White
|
|
Button1.ForeColor = Color.White
|
|
ElseIf lines1(0) = 3 Then
|
|
Me.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
TextBox1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Button1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
TextBox1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Button1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
End If
|
|
End Sub
|
|
End Class |