Topic "No Constructor for WinSCP.TransferResumeSupport"

Author Message
dotps1
[View user's profile]
Contributor
Joined: 2015-03-23
Posts: 15
Location: United States
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:
Code:

$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:
Code:

New-Object : A constructor was not found. Cannot find an appropriate constructor for type WinSCP.TransferResumeSupport.


I know this can be done:
Code:

$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?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26480
Location: Prague, Czechia
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?
dotps1
[View user's profile]
Contributor
Joined: 2015-03-23
Posts: 15
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/dotps1/WinSCP/issues/9
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26480
Location: Prague, Czechia
But the TransferOptions.ResumeSupport does not have a setter. It's a read-only property.
lmo

Guest


#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; }
}
}
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26480
Location: Prague, Czechia
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.
Advertisements

You can post new topics in this forum






Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License