251 lines
12 KiB
VB.net
251 lines
12 KiB
VB.net
Imports System.IO
|
|
Imports System.Net
|
|
|
|
Public Class Form191
|
|
|
|
Private Sub Form191_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Dim lines1a() As String = File.ReadAllLines(théme)
|
|
|
|
If lines1a(0) = 2 Then
|
|
Me.BackColor = Color.FromArgb(64, 64, 64)
|
|
Label1.BackColor = Color.FromArgb(64, 64, 64)
|
|
Label2.BackColor = Color.FromArgb(64, 64, 64)
|
|
Label3.BackColor = Color.FromArgb(64, 64, 64)
|
|
Label4.BackColor = Color.FromArgb(64, 64, 64)
|
|
ListBox1.BackColor = Color.FromArgb(64, 64, 64)
|
|
ComboBox1.BackColor = Color.FromArgb(64, 64, 64)
|
|
Button1.BackColor = Color.FromArgb(64, 64, 64)
|
|
Label1.ForeColor = Color.White
|
|
Label2.ForeColor = Color.White
|
|
Label3.ForeColor = Color.White
|
|
Label4.ForeColor = Color.White
|
|
ListBox1.ForeColor = Color.White
|
|
ComboBox1.ForeColor = Color.White
|
|
Button1.ForeColor = Color.White
|
|
ElseIf lines1a(0) = 3 Then
|
|
Me.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Label1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Label2.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Label3.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Label4.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
ListBox1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
ComboBox1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Button1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Label1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Label2.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Label3.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Label4.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
ListBox1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
ComboBox1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Button1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Else
|
|
|
|
End If
|
|
|
|
|
|
|
|
ListBox1.Items.Clear()
|
|
Label4.Text = Form192.ComboBox1.SelectedItem
|
|
For Each fichier As String In IO.Directory.GetFiles(dosplaylist & "/" & Label4.Text)
|
|
Dim info As New IO.DirectoryInfo(fichier)
|
|
ListBox1.Items.Add(info.Name)
|
|
Next
|
|
ComboBox1.SelectedItem = "autre"
|
|
Button1.Text = "Mettre en ligne: " & Label4.Text
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
Try
|
|
Dim fwr As FtpWebRequest
|
|
fwr = FtpWebRequest.Create(ipserver & "/playlist/" & ComboBox1.SelectedItem & "/")
|
|
fwr.Credentials = New NetworkCredential("yoannsafe", 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(cozip & str)
|
|
|
|
|
|
str = sr.ReadLine()
|
|
|
|
End While
|
|
|
|
sr.Close()
|
|
|
|
If Directory.Exists(cozip & Label4.Text) = True Then
|
|
For Each fichier As String In IO.Directory.GetDirectories(cozip)
|
|
Dim info As New IO.FileInfo(fichier)
|
|
Directory.Delete(cozip & info.Name)
|
|
Next
|
|
MsgBox("La playlist: " & Label4.Text & " existe déjà dans la catégorie: " & ComboBox1.SelectedItem, MsgBoxStyle.Critical)
|
|
Else
|
|
For Each fichier As String In IO.Directory.GetDirectories(cozip)
|
|
Dim info As New IO.FileInfo(fichier)
|
|
Directory.Delete(cozip & info.Name)
|
|
Next
|
|
playlistnom = Label4.Text
|
|
upplaylist()
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
For Each fichier As String In IO.Directory.GetDirectories(cozip)
|
|
Dim info As New IO.FileInfo(fichier)
|
|
Directory.Delete(cozip & info.Name)
|
|
Next
|
|
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 & "/playlist/" & ComboBox1.SelectedItem & "/")
|
|
fwr.Credentials = New NetworkCredential("yoannsafe", 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(cozip & str)
|
|
|
|
|
|
str = sr.ReadLine()
|
|
|
|
End While
|
|
|
|
sr.Close()
|
|
|
|
If Directory.Exists(cozip & Label4.Text) = True Then
|
|
For Each fichier As String In IO.Directory.GetDirectories(cozip)
|
|
Dim info As New IO.FileInfo(fichier)
|
|
Directory.Delete(cozip & info.Name)
|
|
Next
|
|
MsgBox("La playlist: " & Label4.Text & " existe déjà dans la catégorie: " & ComboBox1.SelectedItem, MsgBoxStyle.Critical)
|
|
Else
|
|
For Each fichier As String In IO.Directory.GetDirectories(cozip)
|
|
Dim info As New IO.FileInfo(fichier)
|
|
Directory.Delete(cozip & info.Name)
|
|
Next
|
|
playlistnom = Label4.Text
|
|
upplaylist()
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
For Each fichier As String In IO.Directory.GetDirectories(cozip)
|
|
Dim info As New IO.FileInfo(fichier)
|
|
Directory.Delete(cozip & info.Name)
|
|
Next
|
|
Timer1.Start()
|
|
End Try
|
|
End Sub
|
|
Sub upplaylist()
|
|
Dim sw1 As New StreamWriter(dosplaylist & "\musique.txt")
|
|
For Each item In ListBox1.Items
|
|
sw1.WriteLine(item)
|
|
Next
|
|
sw1.Close()
|
|
Dim lines4() As String = File.ReadAllLines(compteco)
|
|
Dim sw2 As New StreamWriter(dosplaylist & "\info.txt")
|
|
sw2.WriteLine(lines4(0))
|
|
sw2.Close()
|
|
Dim sw3 As New StreamWriter(dosplaylist & "\info2.txt")
|
|
sw3.WriteLine("Mis en ligne depuis le pc: " & My.Computer.Name)
|
|
sw3.WriteLine("")
|
|
sw3.WriteLine("Mis en ligne le: " & Today.Day & "/" & Today.Month & "/" & Today.Year & " a " & TimeOfDay.Hour & ":" & TimeOfDay.Minute)
|
|
sw3.Close()
|
|
Dim sw4 As New StreamWriter(dosplaylist & "\cheminplaylist.txt")
|
|
sw4.WriteLine(ipserver & "playlist/" & ComboBox1.SelectedItem & "/" & Label4.Text & "/")
|
|
sw4.Close()
|
|
Dim sw5 As New StreamWriter(dosplaylist & "\info3.txt")
|
|
sw5.WriteLine(ipserver & "playlist/" & ComboBox1.SelectedItem & "/" & Label4.Text & "/" & Label4.Text & ".zip")
|
|
sw5.Close()
|
|
Dim sw6 As New StreamWriter(dosplaylist & "\info4.txt")
|
|
sw6.WriteLine(ipserver & "playlist/" & ComboBox1.SelectedItem & "/" & Label4.Text & "/info.txt")
|
|
sw6.Close()
|
|
Dim sw7 As New StreamWriter(dosplaylist & "\info5.txt")
|
|
sw7.WriteLine(ipserver & "playlist/" & ComboBox1.SelectedItem & "/" & Label4.Text & "/musique.txt")
|
|
sw7.Close()
|
|
upplaylist3()
|
|
End Sub
|
|
Sub upplaylist2()
|
|
Try
|
|
Dim MaRequete As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(ipserver & "/playlist/" & ComboBox1.SelectedItem & "/" & Label4.Text), System.Net.FtpWebRequest)
|
|
Dim ftpStream As Stream = Nothing
|
|
|
|
MaRequete.Credentials = New System.Net.NetworkCredential("yoannsafe", passftp)
|
|
MaRequete.Method = System.Net.WebRequestMethods.Ftp.MakeDirectory
|
|
|
|
Dim response As FtpWebResponse = CType(MaRequete.GetResponse, FtpWebResponse)
|
|
ftpStream = response.GetResponseStream
|
|
ftpStream.Close()
|
|
response.Close()
|
|
|
|
Form193.ShowDialog()
|
|
Catch ex As Exception
|
|
Timer2.Start()
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
|
|
Timer2.Stop()
|
|
Try
|
|
Dim MaRequete As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(ipserver & "/playlist/" & ComboBox1.SelectedItem & "/" & Label4.Text), System.Net.FtpWebRequest)
|
|
Dim ftpStream As Stream = Nothing
|
|
|
|
MaRequete.Credentials = New System.Net.NetworkCredential("yoannsafe", passftp)
|
|
MaRequete.Method = System.Net.WebRequestMethods.Ftp.MakeDirectory
|
|
|
|
Dim response As FtpWebResponse = CType(MaRequete.GetResponse, FtpWebResponse)
|
|
ftpStream = response.GetResponseStream
|
|
ftpStream.Close()
|
|
response.Close()
|
|
|
|
Form193.ShowDialog()
|
|
|
|
Catch ex As Exception
|
|
Timer2.Start()
|
|
End Try
|
|
End Sub
|
|
Sub upplaylist3()
|
|
Try
|
|
Dim lines4() As String = File.ReadAllLines(compteco)
|
|
Dim MaRequete As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(ipserver & "/utilisateur/" & lines4(0) & "/playlist/" & Label4.Text & " - catégorie - " & ComboBox1.SelectedItem & "/"), System.Net.FtpWebRequest)
|
|
Dim ftpStream As Stream = Nothing
|
|
|
|
MaRequete.Credentials = New System.Net.NetworkCredential("yoannsafe", passftp)
|
|
MaRequete.Method = System.Net.WebRequestMethods.Ftp.MakeDirectory
|
|
|
|
Dim response As FtpWebResponse = CType(MaRequete.GetResponse, FtpWebResponse)
|
|
ftpStream = response.GetResponseStream
|
|
ftpStream.Close()
|
|
response.Close()
|
|
upplaylist2()
|
|
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 lines4() As String = File.ReadAllLines(compteco)
|
|
Dim MaRequete As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(ipserver & "/utilisateur/" & lines4(0) & "/playlist/" & Label4.Text & " - catégorie - " & ComboBox1.SelectedItem & "/"), System.Net.FtpWebRequest)
|
|
Dim ftpStream As Stream = Nothing
|
|
|
|
MaRequete.Credentials = New System.Net.NetworkCredential("yoannsafe", passftp)
|
|
MaRequete.Method = System.Net.WebRequestMethods.Ftp.MakeDirectory
|
|
|
|
Dim response As FtpWebResponse = CType(MaRequete.GetResponse, FtpWebResponse)
|
|
ftpStream = response.GetResponseStream
|
|
ftpStream.Close()
|
|
response.Close()
|
|
upplaylist2()
|
|
Catch ex As Exception
|
|
Timer3.Start()
|
|
End Try
|
|
End Sub
|
|
End Class |