And this works well with smallish files (I'm not too sure of a limit, but I tried it out on a couple of Windows EXE files that are a couple hundred KB in size and it worked fine) but upon feeding it a just a lowly 16 meg DLL file it just face planted into the ground with the force of an asteroid. But the stack did copy the file, it took a while but it kept on running, just the UI locked up and after a couple of minutes the UI came back to life and the file was copied.
I used both the code sections below (The _CopyChunk message does the same Read From File and Write To File stuff as the first code section does) and both result in the UI locking up.
Original Code Used:
Code: Select all
If tChunkIndex < tNumberOfFileChunks Then
Read From File pSourceFilePath For 512 Bytes
Else Read From File pSourceFilePath Until EOF
Put It Into tFileChunk
Write tFileChunk To File pDestinationFilePath
If pMessage_ChunkCopied <> Empty Then
Dispatch pMessage_ChunkCopied To tTargetObject With tChunkIndex
End If
If tChunkIndex < tNumberOfFileChunks Then
Add 1 To tChunkIndex
Else Exit Repeat
Code: Select all
Put False Into tChunkCopyStatus
If tChunkIndex < tNumberOfFileChunks Then
Send ("_CopyChunk" && pSourceFilePath & Comma & pDestinationFilePath & Comma & False) To Me In 0 Seconds
Else Send ("_CopyChunk" && pSourceFilePath & Comma & pDestinationFilePath & Comma & True) To Me In 0 Seconds
Wait While tChunkCopyStatus = False With Messages
If pMessage_ChunkCopied <> Empty Then
Dispatch pMessage_ChunkCopied To tTargetObject With tChunkIndex
End If
If tChunkIndex < tNumberOfFileChunks Then
Add 1 To tChunkIndex
Else Exit Repeat
TL;DR Read From File whitey's at anything more than a couple hundred kilobytes of data.