Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

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.
lmo

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; }
}
}
martin

But the TransferOptions.ResumeSupport does not have a setter. It's a read-only property.
dotps1

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
martin

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?
dotps1

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?