tomohulk / WinSCP

WinSCP PowerShell Wrapper Module
GNU General Public License v3.0
155 stars 30 forks source link

Add support for WinSCP Events like FileTransferred or FileTransferProgress #136

Open aurel-appsthru opened 3 years ago

aurel-appsthru commented 3 years ago

Issue Description

Hello, it would be great if we could add event support like FileTransferred or FileTransferProgress !

https://winscp.net/eng/docs/library_session#events

THX

tomohulk commented 1 year ago

Can you elaborate on this? I'm not sure how to really implement this pwsh. Can you give me an example of how you would see it working, and a situation where you would use it?

larsskogshusabf commented 8 months ago

I would like a simple progresbar like this: image $session.add_FileTransferProgress( { FileTransferProgress($_) } ) would need to be implemented in New-WinSCPSession.ps1 before opening the session.

I dont know where the best place for the function would be. (mine looks like this)

function FileTransferProgress
{
    param($e)

    Write-Progress `
        -Id 1 -Activity "Transfering" -Status ("{0:P0} complete:" -f $e.OverallProgress) `
        -PercentComplete ($e.OverallProgress * 100)
    Write-Progress `
        -Id 2 -ParentId 1 -Activity $(([String]$e.FileName).Substring($e.FileName.length - 30,30))  -Status ("{0:P0} complete:" -f $e.FileProgress) `
        -PercentComplete ($e.FileProgress * 100)
}

https://winscp.net/eng/docs/library_session_filetransferprogress

thomas-tarp commented 4 weeks ago

Agree - this would be great!