Files
extreme-downloaders/Form7.vb
T
2026-06-18 14:07:09 +02:00

758 lines
30 KiB
VB.net

Imports System.ComponentModel
Imports System.IO
Imports System.Net
Imports System.Reflection
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
Public Class Form7
Dim urlup = ""
Dim filedl = 0
Private Sub Label4_Click(sender As Object, e As EventArgs) Handles Label4.Click, Label9.Click, Label8.Click, Label7.Click, Label10.Click
End Sub
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
End Sub
Private Sub Form7_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If OpenFileDialog1.ShowDialog = 1 Then
If Directory.Exists(dostemps & "\imges\") = True Then
Directory.Delete(dostemps & "\imges\")
End If
Directory.CreateDirectory(dostemps & "\imges\")
TextBox2.Text = OpenFileDialog1.SafeFileName
ComboBox1.SelectedItem = "logiciels"
ComboBox4.SelectedItem = "Oui"
ComboBox5.SelectedItem = "Graduit"
Else
Close()
End If
End Sub
Private Sub ComboBox4_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox4.SelectedIndexChanged
End Sub
Private Sub ComboBox4_SelectedValueChanged(sender As Object, e As EventArgs) Handles ComboBox4.SelectedValueChanged
If ComboBox4.SelectedItem = "Oui" Then
TextBox3.Show()
TextBox3.Text = "https://"
Else
TextBox3.Hide()
End If
End Sub
Private Sub ComboBox5_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox5.SelectedIndexChanged
If ComboBox5.SelectedItem = "Graduit" Then
TextBox4.Hide()
Else
TextBox4.Show()
TextBox4.Text = "1"
End If
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedItem = "logiciels" Then
Button5.Hide()
ComboBox6.Hide()
Label11.Hide()
Label4.Hide()
Label3.Hide()
ComboBox2.Hide()
ComboBox3.Hide()
Button3.Hide()
Label9.Hide()
If Directory.Exists(dostemps & "\addon\") = True Then
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\addon\")
Dim info As New IO.FileInfo(fichier)
File.Delete(dostemps & "\addon\" & info.Name)
Next
Directory.Delete(dostemps & "\addon\")
ListBox2.Items.Clear()
Label9.Text = "0"
End If
ElseIf ComboBox1.SelectedItem = "jeux" Then
Button5.Hide()
ComboBox6.Hide()
Label11.Hide()
Label4.Hide()
Label3.Show()
ComboBox2.Items.Clear()
ComboBox3.Hide()
Button3.Hide()
Label9.Hide()
ComboBox2.Show()
ComboBox2.Items.Add("Tout les jeux")
ComboBox2.Items.Add("Minecraft")
ComboBox2.SelectedItem = "Tout les jeux"
ElseIf ComboBox1.SelectedItem = "ISO" Then
Button5.Hide()
Label11.Hide()
ComboBox6.Hide()
Label4.Hide()
Label3.Show()
ComboBox2.Items.Clear()
ComboBox3.Hide()
Button3.Hide()
Label9.Hide()
ComboBox2.Show()
ComboBox2.Items.Add("Windows")
ComboBox2.Items.Add("Linux")
ComboBox2.Items.Add("Autre")
ComboBox2.SelectedItem = "Windows"
If Directory.Exists(dostemps & "\addon\") = True Then
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\addon\")
Dim info As New IO.FileInfo(fichier)
File.Delete(dostemps & "\addon\" & info.Name)
Next
Directory.Delete(dostemps & "\addon\")
ListBox2.Items.Clear()
Label9.Text = "0"
End If
End If
End Sub
Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
If ComboBox2.SelectedItem = "Minecraft" Then
Button5.Hide()
ComboBox6.Items.Clear()
ComboBox6.Show()
Label11.Show()
ComboBox6.Items.Add("serveur")
ComboBox6.Items.Add("plugin")
ComboBox6.Items.Add("mod")
ComboBox6.Items.Add("map")
ComboBox6.Items.Add("Launcher")
ComboBox6.SelectedItem = "map"
Else
Button5.Hide()
ComboBox6.Hide()
Label11.Hide()
ComboBox3.Hide()
Label4.Hide()
Button3.Hide()
Label9.Hide()
If Directory.Exists(dostemps & "\addon\") = True Then
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\addon\")
Dim info As New IO.FileInfo(fichier)
File.Delete(dostemps & "\addon\" & info.Name)
Next
Directory.Delete(dostemps & "\addon\")
ListBox2.Items.Clear()
Label9.Text = "0"
End If
End If
End Sub
Private Sub ComboBox6_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox6.SelectedIndexChanged
If ComboBox6.SelectedItem = "Launcher" Then
Button5.Hide()
Label11.Show()
ComboBox3.Hide()
Label4.Hide()
Button3.Hide()
Label9.Hide()
If Directory.Exists(dostemps & "\addon\") = True Then
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\addon\")
Dim info As New IO.FileInfo(fichier)
File.Delete(dostemps & "\addon\" & info.Name)
Next
Directory.Delete(dostemps & "\addon\")
ListBox2.Items.Clear()
Label9.Text = "0"
End If
ElseIf ComboBox6.SelectedItem = "serveur" Then
Button5.Hide()
Label11.Show()
ComboBox3.Show()
Label4.Show()
Button3.Hide()
Label9.Hide()
ComboBox3.Items.Clear()
Try
Dim fwr As FtpWebRequest
fwr = FtpWebRequest.Create(ipserver & "Téléchargeur/jeux/Minecraft/serveur/")
fwr.Credentials = New NetworkCredential("extremedownloaders", 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
ComboBox3.Items.Add(str)
str = sr.ReadLine()
End While
sr.Close()
Catch ex As Exception
End Try
ComboBox3.SelectedIndex = 0
If Directory.Exists(dostemps & "\addon\") = True Then
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\addon\")
Dim info As New IO.FileInfo(fichier)
File.Delete(dostemps & "\addon\" & info.Name)
Next
Directory.Delete(dostemps & "\addon\")
ListBox2.Items.Clear()
Label9.Text = "0"
End If
ElseIf ComboBox6.SelectedItem = "plugin" Then
Button5.Show()
Label11.Show()
ComboBox3.Show()
Label4.Show()
Button3.Show()
Label9.Show()
ComboBox3.Items.Clear()
Try
Dim fwr As FtpWebRequest
fwr = FtpWebRequest.Create(ipserver & "Téléchargeur/jeux/Minecraft/plugin/")
fwr.Credentials = New NetworkCredential("extremedownloaders", 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
ComboBox3.Items.Add(str)
str = sr.ReadLine()
End While
sr.Close()
Catch ex As Exception
End Try
ComboBox3.SelectedIndex = 0
If Directory.Exists(dostemps & "\addon\") = True Then
Else
Directory.CreateDirectory(dostemps & "\addon\")
End If
ElseIf ComboBox6.SelectedItem = "mod" Then
Button5.Show()
Label11.Show()
ComboBox3.Show()
Label4.Show()
Button3.Show()
Label9.Show()
ComboBox3.Items.Clear()
Try
Dim fwr As FtpWebRequest
fwr = FtpWebRequest.Create(ipserver & "Téléchargeur/jeux/Minecraft/mod/")
fwr.Credentials = New NetworkCredential("extremedownloaders", 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
ComboBox3.Items.Add(str)
str = sr.ReadLine()
End While
sr.Close()
Catch ex As Exception
End Try
ComboBox3.SelectedIndex = 0
If Directory.Exists(dostemps & "\addon\") = True Then
Else
Directory.CreateDirectory(dostemps & "\addon\")
End If
ElseIf ComboBox6.SelectedItem = "map" Then
Button5.Hide()
Label11.Show()
ComboBox3.Show()
Label4.Show()
Button3.Hide()
Label9.Hide()
ComboBox3.Items.Clear()
Try
Dim fwr As FtpWebRequest
fwr = FtpWebRequest.Create(ipserver & "Téléchargeur/jeux/Minecraft/map/")
fwr.Credentials = New NetworkCredential("extremedownloaders", 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
ComboBox3.Items.Add(str)
str = sr.ReadLine()
End While
sr.Close()
Catch ex As Exception
End Try
ComboBox3.SelectedIndex = 0
If Directory.Exists(dostemps & "\addon\") = True Then
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\addon\")
Dim info As New IO.FileInfo(fichier)
File.Delete(dostemps & "\addon\" & info.Name)
Next
Directory.Delete(dostemps & "\addon\")
ListBox2.Items.Clear()
Label9.Text = "0"
End If
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If OpenFileDialog2.ShowDialog = 1 Then
ListBox1.Items.Clear()
Dim index As Integer = 0
Dim fichier2 As String = "" & vbNewLine
For Each fileselected1 As String In OpenFileDialog2.FileNames
FileCopy(fileselected1, dostemps & "\imges\" & OpenFileDialog2.SafeFileNames(index))
fichier2 = fichier2 & " " & OpenFileDialog2.SafeFileNames(index) & vbNewLine
index = index + 1
Next
If index > 1 Then
index = 0
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\imges\")
Dim info As New IO.FileInfo(fichier)
ListBox1.Items.Add(info.Name)
Next
Label8.Text = ListBox1.Items.Count
MsgBox("les fichiers: " & fichier2 & "on bien êtê importer", MsgBoxStyle.Information)
Else
index = 0
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\imges\")
Dim info As New IO.FileInfo(fichier)
ListBox1.Items.Add(info.Name)
Next
Label8.Text = ListBox1.Items.Count
MsgBox("le fichier: " & OpenFileDialog2.SafeFileName & " a bien êtê importer", MsgBoxStyle.Information)
End If
End If
End Sub
Private Sub TextBox4_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox4.KeyPress
Dim desNumero() As Char = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
If Not desNumero.Contains(e.KeyChar) And Not Asc(e.KeyChar) = 8 Then
e.Handled = True
End If
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
If Label8.Text = 0 Then
MsgBox("vous devez d'abort importer des images", MsgBoxStyle.Exclamation)
Else
Form9.ShowDialog()
End If
End Sub
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged, ListBox2.SelectedIndexChanged, ListBox3.SelectedIndexChanged
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If OpenFileDialog3.ShowDialog = 1 Then
ListBox2.Items.Clear()
Dim index As Integer = 0
Dim fichier2 As String = "" & vbNewLine
For Each fileselected1 As String In OpenFileDialog3.FileNames
FileCopy(fileselected1, dostemps & "\addon\" & OpenFileDialog3.SafeFileNames(index))
fichier2 = fichier2 & " " & OpenFileDialog3.SafeFileNames(index) & vbNewLine
index = index + 1
Next
If index > 1 Then
index = 0
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\addon\")
Dim info As New IO.FileInfo(fichier)
ListBox2.Items.Add(info.Name)
Next
Label9.Text = ListBox2.Items.Count
MsgBox("les fichiers: " & fichier2 & "on bien êtê importer", MsgBoxStyle.Information)
Else
index = 0
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\addon\")
Dim info As New IO.FileInfo(fichier)
ListBox2.Items.Add(info.Name)
Next
Label9.Text = ListBox2.Items.Count
MsgBox("le fichier: " & OpenFileDialog3.SafeFileName & " a bien êtê importer", MsgBoxStyle.Information)
End If
End If
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
If Label9.Text = 0 Then
MsgBox("vous devez d'abort importer des addons", MsgBoxStyle.Exclamation)
Else
Form12.ShowDialog()
End If
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
véredosserver()
End Sub
Sub vérification()
If ComboBox4.SelectedItem = "Oui" Then
If TextBox3.Text.Contains("http://") Or TextBox3.Text.Contains("https://") = False Then
MsgBox("merci d'entrer une url valide", MsgBoxStyle.Exclamation)
Exit Sub
Else
If File.Exists(dostemps & "\site.txt") = False Then
Dim sw1 As New StreamWriter(dostemps & "\site.txt")
sw1.WriteLine(1)
sw1.Close()
End If
If File.Exists(dostemps & "\site2.txt") = False Then
Dim sw2 As New StreamWriter(dostemps & "\site2.txt")
sw2.WriteLine(TextBox3.Text)
sw2.Close()
End If
End If
Else
If File.Exists(dostemps & "\site.txt") = False Then
Dim sw1 As New StreamWriter(dostemps & "\site.txt")
sw1.WriteLine(0)
sw1.Close()
End If
End If
If ComboBox5.SelectedItem = "payent" Then
If TextBox4.Text = "" Or TextBox4.Text = "0" Then
MsgBox("merci d'entrer un prix", MsgBoxStyle.Exclamation)
Exit Sub
Else
If File.Exists(dostemps & "\prix.txt") = False Then
Dim sw1 As New StreamWriter(dostemps & "\prix.txt")
sw1.WriteLine(TextBox4.Text)
sw1.Close()
End If
End If
End If
If TextBox1.Text = "" Then
MsgBox("merci d'entrer une Description", MsgBoxStyle.Exclamation)
Exit Sub
Else
Dim sw1 As New StreamWriter(dostemps & "\info.txt")
sw1.WriteLine(TextBox1.Text)
sw1.Close()
Dim sw2 As New StreamWriter(dostemps & "\telechargement.txt")
sw2.WriteLine(TextBox1.Text)
sw2.Close()
vérifimg()
End If
End Sub
Sub vérifimg()
If Label8.Text = "0" Then
Dim sw2 As New StreamWriter(dostemps & "\image.txt")
sw2.WriteLine(0)
sw2.Close()
vérifiaddon()
Else
Dim sw2 As New StreamWriter(dostemps & "\image.txt")
sw2.WriteLine(1)
sw2.Close()
Text = "Mis en ligne de " & TextBox2.Text & " : comprétion de image"
BackgroundWorker1.RunWorkerAsync()
End If
End Sub
Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
IO.Compression.ZipFile.CreateFromDirectory(dostemps & "\imges\", dostemps & "\images.zip")
End Sub
Private Sub BackgroundWorker1_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
Text = "Mis en ligne de " & TextBox2.Text & " : supprétion des image local"
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\imges\")
Dim info As New IO.FileInfo(fichier)
File.Delete(dostemps & "\imges\" & info.Name)
Next
Directory.Delete(dostemps & "\imges\")
vérifiaddon()
End Sub
Sub vérifiaddon()
If Label9.Text = "0" Then
Text = "Mis en ligne de " & TextBox2.Text & " : copy du fichier a envoyer"
MsgBox("opl")
BackgroundWorker3.RunWorkerAsync()
Else
Text = "Mis en ligne de " & TextBox2.Text & " : copy de addon"
BackgroundWorker2.RunWorkerAsync()
End If
End Sub
Private Sub BackgroundWorker2_DoWork(sender As Object, e As DoWorkEventArgs) Handles BackgroundWorker2.DoWork
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\addon\")
Dim info As New IO.FileInfo(fichier)
File.Copy(dostemps & "\addon\" & info.Name, dostemps & "\" & TextBox2.Text & "\" & info.Name)
Next
Text = "Mis en ligne de " & TextBox2.Text & " : supprétion des addon local"
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\addon\")
Dim info As New IO.FileInfo(fichier)
File.Delete(dostemps & "\addon\" & info.Name)
Next
Directory.Delete(dostemps & "\addon\")
End Sub
Private Sub BackgroundWorker2_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BackgroundWorker2.RunWorkerCompleted
BackgroundWorker3.RunWorkerAsync()
End Sub
Private Sub BackgroundWorker3_DoWork(sender As Object, e As DoWorkEventArgs) Handles BackgroundWorker3.DoWork
File.Copy(OpenFileDialog1.FileName, dostemps & "\" & TextBox2.Text & "\" & OpenFileDialog1.SafeFileName.ToString)
End Sub
Private Sub BackgroundWorker3_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BackgroundWorker3.RunWorkerCompleted
Text = "Mis en ligne de " & TextBox2.Text & " : comprétion du fichier a envoyer"
BackgroundWorker4.RunWorkerAsync()
End Sub
Private Sub BackgroundWorker4_DoWork(sender As Object, e As DoWorkEventArgs) Handles BackgroundWorker4.DoWork
IO.Compression.ZipFile.CreateFromDirectory(dostemps & "\" & TextBox2.Text & "\", dostemps & "\" & TextBox2.Text & ".zip")
Text = "Mis en ligne de " & TextBox2.Text & " : supprétion des fichiers temporaire"
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\" & TextBox2.Text & "\")
Dim info As New IO.FileInfo(fichier)
File.Delete(dostemps & "\" & TextBox2.Text & "\" & info.Name)
Next
Directory.Delete(dostemps & "\" & TextBox2.Text & "\")
End Sub
Private Sub BackgroundWorker4_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BackgroundWorker4.RunWorkerCompleted
Text = "Mis en ligne de " & TextBox2.Text & " : création de l'icon"
PictureBox1.Image.Save(dostemps & "\logo.png")
PictureBox1.Image.Dispose()
creatdosserv()
End Sub
Sub creatdosserv()
Text = "Mis en ligne de " & TextBox2.Text & " : création du dossier serveur"
Try
Dim MaRequete As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(urlup & TextBox2.Text & "/"), System.Net.FtpWebRequest)
Dim ftpStream As Stream = Nothing
MaRequete.Credentials = New System.Net.NetworkCredential("extremedownloaders", passftp)
MaRequete.Method = System.Net.WebRequestMethods.Ftp.MakeDirectory
Dim response As FtpWebResponse = CType(MaRequete.GetResponse, FtpWebResponse)
ftpStream = response.GetResponseStream
ftpStream.Close()
response.Close()
creatdosservlike()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Sub creatdosservlike()
Try
Dim MaRequete As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(urlup & TextBox2.Text & "/like/"), System.Net.FtpWebRequest)
Dim ftpStream As Stream = Nothing
MaRequete.Credentials = New System.Net.NetworkCredential("extremedownloaders", passftp)
MaRequete.Method = System.Net.WebRequestMethods.Ftp.MakeDirectory
Dim response As FtpWebResponse = CType(MaRequete.GetResponse, FtpWebResponse)
ftpStream = response.GetResponseStream
ftpStream.Close()
response.Close()
creatdosservachat()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Sub creatdosservachat()
Try
Dim MaRequete As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(urlup & TextBox2.Text & "/achat/"), System.Net.FtpWebRequest)
Dim ftpStream As Stream = Nothing
MaRequete.Credentials = New System.Net.NetworkCredential("extremedownloaders", passftp)
MaRequete.Method = System.Net.WebRequestMethods.Ftp.MakeDirectory
Dim response As FtpWebResponse = CType(MaRequete.GetResponse, FtpWebResponse)
ftpStream = response.GetResponseStream
ftpStream.Close()
response.Close()
filelike()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Sub filelike()
Dim sw1 As New StreamWriter(dostemps & "\like.txt")
sw1.WriteLine(0)
sw1.Close()
For Each fichier As String In IO.Directory.GetFiles(dostemps)
Dim info As New IO.FileInfo(fichier)
ListBox3.Items.Add(info.Name)
Next
startdl()
End Sub
Sub startdl()
Text = "Mis en ligne de " & TextBox2.Text & " : envoie des fichiers: "
ListBox3.SelectedIndex = filedl
Try
téléchargerfr = New WebClient
téléchargerfr.UploadFileTaskAsync(urlup & TextBox2.Text & "/" & ListBox3.SelectedItem, dostemps & "/" & ListBox3.SelectedItem)
Catch ex As Exception
End Try
End Sub
Private Sub téléchargerfr_UploadFileCompleted(sender As Object, e As UploadFileCompletedEventArgs) Handles téléchargerfr.UploadFileCompleted
If filedl = ListBox3.Items.Count - 1 Then
For Each fichier As String In IO.Directory.GetFiles(dostemps)
Dim info As New IO.FileInfo(fichier)
File.Delete(dostemps & "\" & info.Name)
Next
Text = "Mis en ligne de " & TextBox2.Text & " : Terminer"
MsgBox("le fichier: " & TextBox2.Text & " a bien êtê mis en ligne", MsgBoxStyle.Information)
Close()
Else
filedl = filedl + 1
startdl()
End If
End Sub
Private Sub téléchargerfr_UploadProgressChanged(sender As Object, e As UploadProgressChangedEventArgs) Handles téléchargerfr.UploadProgressChanged
Text = "Mis en ligne de " & TextBox2.Text & " : envoie du fichiers: " & filedl.ToString + 1 & "/" & ListBox3.Items.Count & " " & e.ProgressPercentage & "%"
ProgressBar1.Value = e.ProgressPercentage
End Sub
Private Sub Form7_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
If Directory.Exists(dostemps & "\imges\") = True Then
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\imges\")
Dim info As New IO.FileInfo(fichier)
File.Delete(dostemps & "\imges\" & info.Name)
Next
Directory.Delete(dostemps & "\imges\")
End If
If Directory.Exists(dostemps & "\addon\") Then
For Each fichier As String In IO.Directory.GetFiles(dostemps & "\addon\")
Dim info As New IO.FileInfo(fichier)
File.Delete(dostemps & "\addon\" & info.Name)
Next
Directory.Delete(dostemps & "\addon\")
End If
If Directory.Exists(dostemps & "\" & TextBox2.Text & "\") = True Then
Directory.Delete(dostemps & "\" & TextBox2.Text & "\")
End If
urlup = ""
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = "https://"
TextBox4.Text = ""
OpenFileDialog1.FileName = ""
OpenFileDialog2.FileName = ""
OpenFileDialog3.FileName = ""
ListBox1.Items.Clear()
ListBox2.Items.Clear()
ListBox3.Items.Clear()
Label9.Text = 0
Label8.Text = 0
End Sub
Dim WithEvents téléchargerfr As WebClient
Sub véredosserver()
If ComboBox1.SelectedItem = "logiciels" Then
urlup = ipserver & "téléchargeur/logiciels/"
ElseIf ComboBox1.SelectedItem = "jeux" Then
If ComboBox2.SelectedItem = "Tout les jeux" Then
urlup = ipserver & "téléchargeur/jeux/Tout les jeux/"
Else
If ComboBox6.SelectedItem = "serveur" Then
urlup = ipserver & "téléchargeur/jeux/Minecraft/serveur/" & ComboBox3.SelectedItem & "/"
ElseIf ComboBox6.SelectedItem = "plugin" Then
urlup = ipserver & "téléchargeur/jeux/Minecraft/plugin/" & ComboBox3.SelectedItem & "/"
ElseIf ComboBox6.SelectedItem = "mod" Then
urlup = ipserver & "téléchargeur/jeux/Minecraft/mod/" & ComboBox3.SelectedItem & "/"
ElseIf ComboBox6.SelectedItem = "map" Then
urlup = ipserver & "téléchargeur/jeux/Minecraft/map/" & ComboBox3.SelectedItem & "/"
Else
urlup = ipserver & "téléchargeur/jeux/Minecraft/Launcher/"
End If
End If
ElseIf ComboBox1.SelectedItem = "ISO" Then
If ComboBox2.SelectedItem = "Windows" Then
urlup = ipserver & "téléchargeur/ISO/Windows/"
ElseIf ComboBox2.SelectedItem = "Linux" Then
urlup = ipserver & "téléchargeur/ISO/Linux/"
Else
urlup = ipserver & "téléchargeur/ISO/Autre/"
End If
End If
Try
Directory.CreateDirectory(dostemps & "/tmp/")
Dim fwr As FtpWebRequest
fwr = FtpWebRequest.Create(urlup)
fwr.Credentials = New NetworkCredential("extremedownloaders", 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
Directory.CreateDirectory(dostemps & "/tmp/" & str)
str = sr.ReadLine()
End While
sr.Close()
If Directory.Exists(dostemps & "/tmp/" & TextBox2.Text) = True Then
MsgBox("Le fichier: " & TextBox2.Text & " exister déja", MsgBoxStyle.Critical)
For Each fichier As String In IO.Directory.GetDirectories(dostemps & "/tmp/")
Dim info As New IO.FileInfo(fichier)
Directory.Delete(dostemps & "/tmp/" & info.Name)
Next
Directory.Delete(dostemps & "/tmp/")
Exit Sub
Else
For Each fichier As String In IO.Directory.GetDirectories(dostemps & "/tmp/")
Dim info As New IO.FileInfo(fichier)
Directory.Delete(dostemps & "/tmp/" & info.Name)
Next
Directory.Delete(dostemps & "/tmp/")
If TextBox2.Text.Contains(".") Then
MsgBox("le nom de doit pas conntenir de . ou d'extrention", MsgBoxStyle.Exclamation)
Exit Sub
Else
Try
Directory.CreateDirectory(dostemps & "\" & TextBox2.Text & "\")
vérification()
Catch ex As Exception
MsgBox(ex.ToString, MsgBoxStyle.Exclamation)
End Try
End If
End If
Catch ex As Exception
End Try
End Sub
End Class