Inconsistency in FileTransferProgressEventArgs Filename property
On upload, when files are transferred and the FileTransferProgress event is fired, the filename property contains the full path of the local file being transferred (as it should).
On download, however, it only returns the filename only. This makes it impossible to tell where the file is in the server hierarchy.
So let's say I'm downloading: "/myfolder" and there's a subfolder & file there "/mysubfolder1/myfile.txt". When transferring "/mysubfolder1/myfile.txt", it will only return "myfile.txt". So how I am I able to know where exactly the file is? I have no way to know that it's in /mysubfolder1. In this example, if you specify "/myfolder" to download, I would expect the filename property to contain "/myfolder/mysubfolder1/myfile.txt" when transferring that file.
While on the subject of this filename property, you really need to have both the source and target paths passed in this event. You really should get rid of Filename and have SourcePath and DestinationPath properties. I mean an event that gets fired when a file is being transferred SHOULD contain the actual full path of the file being transferred and where that file is going.
Here's the issue Martin:
In my app, there's a cancel button to cancel an active file transfer. The only way I know of to actively cancel a transfer (without waiting for it to finish) is to stick a piece of code in my app when the FileTransferProgress event is fired to check for cancel and if so, to call Session.Abort to force abort. The problem with this is that WinSCP may leave behind .filepart files (this is another issue - WinSCP should first delete the .filepart file before aborting in this instance IMHO). Since it might leave this behind, I make note of the file being transferred via the Filename property and then log back in to delete the .filepart file if it exists with Session.RemoveFiles. When uploading, the filename property contains the local file path. Since there is no property in that event that contains the path to the file on the server (it should!), I then have to figure that out with a call to Session.TranslateLocalPathToRemote first to try to get what was the destination file path on the server. Then I add ".filepart" to it and log in and call RemoveFiles. It does work for uploading. But when downloading, because the filename property does not contain the full server path to the file but only the filename itself, I don't know where the file is to pass to Session.TranslateRemotePathToLocal in order to get the local file path (so I can delete the ".filepart" file in the local path).