28-05-19, 05:48 PM
PHP كود :
Imports System.ComponentModel
Imports System.IO
Public Class Form1
Dim fromf As String = ""
Dim tof As String = ""
Dim fi As Integer = 0
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim fb As New FolderBrowserDialog
If fb.ShowDialog = DialogResult.OK Then
tsp.Text = fb.SelectedPath
If tsp.Text.EndsWith("\") = False Then
tsp.Text = tsp.Text.Insert(tsp.TextLength, "\")
fromf = tsp.Text
End If
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim fb As New FolderBrowserDialog
If fb.ShowDialog = DialogResult.OK Then
tnp.Text = fb.SelectedPath
If tnp.Text.EndsWith("\") = False Then
tnp.Text = tnp.Text.Insert(tnp.TextLength, "\")
tof = tnp.Text
End If
End If
End Sub
Private Sub Lbl(ByVal a As String)
If l.InvokeRequired Then
l.Invoke(New Action(Of String)(AddressOf Lbl), a)
Else
l.Text = a
End If
End Sub
Private Sub prb(ByVal a As Boolean)
If p.InvokeRequired Then
p.Invoke(New Action(Of Boolean)(AddressOf prb), a)
Else
p.Value = a
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If c1.Checked = False Then Exit Sub
fi = 0
If b.IsBusy = False Then
Button3.Enabled = False
Dim dir As New DirectoryInfo(fromf)
p.Maximum = dir.GetFiles("*.*").Count
b.RunWorkerAsync()
End If
End Sub
Private Sub B_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles b.DoWork
Dim dir As New DirectoryInfo(fromf)
b.ReportProgress(fi)
For Each fl As FileInfo In dir.GetFiles("*.*")
Lbl(fl.FullName)
fl.MoveTo(tof & "\" & fl.Name)
fi += 1
Next
End Sub
Private Sub b_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles b.ProgressChanged
prb(e.ProgressPercentage)
End Sub
Private Sub enb(ByVal l As Boolean)
If Button3.InvokeRequired Then
Button3.Invoke(New Action(Of Boolean)(AddressOf enb), l)
Else
Button3.Enabled = l
End If
End Sub
Private Sub b_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles b.RunWorkerCompleted
enb(True)
Lbl("done")
End Sub
End Class
الكود الاساسي هو:
PHP كود :
Dim dir As New DirectoryInfo(fromf)
b.ReportProgress(fi)
For Each fl As FileInfo In dir.GetFiles("*.*")
fl.MoveTo(tof & "\" & fl.Name)
Next
اللهم إني أعوذ بك من غلبة الدين وغلبة العدو، اللهم إني أعوذ بك من جهد البلاء ومن درك الشقاء ومن سوء القضاء ومن شماتة الأعداء
اللهم اغفر لي خطيئتي وجهلي، وإسرافي في أمري وما أنت أعلم به مني، اللهم اغفر لي ما قدمت وما أخرت، وما أسررت وما أعلنت وما أنت أعلم به مني، أنت المقدم وأنت المؤخر وأنت على كل شيء قدير

