I Try To Use
A Faster File.Copy[
^]
This Code Convert visual basic But if ı use this code code give
"empty path name is not legal Error"
error
How Can ı Fix This Converted Code?
Note:I convert this Code with
Code Converter C# to VB and VB to C# – Telerik[
^]
What I have tried:
Public Shared Sub MoveTime(ByVal source As String, ByVal destination As String)
Dim start_time As DateTime = DateTime.Now
FMove(source, destination)
Dim size As Long = New FileInfo(destination).Length
Dim milliseconds As Integer = 1 + CInt(((DateTime.Now - start_time).TotalMilliseconds))
Dim tsize As Long = size * 3600000 / milliseconds
tsize = tsize / CInt(Math.Pow(2, 30))
Console.WriteLine(tsize & "GB/hour")
End Sub
Private Shared Sub FMove(ByVal source As String, ByVal destination As String)
Dim array_length As Integer = CInt(Math.Pow(2, 19))
Dim dataArray As Byte() = New Byte(array_length - 1) {}
Using fsread As FileStream = New FileStream(source, FileMode.Open, FileAccess.Read, FileShare.None, array_length)
Using bwread As BinaryReader = New BinaryReader(fsread)
Using fswrite As FileStream = New FileStream(destination, FileMode.Create, FileAccess.Write, FileShare.None, array_length)
Using bwwrite As BinaryWriter = New BinaryWriter(fswrite)
While True
Dim read As Integer = bwread.Read(dataArray, 0, array_length)
If 0 = read Then Exit For
bwwrite.Write(dataArray, 0, read)
End While
End Using
End Using
End Using
End Using
File.Delete(source)
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim Sourcefolder As String = FolderBrowserDialog1.SelectedPath
Dim Tragetfolder As String = FolderBrowserDialog2.SelectedPath
FMove(Sourcefolder, Tragetfolder)
End Sub