No Constructor for WinSCP.TransferResumeSupport

Advertisement

dotps1
Contributor
Joined:
Posts:
20
Location:
United States

No Constructor for WinSCP.TransferResumeSupport

I was working with the [WinSCP.TransferOptions] Class, i wanted to set the .ResumeSupport property. I see that that property should be of Type WinSCP.TransferResumeSupport. Which has two properties, State and Threshold, so this was my goal:
$resumeSupport = New-Object -TypeName WinSCP.TransferResumeSupport
$resumeSupport.State = 'On'
$resumeSupport.Threshold = 1000

$transferOptions = New-Object -TypeName WinSCP.TransferOptions
$transferOptions.ResumeSupport = $resumeSupport

However, for the first line i get the following error:
New-Object : A constructor was not found. Cannot find an appropriate constructor for type WinSCP.TransferResumeSupport.

I know this can be done:
$transferOptions = New-Object -TypeName WinSCP.TransferOptions
$transferOptions.ResumeSupport.State = 'On'
$transferOptions.ResumeSupport.Threshold = 1000
But i would like to be able to declare my TransferResumeSupport Object separately. Is there a reason there is no constructor for this object type?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: No Constructor for WinSCP.TransferResumeSupport

dotps1 wrote:

But i would like to be able to declare my TransferResumeSupport Object separately. Is there a reason there is no constructor for this object type?
The reason is that you do not need to declare the TransferResumeSupport object separately.
What do you need it for?

Reply with quote

dotps1
Contributor
Joined:
Posts:
20
Location:
United States

I guess i don't really 'Need' it per say. Its just that the WinSCP.TransferOptions.ResumeSupport takes an object of Type TransferResumeSupport, So i thought i should be able to create that object, set its properties, and then use it when configuring the WinSCP.TransferOptions Object.

https://github.com/tomohulk/WinSCP/issues/9

Reply with quote

lmo
Guest

There is a setter

#region Assembly WinSCPnet, Version=1.3.4.6885, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf
// G:\S\SingleServe\MAIN\Library\WinScp\WinSCPnet.dll
#endregion

using System.Runtime.InteropServices;

namespace WinSCP
{
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ComVisible(true)]
[Guid("155B841F-39D4-40C8-BA87-C79675E14CE3")]
public sealed class TransferOptions
{
public TransferOptions();

public string FileMask { get; set; }
public FilePermissions FilePermissions { get; set; }
public OverwriteMode OverwriteMode { get; set; }
public bool PreserveTimestamp { get; set; }
public TransferResumeSupport ResumeSupport { get; set; }
public int SpeedLimit { get; set; }
public TransferMode TransferMode { get; set; }
}
}

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: There is a setter

lmo wrote:

#region Assembly WinSCPnet, Version=1.3.4.6885, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf
// G:\S\SingleServe\MAIN\Library\WinScp\WinSCPnet.dll
#endregion

using System.Runtime.InteropServices;

namespace WinSCP
{
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ComVisible(true)]
[Guid("155B841F-39D4-40C8-BA87-C79675E14CE3")]
public sealed class TransferOptions
{
public TransferOptions();

public string FileMask { get; set; }
public FilePermissions FilePermissions { get; set; }
public OverwriteMode OverwriteMode { get; set; }
public bool PreserveTimestamp { get; set; }
public TransferResumeSupport ResumeSupport { get; set; }
public int SpeedLimit { get; set; }
public TransferMode TransferMode { get; set; }
}
}

Yes, but only since WinSCP 5.8.2. This thread is old and obsolete.

Reply with quote

Advertisement

You can post new topics in this forum