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

307 lines
15 KiB
VB.net

Imports System.IO
Public Class favoris
Private Sub favoris_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)
Button1.BackColor = Color.FromArgb(64, 64, 64)
Button1.ForeColor = Color.White
Button2.BackColor = Color.FromArgb(64, 64, 64)
Button2.ForeColor = Color.White
Button3.BackColor = Color.FromArgb(64, 64, 64)
Button3.ForeColor = Color.White
Button4.BackColor = Color.FromArgb(64, 64, 64)
Button4.ForeColor = Color.White
ListBox1.BackColor = Color.FromArgb(64, 64, 64)
ListBox1.ForeColor = Color.White
ContextMenuStrip1.BackColor = Color.FromArgb(64, 64, 64)
LireToolStripMenuItem.BackColor = Color.FromArgb(64, 64, 64)
LireToolStripMenuItem.ForeColor = Color.White
SupprimerToolStripMenuItem.BackColor = Color.FromArgb(64, 64, 64)
SupprimerToolStripMenuItem.ForeColor = Color.White
ToutSupprimerToolStripMenuItem.BackColor = Color.FromArgb(64, 64, 64)
ToutSupprimerToolStripMenuItem.ForeColor = Color.White
ElseIf lines1a(0) = 3 Then
Me.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
Button1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
Button1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
Button2.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
Button2.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
Button3.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
Button3.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
Button4.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
Button4.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
ListBox1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
ListBox1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
ContextMenuStrip1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
LireToolStripMenuItem.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
LireToolStripMenuItem.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
SupprimerToolStripMenuItem.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
SupprimerToolStripMenuItem.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
ToutSupprimerToolStripMenuItem.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
ToutSupprimerToolStripMenuItem.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
End If
TextBox1.Hide()
For Each fichier As String In IO.Directory.GetDirectories(Favoris1)
Dim info As New IO.FileInfo(fichier)
ListBox1.Items.Add(info.Name)
Next
Button1.Enabled = False
Button2.Enabled = False
End Sub
Private Sub favoris_Closed(sender As Object, e As EventArgs) Handles Me.Closed
ListBox1.Items.Clear()
Form1.Enabled = True
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If ListBox1.SelectedItem = "" Then
MsgBox("Merci de sélectionner un favori", MsgBoxStyle.Exclamation)
Else
Form1.AxWindowsMediaPlayer1.Ctlcontrols.stop()
Form1.AxWindowsMediaPlayer1.currentPlaylist.clear()
ListBox1.ContextMenuStrip.Enabled = False
Button1.Enabled = False
Button2.Enabled = False
Button4.Enabled = False
Dim lines3() As String = File.ReadAllLines(notification)
If lines3(0) = 0 Then
nonotif()
ElseIf lines3(0) = 1 Then
lang()
End If
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If ListBox1.SelectedItem = "" Then
MsgBox("Merci de sélectionner un favori", MsgBoxStyle.Exclamation)
Else
ListBox1.ContextMenuStrip.Enabled = False
If ListBox1.Items.Count = 0 Then
MsgBox("Aucun Favori a été trouvez", MsgBoxStyle.Exclamation)
Else
Dim t1 = ListBox1.SelectedItem
Dim t2 = Favoris1 & t1 & "\flux.txt"
Dim t3 = Favoris1 & t1
File.Delete(t2)
Directory.Delete(t3)
MsgBox("Le Favori: " & ListBox1.SelectedItem & " a bien été supprimer", MsgBoxStyle.Information)
ListBox1.Items.Clear()
For Each fichier As String In IO.Directory.GetDirectories(Favoris1)
Dim info As New IO.FileInfo(fichier)
ListBox1.Items.Add(info.Name)
Next
End If
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If ListBox1.Items.Count = 0 Then
MsgBox("Aucun Favori a été trouvez", MsgBoxStyle.Exclamation)
Else
Dim t1 = ListBox1.SelectedItem
Dim t2 = Favoris1 & t1 & "\flux.txt"
Dim t3 = Favoris1 & t1
File.Delete(t2)
Directory.Delete(t3)
MsgBox("Le Favori: " & ListBox1.SelectedItem & " a bien été supprimer", MsgBoxStyle.Information)
ListBox1.Items.Clear()
For Each fichier As String In IO.Directory.GetDirectories(Favoris1)
Dim info As New IO.FileInfo(fichier)
ListBox1.Items.Add(info.Name)
Next
End If
End Sub
Private Sub LireToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LireToolStripMenuItem.Click
If ListBox1.SelectedItem = "" Then
MsgBox("Merci de sélectionner un favori", MsgBoxStyle.Exclamation)
Else
Form1.AxWindowsMediaPlayer1.Ctlcontrols.stop()
Form1.AxWindowsMediaPlayer1.currentPlaylist.clear()
ListBox1.ContextMenuStrip.Enabled = False
Button1.Enabled = False
Button2.Enabled = False
Button4.Enabled = False
Dim lines3() As String = File.ReadAllLines(notification)
If lines3(0) = 0 Then
nonotif()
ElseIf lines3(0) = 1 Then
lang()
End If
End If
End Sub
Private Sub SupprimerToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SupprimerToolStripMenuItem.Click
If ListBox1.SelectedItem = "" Then
MsgBox("Merci de sélectionner un favori", MsgBoxStyle.Exclamation)
Else
ListBox1.ContextMenuStrip.Enabled = False
If ListBox1.Items.Count = 0 Then
MsgBox("Aucun Favori a été trouvez", MsgBoxStyle.Exclamation)
Else
Dim t1 = ListBox1.SelectedItem
Dim t2 = Favoris1 & t1 & "\flux.txt"
Dim t3 = Favoris1 & t1
File.Delete(t2)
Directory.Delete(t3)
MsgBox("Le Favori: " & ListBox1.SelectedItem & " a bien été supprimer", MsgBoxStyle.Information)
ListBox1.Items.Clear()
For Each fichier As String In IO.Directory.GetDirectories(Favoris1)
Dim info As New IO.FileInfo(fichier)
ListBox1.Items.Add(info.Name)
Next
End If
End If
End Sub
Private Sub ToutSupprimerToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ToutSupprimerToolStripMenuItem.Click
Dim sw4 As New StreamWriter(Favoris1)
ListBox1.Items.Clear()
For Each item In ListBox1.Items
sw4.WriteLine(item)
Next
sw4.Close()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Close()
End Sub
Sub nonotif()
Dim t1 = ListBox1.SelectedItem
Dim t2 = Favoris1 & t1 & "\flux.txt"
Dim lines1() As String = File.ReadAllLines(t2)
TextBox1.Text = lines1(0)
If File.Exists(TextBox1.Text) = True Then
If TextBox1.Text.EndsWith(".mp4") Or TextBox1.Text.EndsWith(".avi") Or TextBox1.Text.EndsWith(".mkv") Or TextBox1.Text.EndsWith(".mov") Or TextBox1.Text.EndsWith(".wmv") Then
Form1.AxWindowsMediaPlayer1.URL = lines1(0)
Form1.AjoutéAuFavorisToolStripMenuItem.Enabled = True
Form1.ComboBox1.Text = " "
Form1.TextBox1.Text = Form1.AxWindowsMediaPlayer1.URL
Form1.PictureBox2.Hide()
Form1.PictureBox7.Hide()
Form1.PictureBox1.Hide()
Form1.PictureBox4.Show()
Form1.VitesseToolStripMenuItem.Enabled = True
Form1.AllaiAToolStripMenuItem.Enabled = True
Form1.PictureBox5.Enabled = True
Form1.PictureBox6.Enabled = True
Form1.PictureBox7.Enabled = True
Form1.PauseToolStripMenuItem.Enabled = True
Form1.StopToolStripMenuItem.Enabled = True
Form1.PleinToolStripMenuItem.Enabled = True
Form1.Text = "lecteur média" & ": " & Form1.AxWindowsMediaPlayer1.currentMedia.name
Close()
Exit Sub
End If
Else
MsgBox("Le Favori sélectionner: " & ListBox1.SelectedItem & " a été déplacer ou supprimer", MsgBoxStyle.Information)
Exit Sub
End If
If TextBox1.Text.EndsWith(".mp3") Then
Form1.AxWindowsMediaPlayer1.URL = lines1(0)
Form1.AjoutéAuFavorisToolStripMenuItem.Enabled = True
Form1.TextBox1.Text = Form1.AxWindowsMediaPlayer1.URL
Form1.PictureBox7.Hide()
Form1.PictureBox2.Show()
Form1.PictureBox1.Hide()
Form1.PictureBox4.Show()
Form1.VitesseToolStripMenuItem.Enabled = False
Form1.AllaiAToolStripMenuItem.Enabled = False
Form1.PictureBox5.Enabled = True
Form1.PictureBox6.Enabled = True
Form1.PictureBox7.Enabled = True
Form1.PleinToolStripMenuItem.Enabled = False
Form1.PauseToolStripMenuItem.Enabled = True
Form1.StopToolStripMenuItem.Enabled = True
Form1.Text = "lecteur média" & ": " & Form1.AxWindowsMediaPlayer1.currentMedia.name
End If
Close()
End Sub
Sub lang()
fr()
End Sub
Sub fr()
Dim t1 = ListBox1.SelectedItem
Dim t2 = Favoris1 & t1 & "\flux.txt"
Dim lines1() As String = File.ReadAllLines(t2)
TextBox1.Text = lines1(0)
If File.Exists(TextBox1.Text) = True Or TextBox1.Text.Contains("http") = True Or TextBox1.Text.Contains("http") Then
If TextBox1.Text.EndsWith(".mp4") Or TextBox1.Text.EndsWith(".avi") Or TextBox1.Text.EndsWith(".mkv") Or TextBox1.Text.EndsWith(".mov") Or TextBox1.Text.EndsWith(".wmv") Then
Form1.AxWindowsMediaPlayer1.URL = lines1(0)
Form1.AjoutéAuFavorisToolStripMenuItem.Enabled = True
Form1.ComboBox1.Text = " "
Form1.TextBox1.Text = Form1.AxWindowsMediaPlayer1.URL
Form1.PictureBox2.Hide()
Form1.PictureBox7.Hide()
Form1.PictureBox1.Hide()
Form1.PictureBox4.Show()
Form1.VitesseToolStripMenuItem.Enabled = True
Form1.AllaiAToolStripMenuItem.Enabled = True
Form1.PictureBox5.Enabled = True
Form1.PictureBox6.Enabled = True
Form1.PictureBox7.Enabled = True
Form1.PauseToolStripMenuItem.Enabled = True
Form1.StopToolStripMenuItem.Enabled = True
Form1.PleinToolStripMenuItem.Enabled = True
Form1.NotifyIcon1.BalloonTipTitle = "lecteur média"
Form1.NotifyIcon1.BalloonTipText = "vous regarder:" & " " & Form1.AxWindowsMediaPlayer1.currentMedia.name
Form1.NotifyIcon1.ShowBalloonTip(1)
Close()
Exit Sub
End If
Else
MsgBox("Le Favori sélectionner: " & ListBox1.SelectedItem & " a été déplacer ou supprimer", MsgBoxStyle.Information)
Exit Sub
End If
If TextBox1.Text.EndsWith(".mp3") Then
Form1.AxWindowsMediaPlayer1.URL = lines1(0)
Form1.AjoutéAuFavorisToolStripMenuItem.Enabled = True
Form1.TextBox1.Text = Form1.AxWindowsMediaPlayer1.URL
Form1.PictureBox7.Hide()
Form1.PictureBox2.Show()
Form1.PictureBox1.Hide()
Form1.PictureBox4.Show()
Form1.VitesseToolStripMenuItem.Enabled = False
Form1.AllaiAToolStripMenuItem.Enabled = False
Form1.PictureBox5.Enabled = True
Form1.PictureBox6.Enabled = True
Form1.PictureBox7.Enabled = True
Form1.PleinToolStripMenuItem.Enabled = False
Form1.PauseToolStripMenuItem.Enabled = True
Form1.StopToolStripMenuItem.Enabled = True
Form1.NotifyIcon1.BalloonTipTitle = "lecteur média"
Form1.NotifyIcon1.BalloonTipText = "vous écouter:" & " " & Form1.AxWindowsMediaPlayer1.currentMedia.name
Form1.NotifyIcon1.ShowBalloonTip(1)
Form1.Text = "lecteur média" & ": " & Form1.AxWindowsMediaPlayer1.currentMedia.name
End If
Close()
End Sub
Private Sub ListBox1_SelectedValueChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedValueChanged
ListBox1.ContextMenuStrip = ContextMenuStrip1
ListBox1.ContextMenuStrip.Enabled = True
Button1.Enabled = True
Button2.Enabled = True
Button4.Enabled = True
End Sub
End Class