first commit
This commit is contained in:
@@ -0,0 +1,193 @@
|
||||
Imports System.Net
|
||||
Imports System.IO
|
||||
Imports System.ComponentModel
|
||||
Imports System.Net.Mail
|
||||
Imports System.Security.Cryptography
|
||||
Imports System.Text
|
||||
Imports System.Math
|
||||
|
||||
Public Class Drive5
|
||||
Dim téléchargement As Integer = 0
|
||||
Private Sub Drive5_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.ForeColor = Color.White
|
||||
Label9.ForeColor = Color.White
|
||||
ElseIf lines1a(0) = 3 Then
|
||||
Me.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
||||
Label1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
||||
Label9.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
||||
Else
|
||||
|
||||
End If
|
||||
|
||||
If Drive.TextBox1.Text = "" Then
|
||||
Try
|
||||
Form1.Timer6.Stop()
|
||||
téléchargerfr = New WebClient
|
||||
téléchargerfr.DownloadFileTaskAsync(New Uri(ipsite & "/" & "Utilisateur" & "/" & Drive.tcon & "/" & "Dirve" & "/" & Drive.ListBox1.SelectedItem), (compte & Drive.ListBox1.SelectedItem))
|
||||
téléchargement = 1
|
||||
Catch ex As Exception
|
||||
Timer1.Start()
|
||||
End Try
|
||||
Else
|
||||
Try
|
||||
Form1.Timer6.Stop()
|
||||
téléchargerfr = New WebClient
|
||||
téléchargerfr.DownloadFileTaskAsync(New Uri(ipsite & "/" & "Utilisateur" & "/" & Drive.tcon & "/" & "Dirve" & "/" & Drive.TextBox1.Text & "/" & Drive.ListBox1.SelectedItem), (compte & Drive.ListBox1.SelectedItem))
|
||||
téléchargement = 1
|
||||
Catch ex As Exception
|
||||
Timer1.Start()
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub téléchargerfr_DownloadFileCompleted(sender As Object, e As AsyncCompletedEventArgs) Handles téléchargerfr.DownloadFileCompleted
|
||||
Dim FichierInfo As System.IO.FileInfo = New System.IO.FileInfo(compte & Drive.ListBox1.SelectedItem)
|
||||
Dim TailleFichier As Integer = FichierInfo.Length
|
||||
If TailleFichier = 0 Then
|
||||
File.Delete(compte & Drive.ListBox1.SelectedItem)
|
||||
Else
|
||||
ProgressBar1.Value = 0
|
||||
Label1.Text = "0" & "%"
|
||||
My.Computer.FileSystem.RenameFile(compte & Drive.ListBox1.SelectedItem, "(" & Drive.tcon & ")" & " " & Drive.ListBox1.SelectedItem)
|
||||
Try
|
||||
téléchargerfr2 = New WebClient
|
||||
téléchargerfr2.UploadFileTaskAsync(ipserver & "/Utilisateur/" & Drive2.ComboBox1.SelectedItem & "/driveattfile/(" & Drive.tcon & ")" & " " & Drive.ListBox1.SelectedItem, compte & "(" & Drive.tcon & ")" & " " & Drive.ListBox1.SelectedItem)
|
||||
Catch ex As Exception
|
||||
Timer2.Start()
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub téléchargerfr_DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs) Handles téléchargerfr.DownloadProgressChanged
|
||||
Dim disctédossier = func_RoundTaille(e.BytesReceived)
|
||||
Dim disctédossier2 = func_RoundTaille(e.TotalBytesToReceive)
|
||||
Label9.Text = disctédossier & " / " & disctédossier2
|
||||
Me.Text = "Téléchargement: " & Drive.ListBox1.SelectedItem & " " & disctédossier & " / " & disctédossier2
|
||||
ProgressBar1.Value = e.ProgressPercentage
|
||||
Label1.Text = e.ProgressPercentage & "%"
|
||||
End Sub
|
||||
|
||||
Private Sub téléchargerfr2_UploadProgressChanged(sender As Object, e As UploadProgressChangedEventArgs) Handles téléchargerfr2.UploadProgressChanged
|
||||
Dim disctédossier = func_RoundTaille(e.BytesSent)
|
||||
Dim disctédossier2 = func_RoundTaille(e.TotalBytesToSend)
|
||||
Label9.Text = disctédossier & " / " & disctédossier2
|
||||
Dim bc = e.BytesSent / e.TotalBytesToSend * 100
|
||||
ProgressBar1.Value = bc
|
||||
Me.Text = "Transférer a: " & Drive2.ComboBox1.SelectedItem & " " & Label1.Text & " " & disctédossier & " / " & disctédossier2
|
||||
Label1.Text = ProgressBar1.Value & "%"
|
||||
End Sub
|
||||
|
||||
Private Sub téléchargerfr2_UploadFileCompleted(sender As Object, e As UploadFileCompletedEventArgs) Handles téléchargerfr2.UploadFileCompleted
|
||||
File.Delete(compte & "(" & Drive.tcon & ")" & " " & Drive.ListBox1.SelectedItem)
|
||||
My.Computer.Network.DownloadFile(ipserver & "/Utilisateur/" & Drive2.ComboBox1.SelectedItem & "/mail.txt", compte & "mailtemps.txt")
|
||||
mail()
|
||||
End Sub
|
||||
|
||||
Dim WithEvents téléchargerfr As WebClient
|
||||
Dim WithEvents téléchargerfr2 As WebClient
|
||||
Sub mail()
|
||||
Dim t1 = compte & "mailtemps.txt"
|
||||
Dim lines() As String = File.ReadAllLines(t1)
|
||||
File.Delete(compte & "mailtemps.txt")
|
||||
Dim Resultatbytes() As Byte = Convert.FromBase64String(lines(0))
|
||||
Dim keyBytes() As Byte = Encoding.UTF8.GetBytes("Jj@msms7")
|
||||
Dim Crypto As New DESCryptoServiceProvider()
|
||||
Crypto.Key = keyBytes
|
||||
Crypto.IV = keyBytes
|
||||
Dim Icrypto As ICryptoTransform = Crypto.CreateDecryptor()
|
||||
Dim donné() As Byte = Icrypto.TransformFinalBlock(Resultatbytes, 0, Resultatbytes.Length)
|
||||
Dim mailcrypt = Encoding.UTF8.GetString(donné)
|
||||
|
||||
|
||||
Dim MyMailMessage As New MailMessage()
|
||||
Dim SMTPServer As New SmtpClient("mail48.lwspanel.com")
|
||||
Dim mail = mailcrypt
|
||||
Dim message = "L’utilisateur: " & Drive.tcon & " vous a partager le fichier: " & Drive.ListBox1.SelectedItem & vbNewLine & vbNewLine & "Ceci est unn message automatique merci de ne pas répondre."
|
||||
|
||||
MyMailMessage.From = New MailAddress("noreply@lecteur-media.fr")
|
||||
MyMailMessage.To.Add(mail)
|
||||
MyMailMessage.Subject = ("Partage de fichier Lecteur média de: " & Drive.tcon)
|
||||
MyMailMessage.Body = (message)
|
||||
|
||||
SMTPServer.Port = ("587") 'Port
|
||||
SMTPServer.Credentials = New System.Net.NetworkCredential("noreply@lecteur-media.fr", "pC1*zzU9-qtZjdT")
|
||||
SMTPServer.EnableSsl = True
|
||||
|
||||
|
||||
SMTPServer.Send(MyMailMessage) 'Envoi
|
||||
|
||||
téléchargement = 0
|
||||
For Each fichier As String In IO.Directory.GetFiles(cozip)
|
||||
Dim info As New IO.FileInfo(fichier)
|
||||
File.Delete(fichier)
|
||||
Next
|
||||
Form1.NotifyIcon1.BalloonTipTitle = "Partage"
|
||||
Form1.NotifyIcon1.BalloonTipText = "Le fichier " & Drive.ListBox1.SelectedItem & " a bien été transférer a: " & Drive2.ComboBox1.SelectedItem
|
||||
Form1.NotifyIcon1.ShowBalloonTip(0)
|
||||
Form1.Timer6.Start()
|
||||
MsgBox("Le fichier " & Drive.ListBox1.SelectedItem & " a bien été transférer a: " & Drive2.ComboBox1.SelectedItem, MsgBoxStyle.Information)
|
||||
Drive2.ComboBox1.Items.Clear()
|
||||
Drive2.Button1.Text = "Transférer a: "
|
||||
Drive2.Close()
|
||||
Close()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
|
||||
Timer1.Stop()
|
||||
If Drive.TextBox1.Text = "" Then
|
||||
Try
|
||||
Form1.Timer6.Stop()
|
||||
téléchargerfr = New WebClient
|
||||
téléchargerfr.DownloadFileTaskAsync(New Uri(ipsite & "/" & "Utilisateur" & "/" & Drive.tcon & "/" & "Dirve" & "/" & Drive.ListBox1.SelectedItem), (compte & Drive.ListBox1.SelectedItem))
|
||||
téléchargement = 1
|
||||
Catch ex As Exception
|
||||
Timer1.Start()
|
||||
End Try
|
||||
Else
|
||||
Try
|
||||
Form1.Timer6.Stop()
|
||||
téléchargerfr = New WebClient
|
||||
téléchargerfr.DownloadFileTaskAsync(New Uri(ipsite & "/" & "Utilisateur" & "/" & Drive.tcon & "/" & "Dirve" & "/" & Drive.TextBox1.Text & "/" & Drive.ListBox1.SelectedItem), (compte & Drive.ListBox1.SelectedItem))
|
||||
téléchargement = 1
|
||||
Catch ex As Exception
|
||||
Timer1.Start()
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
|
||||
Timer2.Stop()
|
||||
Try
|
||||
téléchargerfr2 = New WebClient
|
||||
téléchargerfr2.UploadFileTaskAsync(ipserver & "/Utilisateur/" & Drive2.ComboBox1.SelectedItem & "/driveattfile/(" & Drive.tcon & ")" & " " & Drive.ListBox1.SelectedItem, compte & "(" & Drive.tcon & ")" & " " & Drive.ListBox1.SelectedItem)
|
||||
Catch ex As Exception
|
||||
Timer2.Start()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub Drive5_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
||||
If téléchargement = 1 Then
|
||||
MsgBox("Le partage du fichier: " & Drive.ListBox1.SelectedItem & "est en cours merci de patienter", MsgBoxStyle.Exclamation)
|
||||
e.Cancel = True
|
||||
Else
|
||||
|
||||
End If
|
||||
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
|
||||
End Class
|
||||
Reference in New Issue
Block a user