07-12-16, 12:43 AM
(آخر تعديل لهذه المشاركة : 07-12-16, 12:45 AM {2} بواسطة silverlight.)
PHP كود :
Private Function GetAllTextFiles(path As String) As String()
Return GetFiles(path, "*.txt")
End Function
Private Function GetAllHtmlFiles(path As String) As String()
Return GetFiles(path, "*.html")
End Function
Private Function GetAllFiles(path As String) As String()
Return GetFiles(path, "*.*")
End Function
Private Function GetFiles(path As String, fileExtension As String) As String()
Dim parallel = Task.Run(Function()
Return Directory.GetFiles(path, fileExtension, SearchOption.AllDirectories)
End Function)
Try
Return parallel.Result
Catch ex As AggregateException
ex.Handle(Function(unauthorized)
' Handle an UnauthorizedAccessException
If TypeOf unauthorized Is UnauthorizedAccessException Then
MessageBox.Show("You do not have permission to access all folders in this path. See your network administrator or try another path.", "Error", MessageBoxButtons.OK)
End If
Return TypeOf unauthorized Is UnauthorizedAccessException
End Function)
End Try
Return New String() {}
End Function

