89 lines
3.8 KiB
VB.net
89 lines
3.8 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Public Class Form3
|
|
Dim nomprof = ""
|
|
Public opensetting = 0
|
|
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
|
|
Button1.Text = "Créer le profil: " & TextBox1.Text & " v" & ComboBox1.SelectedItem
|
|
End Sub
|
|
|
|
Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
BackColor = Form1.BackColor
|
|
ForeColor = Form1.ForeColor
|
|
TextBox1.BackColor = BackColor
|
|
TextBox2.BackColor = BackColor
|
|
Button1.BackColor = BackColor
|
|
ComboBox1.BackColor = BackColor
|
|
TextBox1.ForeColor = ForeColor
|
|
TextBox2.ForeColor = ForeColor
|
|
ComboBox1.ForeColor = ForeColor
|
|
ComboBox1.Items.Clear()
|
|
For index = 1 To 999
|
|
ComboBox1.Items.Add(index)
|
|
Next
|
|
ComboBox1.SelectedIndex = 0
|
|
End Sub
|
|
|
|
Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
|
|
If OpenFileDialog1.ShowDialog = 1 Then
|
|
PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
|
|
End If
|
|
End Sub
|
|
Private Sub ComboBox1_SelectedValueChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedValueChanged
|
|
Button1.Text = "Créer le profil: " & TextBox1.Text & " v" & ComboBox1.SelectedItem
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
If TextBox1.Text = "" Then
|
|
MsgBox("entrer un nom pour le profil", MsgBoxStyle.Exclamation)
|
|
Else
|
|
If TextBox2.Text = "" Then
|
|
MsgBox("entrer une description du profil", MsgBoxStyle.Exclamation)
|
|
Else
|
|
nomprof = TextBox1.Text & " v" & ComboBox1.SelectedItem
|
|
If Directory.Exists(profil & "/" & nomprof) = True Then
|
|
MsgBox("Le profil: " & nomprof & " exsite Déjà", MsgBoxStyle.Exclamation)
|
|
Else
|
|
Try
|
|
Directory.CreateDirectory(profil & "/" & nomprof & "/")
|
|
Directory.CreateDirectory(profil & "/" & nomprof & "/serveur/")
|
|
Directory.CreateDirectory(profil & "/" & nomprof & "/Backup/")
|
|
Dim sw1 As New StreamWriter(profil.ToString & "/" & nomprof.ToString & "/des.txt")
|
|
sw1.WriteLine(TextBox2.Text)
|
|
sw1.Close()
|
|
PictureBox1.Image.Save(profil & "/" & nomprof & "/icon.png")
|
|
MsgBox("Le profil: " & nomprof & " a bien êtê créer", MsgBoxStyle.Information)
|
|
If opensetting = 1 Then
|
|
|
|
Else
|
|
Form1.Show()
|
|
End If
|
|
Close()
|
|
Catch ex As Exception
|
|
MsgBox("une erreur est survenue", MsgBoxStyle.Critical)
|
|
End Try
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub Form3_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
|
TextBox1.Clear()
|
|
TextBox2.Clear()
|
|
ComboBox1.SelectedIndex = 0
|
|
PictureBox1.Image.Dispose()
|
|
PictureBox1.Image = My.Resources.minecraft_logo_icon_168974
|
|
Button1.Text = "Créer le profil:"
|
|
Form2.ListBox1.Items.Clear()
|
|
Form1.ComboBox1.Items.Clear()
|
|
For Each fichier As String In IO.Directory.GetDirectories(profil)
|
|
Dim info As New IO.FileInfo(fichier)
|
|
Form2.ListBox1.Items.Add(info.Name)
|
|
Next
|
|
For Each fichier As String In IO.Directory.GetDirectories(profil)
|
|
Dim info As New IO.FileInfo(fichier)
|
|
Form1.ComboBox1.Items.Add(info.Name)
|
|
Next
|
|
End Sub
|
|
End Class |