Files
Lecteur-media/lecteur/lecteur média/drive9.vb
T
2026-06-18 14:15:48 +02:00

312 lines
19 KiB
VB.net

Imports System.ComponentModel
Imports System.IO
Imports System.Net
Public Class drive9
Public fonction As Integer = 0
Dim plmextention As String = ""
Private Sub drive9_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)
Me.ForeColor = Color.White
ComboBox1.BackColor = BackColor
Button1.BackColor = BackColor
ComboBox1.ForeColor = ForeColor
TextBox1.BackColor = BackColor
TextBox1.ForeColor = ForeColor
ElseIf lines1a(0) = 3 Then
Me.BackColor = Form1.BackColor
Me.ForeColor = Form1.ForeColor
ComboBox1.BackColor = BackColor
Button1.BackColor = BackColor
ComboBox1.ForeColor = ForeColor
TextBox1.BackColor = BackColor
TextBox1.ForeColor = ForeColor
End If
If fonction = 0 Then
TextBox1.Hide()
Label1.Show()
ComboBox1.Show()
Try
Dim fwr As FtpWebRequest
fwr = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/Dirve/")
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
If str.Contains(".") = True Then
Else
ComboBox1.Items.Add(str)
End If
str = sr.ReadLine()
End While
sr.Close()
ComboBox1.Items.Add("racine")
ComboBox1.SelectedIndex = 0
Catch ex As Exception
End Try
ElseIf fonction = 1 Then
If Drive.ListBox1.SelectedItem.ToString.EndsWith(".mp4") = True Then
TextBox1.Text = Drive.ListBox1.SelectedItem.ToString.Replace(".mp4", "")
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".mkv") = True Then
TextBox1.Text = Drive.ListBox1.SelectedItem.ToString.Replace(".mkv", "")
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".ts") = True Then
TextBox1.Text = Drive.ListBox1.SelectedItem.ToString.Replace(".ts", "")
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".avi") = True Then
TextBox1.Text = Drive.ListBox1.SelectedItem.ToString.Replace(".avi", "")
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".mov") = True Then
TextBox1.Text = Drive.ListBox1.SelectedItem.ToString.Replace(".mov", "")
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".wmv") = True Then
TextBox1.Text = Drive.ListBox1.SelectedItem.ToString.Replace(".wmv", "")
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".mp3") = True Then
TextBox1.Text = Drive.ListBox1.SelectedItem.ToString.Replace(".mp3", "")
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".zip") = True Then
TextBox1.Text = Drive.ListBox1.SelectedItem.ToString.Replace(".zip", "")
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".plm") = True Then
TextBox1.Text = Drive.ListBox1.SelectedItem.ToString.Replace(".plm", "")
If TextBox1.Text.EndsWith(".mp4") = True Then
Dim tete As String = TextBox1.Text.ToString.Replace(".mp4", "")
TextBox1.Text = tete
plmextention = ".mp4"
ElseIf TextBox1.Text.EndsWith(".mkv") = True Then
Dim tete As String = TextBox1.Text.ToString.Replace(".mkv", "")
TextBox1.Text = tete
plmextention = ".mkv"
ElseIf TextBox1.Text.EndsWith(".ts") = True Then
Dim tete As String = TextBox1.Text.ToString.Replace(".ts", "")
TextBox1.Text = tete
plmextention = ".ts"
ElseIf TextBox1.Text.EndsWith(".avi") = True Then
Dim tete As String = TextBox1.Text.ToString.Replace(".avi", "")
TextBox1.Text = tete
plmextention = ".avi"
ElseIf TextBox1.Text.EndsWith(".mov") = True Then
Dim tete As String = TextBox1.Text.ToString.Replace(".mov", "")
TextBox1.Text = tete
plmextention = ".mov"
ElseIf TextBox1.Text.EndsWith(".wmv") = True Then
Dim tete As String = TextBox1.Text.ToString.Replace(".wmv", "")
TextBox1.Text = tete
plmextention = ".wmv"
ElseIf TextBox1.Text.EndsWith(".mp3") = True Then
Dim tete As String = TextBox1.Text.ToString.Replace(".mp3", "")
TextBox1.Text = tete
plmextention = ".mp3"
ElseIf TextBox1.Text.EndsWith(".zip") = True Then
Dim tete As String = TextBox1.Text.ToString.Replace(".zip", "")
TextBox1.Text = tete
plmextention = ".zip"
End If
End If
Label1.Hide()
ComboBox1.Hide()
TextBox1.Show()
Me.Text = "Renommer " & Drive.ListBox1.SelectedItem
Button1.Text = "Renommer"
ElseIf fonction = 2 Then
Label1.Hide()
ComboBox1.Hide()
TextBox1.Show()
Me.Text = "Renommer " & Drive.ListBox1.SelectedItem
Button1.Text = "Renommer"
TextBox1.Text = Drive.ListBox1.SelectedItem.ToString
End If
End Sub
Private Sub ComboBox1_SelectedValueChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedValueChanged
If fonction = 0 Then
Label1.Text = "déplacer ver:"
Me.Text = "déplacer ver: " & ComboBox1.SelectedItem
Button1.Text = "déplcaer ver: " & ComboBox1.SelectedItem
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If fonction = 0 Then
If Drive.TextBox1.Text = "" Then
If ComboBox1.SelectedItem = "racine" Then
If Drive.ListBox1.SelectedItem.ToString.EndsWith(".plm") Then
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.ListBox1.SelectedItem.ToString.Replace(".plm", ".txt"))
ftreq.Method = WebRequestMethods.Ftp.Rename
ftreq.RenameTo = "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.ListBox1.SelectedItem.ToString.Replace(".plm", ".txt")
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
MsgBox("Le fichier: " & Drive.ListBox1.SelectedItem & " est maintenant disponible dans " & ComboBox1.SelectedItem, MsgBoxStyle.Information)
Drive.ftp()
Close()
Else
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.ListBox1.SelectedItem)
ftreq.Method = WebRequestMethods.Ftp.Rename
ftreq.RenameTo = "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.ListBox1.SelectedItem
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
MsgBox("Le fichier: " & Drive.ListBox1.SelectedItem & " est maintenant disponible dans " & ComboBox1.SelectedItem, MsgBoxStyle.Information)
Drive.ftp()
Close()
End If
Else
If Drive.ListBox1.SelectedItem.ToString.EndsWith(".plm") Then
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.ListBox1.SelectedItem.ToString.Replace(".plm", ".txt"))
ftreq.Method = WebRequestMethods.Ftp.Rename
ftreq.RenameTo = "/Utilisateur/" & Drive.tcon & "/dirve/" & ComboBox1.SelectedItem & "/" & Drive.ListBox1.SelectedItem.ToString.Replace(".plm", ".txt")
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
MsgBox("Le fichier: " & Drive.ListBox1.SelectedItem & " est maintenant disponible dans " & ComboBox1.SelectedItem, MsgBoxStyle.Information)
Drive.ftp()
Close()
Else
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.ListBox1.SelectedItem)
ftreq.Method = WebRequestMethods.Ftp.Rename
ftreq.RenameTo = "/Utilisateur/" & Drive.tcon & "/dirve/" & ComboBox1.SelectedItem & "/" & Drive.ListBox1.SelectedItem
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
MsgBox("Le fichier: " & Drive.ListBox1.SelectedItem & " est maintenant disponible dans " & ComboBox1.SelectedItem, MsgBoxStyle.Information)
Drive.ftp()
Close()
End If
End If
Else
If ComboBox1.SelectedItem = "racine" Then
If Drive.ListBox1.SelectedItem.ToString.EndsWith(".plm") Then
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.TextBox1.Text & "/" & Drive.ListBox1.SelectedItem.ToString.Replace(".plm", ".txt"))
ftreq.Method = WebRequestMethods.Ftp.Rename
ftreq.RenameTo = "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.ListBox1.SelectedItem.ToString.Replace(".plm", ".txt")
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
MsgBox("Le fichier: " & Drive.ListBox1.SelectedItem & " est maintenant disponible dans " & ComboBox1.SelectedItem, MsgBoxStyle.Information)
Drive.ftp()
Close()
Else
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.TextBox1.Text & "/" & Drive.ListBox1.SelectedItem)
ftreq.Method = WebRequestMethods.Ftp.Rename
ftreq.RenameTo = "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.ListBox1.SelectedItem
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
MsgBox("Le fichier: " & Drive.ListBox1.SelectedItem & " est maintenant disponible dans " & ComboBox1.SelectedItem, MsgBoxStyle.Information)
Drive.ftp()
Close()
End If
Else
If Drive.ListBox1.SelectedItem.ToString.EndsWith(".plm") Then
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.TextBox1.Text & "/" & Drive.ListBox1.SelectedItem.ToString.Replace(".plm", ".txt"))
ftreq.Method = WebRequestMethods.Ftp.Rename
ftreq.RenameTo = "/Utilisateur/" & Drive.tcon & "/dirve/" & ComboBox1.SelectedItem & "/" & Drive.ListBox1.SelectedItem.ToString.Replace(".plm", ".txt")
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
MsgBox("Le fichier: " & Drive.ListBox1.SelectedItem & " est maintenant disponible dans " & ComboBox1.SelectedItem, MsgBoxStyle.Information)
Drive.ftp()
Close()
Else
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.TextBox1.Text & "/" & Drive.ListBox1.SelectedItem)
ftreq.Method = WebRequestMethods.Ftp.Rename
ftreq.RenameTo = "/Utilisateur/" & Drive.tcon & "/dirve/" & ComboBox1.SelectedItem & "/" & Drive.ListBox1.SelectedItem
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
MsgBox("Le fichier: " & Drive.ListBox1.SelectedItem & " est maintenant disponible dans " & ComboBox1.SelectedItem, MsgBoxStyle.Information)
Drive.ftp()
Close()
End If
End If
End If
ElseIf fonction = 1 Then
Dim extension As String = ""
If Drive.ListBox1.SelectedItem.ToString.EndsWith(".mp4") = True Then
extension = ".mp4"
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".mkv") = True Then
extension = ".mkv"
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".ts") = True Then
extension = ".ts"
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".avi") = True Then
extension = ".avi"
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".mov") = True Then
extension = ".mov"
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".wmv") = True Then
extension = ".wmv"
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".mp3") = True Then
extension = ".mp3"
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".zip") = True Then
extension = ".zip"
ElseIf Drive.ListBox1.SelectedItem.ToString.EndsWith(".plm") = True Then
extension = ".plm"
End If
If extension = ".plm" Then
If Drive.TextBox1.Text = "" Then
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.ListBox1.SelectedItem.ToString.Replace(".plm", ".txt"))
ftreq.Method = WebRequestMethods.Ftp.Rename
ftreq.RenameTo = "/Utilisateur/" & Drive.tcon & "/dirve/" & TextBox1.Text & plmextention & ".txt"
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
MsgBox("Le fichier: " & Drive.ListBox1.SelectedItem & " a bien êtê renommer en: " & TextBox1.Text, MsgBoxStyle.Information)
TextBox1.Clear()
Drive.ftp()
Close()
Else
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.TextBox1.Text & "/" & Drive.ListBox1.SelectedItem.ToString.Replace(".plm", ".txt"))
ftreq.Method = WebRequestMethods.Ftp.Rename
ftreq.RenameTo = "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.TextBox1.Text & "/" & TextBox1.Text & plmextention & ".txt"
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
MsgBox("Le fichier: " & Drive.ListBox1.SelectedItem & " a bien êtê renommer en: " & TextBox1.Text, MsgBoxStyle.Information)
TextBox1.Clear()
Drive.ftp()
Close()
End If
Else
If Drive.TextBox1.Text = "" Then
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.ListBox1.SelectedItem)
ftreq.Method = WebRequestMethods.Ftp.Rename
ftreq.RenameTo = "/Utilisateur/" & Drive.tcon & "/dirve/" & TextBox1.Text & extension
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
MsgBox("Le fichier: " & Drive.ListBox1.SelectedItem & " a bien êtê renommer en: " & TextBox1.Text, MsgBoxStyle.Information)
TextBox1.Clear()
Drive.ftp()
Close()
Else
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.TextBox1.Text & "/" & Drive.ListBox1.SelectedItem)
ftreq.Method = WebRequestMethods.Ftp.Rename
ftreq.RenameTo = "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.TextBox1.Text & "/" & TextBox1.Text & extension
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
MsgBox("Le fichier: " & Drive.ListBox1.SelectedItem & " a bien êtê renommer en: " & TextBox1.Text, MsgBoxStyle.Information)
TextBox1.Clear()
Drive.ftp()
Close()
End If
End If
ElseIf fonction = 2 Then
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Drive.tcon & "/dirve/" & Drive.ListBox1.SelectedItem)
ftreq.Method = WebRequestMethods.Ftp.Rename
ftreq.RenameTo = "/Utilisateur/" & Drive.tcon & "/dirve/" & TextBox1.Text
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
MsgBox("Le dossier: " & Drive.ListBox1.SelectedItem & " a bien êtê renommer en: " & TextBox1.Text, MsgBoxStyle.Information)
TextBox1.Clear()
Drive.ftp()
Close()
End If
End Sub
Private Sub drive9_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
TextBox1.Clear()
ComboBox1.Items.Clear()
fonction = 0
End Sub
End Class