first commit
This commit is contained in:
@@ -0,0 +1,194 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports System.Net
|
||||
|
||||
Public Class Form35
|
||||
Dim dl As Integer = 0
|
||||
Private Sub Form35_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
Text = "ajoutter a une liste"
|
||||
ComboBox1.Items.Clear()
|
||||
Try
|
||||
Dim fwr As FtpWebRequest
|
||||
fwr = FtpWebRequest.Create(ipserver & "utilisateur/" & nomutilisateur & "/liste/")
|
||||
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
|
||||
ComboBox1.Items.Add(str)
|
||||
|
||||
str = sr.ReadLine()
|
||||
|
||||
End While
|
||||
sr.Close()
|
||||
|
||||
If ComboBox1.Items.Count = 0 Then
|
||||
MsgBox("aucune liste trouvez", MsgBoxStyle.Critical)
|
||||
Close()
|
||||
Else
|
||||
ComboBox1.SelectedIndex = 0
|
||||
End If
|
||||
|
||||
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
|
||||
Dim fwr As FtpWebRequest
|
||||
fwr = FtpWebRequest.Create(ipserver & "utilisateur/" & nomutilisateur & "/liste/")
|
||||
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
|
||||
ComboBox1.Items.Add(str)
|
||||
|
||||
str = sr.ReadLine()
|
||||
|
||||
End While
|
||||
sr.Close()
|
||||
|
||||
If ComboBox1.Items.Count = 0 Then
|
||||
MsgBox("aucune liste trouvez", MsgBoxStyle.Critical)
|
||||
Close()
|
||||
Else
|
||||
ComboBox1.SelectedIndex = 0
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Timer1.Start()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
Try
|
||||
ListBox1.Items.Clear()
|
||||
Dim fwr As FtpWebRequest
|
||||
fwr = FtpWebRequest.Create(ipserver & "utilisateur/" & nomutilisateur & "/liste/" & ComboBox1.SelectedItem & "/")
|
||||
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 & str)
|
||||
|
||||
|
||||
str = sr.ReadLine()
|
||||
|
||||
End While
|
||||
sr.Close()
|
||||
|
||||
If Directory.Exists(dostemps & Form32.Text) = True Then
|
||||
For Each fichier As String In IO.Directory.GetDirectories(dostemps)
|
||||
Dim info As New IO.FileInfo(fichier)
|
||||
Directory.Delete(dostemps & info.Name)
|
||||
Next
|
||||
MsgBox("Le fichier: " & Form32.Text & " est dêja présent dans la liste: " & ComboBox1.SelectedItem, MsgBoxStyle.Exclamation)
|
||||
Close()
|
||||
Else
|
||||
For Each fichier As String In IO.Directory.GetDirectories(dostemps)
|
||||
Dim info As New IO.FileInfo(fichier)
|
||||
Directory.Delete(dostemps & info.Name)
|
||||
Next
|
||||
creafidos()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Timer2.Start()
|
||||
End Try
|
||||
End Sub
|
||||
Sub dlfichier()
|
||||
Dim sw1 As New StreamWriter(dostemps & "\download.txt")
|
||||
sw1.WriteLine(Form32.urldl & "/" & Form32.Text & ".zip")
|
||||
sw1.Close()
|
||||
My.Computer.Network.UploadFile(dostemps & "\download.txt", ipserver & "utilisateur/" & nomutilisateur & "/liste/" & ComboBox1.SelectedItem & "/" & Form32.Text & "/download.txt")
|
||||
File.Delete(dostemps & "\download.txt")
|
||||
MsgBox(Form32.Text & " a bien êtê ajoutter a la liste: " & ComboBox1.SelectedItem, MsgBoxStyle.Information)
|
||||
Close()
|
||||
End Sub
|
||||
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
|
||||
Timer2.Stop()
|
||||
Try
|
||||
ListBox1.Items.Clear()
|
||||
Dim fwr As FtpWebRequest
|
||||
fwr = FtpWebRequest.Create(ipserver & "utilisateur/" & nomutilisateur & "/liste/" & ComboBox1.SelectedItem & "/")
|
||||
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 & str)
|
||||
|
||||
|
||||
str = sr.ReadLine()
|
||||
|
||||
End While
|
||||
sr.Close()
|
||||
|
||||
If Directory.Exists(dostemps & Form32.Text) = True Then
|
||||
For Each fichier As String In IO.Directory.GetDirectories(dostemps)
|
||||
Dim info As New IO.FileInfo(fichier)
|
||||
Directory.Delete(dostemps & info.Name)
|
||||
Next
|
||||
MsgBox("Le fichier: " & Form32.Text & " est dêja présent dans la liste: " & ComboBox1.SelectedItem, MsgBoxStyle.Exclamation)
|
||||
Close()
|
||||
Else
|
||||
For Each fichier As String In IO.Directory.GetDirectories(dostemps)
|
||||
Dim info As New IO.FileInfo(fichier)
|
||||
Directory.Delete(dostemps & info.Name)
|
||||
Next
|
||||
creafidos()
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Timer2.Start()
|
||||
End Try
|
||||
End Sub
|
||||
Sub creafidos()
|
||||
Try
|
||||
Dim MaRequete As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(ipserver & "/utilisateur/" & nomutilisateur & "/liste/" & ComboBox1.SelectedItem & "/" & Form32.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()
|
||||
dlfichier()
|
||||
Catch ex As Exception
|
||||
Timer3.Start()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
|
||||
Timer3.Stop()
|
||||
Try
|
||||
Dim MaRequete As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(ipserver & "/utilisateur/" & nomutilisateur & "/liste/" & ComboBox1.SelectedItem & "/" & Form32.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()
|
||||
dlfichier()
|
||||
Catch ex As Exception
|
||||
Timer3.Start()
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub ComboBox1_SelectedValueChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedValueChanged
|
||||
Button1.Text = "ajoutter a: " & ComboBox1.SelectedItem
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user