Imports System.ComponentModel Imports System.IO Imports System.Net Imports System.Math Imports System.Windows.Controls Public Class Filmform Public nom As String = "" Public time As String = "" Public auteur As String = "" Public filmdate As String = "" Public urlfilm As String = "" Public urllike As String = "" Dim dl As Integer = 0 Dim pource As Integer = 0 Dim téléchargement As Integer = 0 Private Sub Film_Load(sender As Object, e As EventArgs) Handles MyBase.Load Text = nom Label2.Text = nom Label4.Text = time Label6.Text = auteur Label8.Text = filmdate Dim lines1a() As String = File.ReadAllLines(théme) If lines1a(0) = 2 Then CircularProgressBar1.ForeColor = Color.White Me.BackColor = Color.FromArgb(64, 64, 64) Button1.BackColor = Color.FromArgb(64, 64, 64) Button1.ForeColor = Color.White Label1.ForeColor = Color.White Label2.ForeColor = Color.White Label3.ForeColor = Color.White Label4.ForeColor = Color.White Label5.ForeColor = Color.White Label6.ForeColor = Color.White Label7.ForeColor = Color.White Label8.ForeColor = Color.White Label9.ForeColor = Color.White Label10.ForeColor = Color.White Label11.ForeColor = Color.White CheckBox1.ForeColor = Color.White LinkLabel1.LinkColor = Color.White LinkLabel1.ActiveLinkColor = Color.White ElseIf lines1a(0) = 3 Then LinkLabel1.LinkColor = Form1.ForeColor LinkLabel1.ActiveLinkColor = Form1.ForeColor PictureBox5.Image = Form1.PictureBox12.Image PictureBox4.Image = Form1.PictureBox11.Image PictureBox2.Image = Form1.PictureBox10.Image CircularProgressBar1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB) 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) 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) Label5.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB) Label6.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB) Label7.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB) Label8.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB) Label9.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB) Label10.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB) Label11.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB) CheckBox1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB) Else End If If Directory.Exists(film & "\" & nom & "\") = True Then Else Directory.CreateDirectory(film & "\" & nom & "\") End If If File.Exists(film & "\" & nom & "\film.txt") = True Then Else Dim sw1 As New StreamWriter(film & "\" & nom & "\film.txt") sw1.WriteLine(0) sw1.Close() End If If File.Exists(film & "\" & nom & "\like.txt") = True Then Else Dim sw1 As New StreamWriter(film & "\" & nom & "\like.txt") sw1.WriteLine(0) sw1.Close() End If Dim lines3() As String = File.ReadAllLines(film & "\" & nom & "\like.txt") If lines3(0) = 1 Then PictureBox4.Show() PictureBox5.Hide() Else PictureBox4.Hide() PictureBox5.Show() End If CheckBox1.Hide() CircularProgressBar1.Hide() CircularProgressBar1.Value = 0 Dim lines2() As String = File.ReadAllLines(film & "\" & nom & "\film.txt") If lines2(0) = 1 Then PictureBox2.Hide() PictureBox3.Show() Else PictureBox2.Show() PictureBox3.Hide() End If Timer1.Start() End Sub Private Sub Filmform_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing If téléchargement = 1 Then MsgBox("Le téléchargement du film: " & nom & " est en cours merci de patienter !!!", MessageBoxIcon.Exclamation) e.Cancel = True End If PictureBox1.Image.Dispose() Timer1.Stop() nom = "" time = "" auteur = "" filmdate = "" urlfilm = "" urllike = "" End Sub Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click lang() End Sub Private Sub PictureBox3_Click(sender As Object, e As EventArgs) Handles PictureBox3.Click Dim sw4 As New StreamWriter(filmhc) Dim sw1 As New StreamWriter(film & "\" & nom & "\film.txt") sw1.WriteLine(0) sw1.Close() PictureBox2.Show() PictureBox3.Hide() Form16.ListBox1.Items.Remove(nom) For Each item In Form16.ListBox1.Items sw4.WriteLine(item) Next sw4.Close() File.Delete(film & "\" & nom & "\" & nom & ".mkv") End Sub Sub lang() internetfr() End Sub Sub internetfr() Try If My.Computer.Network.Ping("www.Google.com") Then downloadfr() End If Catch ex As Exception MsgBox("Vous n’êtes actuellement pas connecté à Internet", MsgBoxStyle.Information, "Hors connexion") End Try End Sub Sub downloadfr() Form1.Timer6.Stop() Dim lines1() As String = File.ReadAllLines(setting) If lines1(0) = 0 Then downloadfr1() ElseIf lines1(0) = 1 Then downloadfr2() End If End Sub Sub downloadfr1() LinkLabel1.Hide() Form1.NotifyIcon1.BalloonTipTitle = "Téléchargement:" Form1.NotifyIcon1.BalloonTipText = "Début du téléchargement de: " & nom Form1.NotifyIcon1.ShowBalloonTip(0) CheckBox1.Show() téléchargement = 1 Button1.Enabled = False CircularProgressBar1.Show() téléchargerfr = New WebClient téléchargerfr.DownloadFileTaskAsync(New Uri(urlfilm & "/" & nom & ".mkv"), (film & "\" & nom & "\" & nom & ".mkv")) End Sub Sub downloadfr2() LinkLabel1.Hide() Form1.NotifyIcon1.BalloonTipTitle = "Téléchargement:" Form1.NotifyIcon1.BalloonTipText = "Début du téléchargement de: " & nom Form1.NotifyIcon1.ShowBalloonTip(0) CheckBox1.Show() téléchargement = 1 Button1.Enabled = False CircularProgressBar1.Show() Form1.Hide() Form16.Hide() Me.Hide() téléchargerfr = New WebClient téléchargerfr.DownloadFileTaskAsync(New Uri(urlfilm & "/" & nom & ".mkv"), (film & "\" & nom & "\" & nom & ".mkv")) End Sub Private Sub téléchargerfr_DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs) Handles téléchargerfr.DownloadProgressChanged pource = e.ProgressPercentage If e.ProgressPercentage = "50" Then CircularProgressBar1.ProgressColor = Color.DodgerBlue CircularProgressBar1.Value = e.ProgressPercentage CircularProgressBar1.Text = e.ProgressPercentage & "%" pourcent50() ElseIf e.ProgressPercentage = "10" Then CircularProgressBar1.Value = e.ProgressPercentage CircularProgressBar1.Text = e.ProgressPercentage & "%" CircularProgressBar1.Value = e.ProgressPercentage CircularProgressBar1.Text = e.ProgressPercentage & "%" pourcent10() ElseIf e.ProgressPercentage = "30" Then CircularProgressBar1.Value = e.ProgressPercentage CircularProgressBar1.Text = e.ProgressPercentage & "%" CircularProgressBar1.Value = e.ProgressPercentage CircularProgressBar1.Text = e.ProgressPercentage & "%" pourcent30() ElseIf e.ProgressPercentage = "70" Then CircularProgressBar1.Value = e.ProgressPercentage CircularProgressBar1.Text = e.ProgressPercentage & "%" CircularProgressBar1.Value = e.ProgressPercentage CircularProgressBar1.Text = e.ProgressPercentage & "%" pourcent70() ElseIf e.ProgressPercentage = " 90" Then CircularProgressBar1.Value = e.ProgressPercentage CircularProgressBar1.Text = e.ProgressPercentage & "%" CircularProgressBar1.Value = e.ProgressPercentage CircularProgressBar1.Text = e.ProgressPercentage & "%" pourcent90() ElseIf e.ProgressPercentage = "100" Then CircularProgressBar1.ProgressColor = Color.Green CircularProgressBar1.Value = e.ProgressPercentage CircularProgressBar1.Text = e.ProgressPercentage & "%" ElseIf e.ProgressPercentage = "0" Then CircularProgressBar1.ProgressColor = Color.Red CircularProgressBar1.Value = e.ProgressPercentage CircularProgressBar1.Text = e.ProgressPercentage & "%" End If CircularProgressBar1.Value = e.ProgressPercentage CircularProgressBar1.Text = e.ProgressPercentage & "%" Dim disctédossier = func_RoundTaille(e.BytesReceived) Dim disctédossier2 = func_RoundTaille(e.TotalBytesToReceive) Label9.Text = disctédossier & " / " & disctédossier2 Me.Text = nom & ": " & e.ProgressPercentage & "%: " & disctédossier & " / " & disctédossier2 CircularProgressBar1.Value = e.ProgressPercentage CircularProgressBar1.Text = e.ProgressPercentage & "%" End Sub Private Sub téléchargerfr_DownloadFileCompleted(sender As Object, e As AsyncCompletedEventArgs) Handles téléchargerfr.DownloadFileCompleted LinkLabel1.Show() Form1.NotifyIcon1.BalloonTipTitle = "Téléchargement terminer" Form1.NotifyIcon1.BalloonTipText = "Le téléchargement de: " & nom & " est terminer." Form1.NotifyIcon1.ShowBalloonTip(0) Form1.min = Form1.minmax Form1.Timer6.Start() téléchargement = 0 If CheckBox1.Checked = True Then CheckBox1.Hide() téléchargement = 0 Form1.Show() Form16.Show() Me.Show() Me.Cursor = Cursors.Default Me.Text = nom Label9.Text = "" CircularProgressBar1.Hide() Button1.Enabled = True PictureBox2.Hide() PictureBox3.Show() Dim sw4 As New StreamWriter(filmhc) Form16.ListBox1.Items.Add(nom) For Each item In Form16.ListBox1.Items sw4.WriteLine(item) Next sw4.Close() Dim sw1 As New StreamWriter(film & "\" & nom & "\film.txt") sw1.WriteLine(1) sw1.Close() Form92.ShowDialog() Else terfr() End If End Sub Dim WithEvents téléchargerfr As WebClient Dim WithEvents téléchargeren As WebClient Sub terfr() Dim lines5() As String = File.ReadAllLines(settings4) If lines5(0) = 0 Then terfr2() ElseIf lines5(0) = 1 Then Dim son = New System.Media.SoundPlayer(My.Resources.fin_de_téléchargement) son.Play() terfr2() ElseIf lines5(0) = 2 Then terfr3() End If End Sub Sub terfr2() téléchargement = 0 CheckBox1.Hide() Form1.Show() Form16.Show() Me.Show() Me.Cursor = Cursors.Default Me.Text = nom Label9.Text = "" CircularProgressBar1.Hide() Button1.Enabled = True PictureBox2.Hide() PictureBox3.Show() Dim sw4 As New StreamWriter(filmhc) Form16.ListBox1.Items.Add(nom) For Each item In Form16.ListBox1.Items sw4.WriteLine(item) Next sw4.Close() Dim sw1 As New StreamWriter(film & "\" & nom & "\film.txt") sw1.WriteLine(1) sw1.Close() MsgBox("Le film a été télécharger!!!", MsgBoxStyle.Information) End Sub Sub terfr3() CheckBox1.Hide() Form1.Show() Form16.Show() Me.Show() Me.Cursor = Cursors.Default Me.Text = nom Label9.Text = "" CircularProgressBar1.Hide() Button1.Enabled = True PictureBox2.Hide() PictureBox3.Show() Dim sw4 As New StreamWriter(filmhc) Form16.ListBox1.Items.Add(nom) For Each item In Form16.ListBox1.Items sw4.WriteLine(item) Next sw4.Close() Dim sw1 As New StreamWriter(film & "\" & nom & "\film.txt") sw1.WriteLine(1) sw1.Close() Form74.ShowDialog() End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim lines1222() As String = File.ReadAllLines(settings1) If lines1222(5) = 1 Then Form1.Timer25.Start() End If Dim t1 = nom Dim t2 = marqueur & t1 & ".txt" If File.Exists(t2) = True Then formmarqueur.ShowDialog() Else Form1.AjoutéUnMarqueurToolStripMenuItem.Enabled = True Form1.AjoutéAuFavorisToolStripMenuItem.Enabled = False Button1.Enabled = False langfr() End If End Sub Sub langfr() Try If My.Computer.Network.Ping("www.Google.com") = True Then langfr2() End If Catch ex As Exception MsgBox("Vous n’êtes actuellement pas connecté à Internet", MsgBoxStyle.Information) Button1.Enabled = True Me.Close() End Try End Sub Sub langfr2() Dim lines2() As String = File.ReadAllLines(notification) Form1.AxWindowsMediaPlayer1.Ctlcontrols.stop() Form1.AxWindowsMediaPlayer1.currentPlaylist.clear() If lines2(0) = 1 Then langfr3() ElseIf lines2(0) = 0 Then langfr4() End If End Sub Sub langfr3() Dim sw4 As New StreamWriter(historique) Form1.AxWindowsMediaPlayer1.URL = urlfilm & "/" & nom & ".mkv" Form1.PictureBox1.Hide() Form1.Text = lecteurnom & ": " & Form1.AxWindowsMediaPlayer1.currentMedia.name Form1.NotifyIcon1.BalloonTipTitle = "Lecteur média" Form1.NotifyIcon1.BalloonTipText = "Vous regarder:" & " " & Form1.AxWindowsMediaPlayer1.currentMedia.name Form1.NotifyIcon1.ShowBalloonTip(1) Form1.TextBox1.Text = Form1.AxWindowsMediaPlayer1.currentMedia.name & " film" 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 Button1.Enabled = True Form1.ListBox1.Items.Add(Form1.AxWindowsMediaPlayer1.currentMedia.name & " : " & Today & " : " & TimeOfDay) For Each item In Form1.ListBox1.Items sw4.WriteLine(item) Next sw4.Close() PictureBox1.Image.Dispose() Form16.Close() Me.Close() End Sub Sub langfr4() Dim sw4 As New StreamWriter(historique) Form1.AxWindowsMediaPlayer1.URL = urlfilm & "/" & nom & ".mkv" Form1.PictureBox1.Hide() Form1.Text = lecteurnom & ": " & Form1.AxWindowsMediaPlayer1.currentMedia.name Form1.TextBox1.Text = Form1.AxWindowsMediaPlayer1.currentMedia.name & " film" 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 Button1.Enabled = True Form1.ListBox1.Items.Add(Form1.AxWindowsMediaPlayer1.currentMedia.name & " : " & Today & " : " & TimeOfDay) For Each item In Form1.ListBox1.Items sw4.WriteLine(item) Next sw4.Close() PictureBox1.Image.Dispose() Form16.Close() Me.Close() End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick If WindowState = 1 Then Form1.Visible = False Form16.Visible = False Else Form1.Visible = True Form16.Visible = True End If Dim maj As New WebClient Dim vri As String = maj.DownloadString(urlfilm & "/like.txt") Label10.Text = vri End Sub Sub test() Dim like1 As New WebClient Dim like3 As New WebClient Try like1.DownloadFile(urllike & "like.txt", like2 & "\" & nom & ".txt") Catch ex As Exception MsgBox("Impossible de se connecter au serveur", MsgBoxStyle.Information) Exit Sub End Try Dim t1 = like2 & "\" & nom & ".txt" Dim sr As New StreamReader(t1) While (sr.Peek >= 0) Label11.Text = sr.ReadLine End While sr.Close() Label11.Text = Label11.Text + 1 Dim sw1 As New StreamWriter(t1) sw1.WriteLine(Label11.Text) sw1.Close() Try My.Computer.Network.UploadFile(t1, urllike & "like.txt") Catch ex As Exception Timer2.Start() File.Delete(t1) Exit Sub End Try File.Delete(t1) Dim sw4 As New StreamWriter(film & "\" & nom & "\like.txt") sw4.WriteLine(1) sw4.Close() PictureBox4.Show() PictureBox5.Hide() End Sub Private Sub PictureBox5_Click(sender As Object, e As EventArgs) Handles PictureBox5.Click test() End Sub Sub test2() Dim like1 As New WebClient Dim like3 As New WebClient Try like1.DownloadFile(urllike & "like.txt", like2 & "\" & nom & ".txt") Catch ex As Exception MsgBox("Impossible de se connecter au serveur", MsgBoxStyle.Information) Exit Sub End Try Dim t1 = like2 & "\" & nom & ".txt" Dim sr As New StreamReader(t1) While (sr.Peek >= 0) Label11.Text = sr.ReadLine End While sr.Close() Label11.Text = Label11.Text - 1 Dim sw1 As New StreamWriter(t1) sw1.WriteLine(Label11.Text) sw1.Close() Try My.Computer.Network.UploadFile(t1, urllike & "like.txt") Catch ex As Exception Timer3.Start() File.Delete(t1) Exit Sub End Try File.Delete(t1) Dim sw4 As New StreamWriter(film & "\" & nom & "\like.txt") sw4.WriteLine(0) sw4.Close() PictureBox4.Hide() PictureBox5.Show() End Sub Private Sub PictureBox4_Click(sender As Object, e As EventArgs) Handles PictureBox4.Click test2() End Sub Sub pourcent10() If dl = 0 Then Form1.NotifyIcon1.BalloonTipTitle = "Téléchargement:" Form1.NotifyIcon1.BalloonTipText = nom & ": " & pource & "%" Form1.NotifyIcon1.ShowBalloonTip(0) dl = 1 End If End Sub Sub pourcent30() If dl = 1 Then Form1.NotifyIcon1.BalloonTipTitle = "Téléchargement:" Form1.NotifyIcon1.BalloonTipText = nom & ": " & pource & "%" Form1.NotifyIcon1.ShowBalloonTip(0) dl = 2 End If End Sub Sub pourcent50() If dl = 2 Then Form1.NotifyIcon1.BalloonTipTitle = "Téléchargement:" Form1.NotifyIcon1.BalloonTipText = nom & ": " & pource & "%" Form1.NotifyIcon1.ShowBalloonTip(0) dl = 3 End If End Sub Sub pourcent70() If dl = 3 Then Form1.NotifyIcon1.BalloonTipTitle = "Téléchargement:" Form1.NotifyIcon1.BalloonTipText = nom & ": " & pource & "%" Form1.NotifyIcon1.ShowBalloonTip(0) dl = 4 End If End Sub Sub pourcent90() If dl = 4 Then Form1.NotifyIcon1.BalloonTipTitle = "Téléchargement:" Form1.NotifyIcon1.BalloonTipText = nom & ": " & pource & "%" Form1.NotifyIcon1.ShowBalloonTip(0) dl = 0 End If End Sub Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick Timer2.Stop() Dim t1 = like2 & "\" & nom & ".txt" Try My.Computer.Network.UploadFile(t1, urllike & "like.txt") Catch ex As Exception Timer2.Start() File.Delete(t1) Exit Sub End Try File.Delete(t1) Dim sw4 As New StreamWriter(film & "\" & nom & "\like.txt") sw4.WriteLine(1) sw4.Close() PictureBox4.Show() PictureBox5.Hide() End Sub Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick Timer3.Stop() Dim t1 = like2 & "\" & nom & ".txt" Try My.Computer.Network.UploadFile(t1, urllike & "like.txt") Catch ex As Exception Timer3.Start() File.Delete(t1) Exit Sub End Try File.Delete(t1) Dim sw4 As New StreamWriter(film & "\" & nom & "\like.txt") sw4.WriteLine(0) sw4.Close() PictureBox4.Hide() PictureBox5.Show() End Sub Public Function func_RoundTaille(ByVal LaTaille As Long) As String Select Case LaTaille Case Is < 1024 Return Round(LaTaille) & " Octets" Case Is < 1048576 Return Round(LaTaille / 2 ^ 10, 3) & " Ko" Case Is < 1073741824 Return Round(LaTaille / 2 ^ 20, 3) & " Mo" Case Else Return Round(LaTaille / 2 ^ 30, 3) & " Go" End Select End Function Private Sub PictureBox6_Click(sender As Object, e As EventArgs) Handles PictureBox6.Click Try Dim maj As New WebClient Dim vri As String = maj.DownloadString(urlfilm & "bd.txt") If My.Computer.Info.OSFullName.Contains("Windows 17") Then Form38.WebView21.Source = New System.Uri(vri, System.UriKind.Absolute) Form38.Text = "Bande annonce de: " & nom Form38.ShowDialog() Else Process.Start(vri) End If Catch ex As Exception MsgBox("aucune bande annonce trouvez", MsgBoxStyle.Information) End Try End Sub Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked Try Dim maj As New WebClient Dim vri As String = maj.DownloadString(urlfilm & "resum.txt") My.Computer.Network.DownloadFile(urlfilm & "resum.txt", dosparamètres & "/resumtemps.txt") Dim lines1() As String = File.ReadAllLines(dosparamètres & "/resumtemps.txt") File.Delete(dosparamètres & "/resumtemps.txt") MsgBox(lines1(0)) Catch ex As Exception MsgBox("aucun résumé trouvez", MsgBoxStyle.Information) End Try End Sub End Class