Added SetupMemXfer triplet.

This commit is contained in:
Eugene Wang
2018-11-18 11:28:55 -05:00
parent 6ccd370afc
commit daf7f384ac
2 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
using NTwain.Data;
using NTwain.Internals;
namespace NTwain.Triplets.Control
{
/// <summary>
/// Represents <see cref="DataArgumentType.SetupMemXfer"/>.
/// </summary>
public sealed class SetupMemXfer : BaseTriplet
{
internal SetupMemXfer(TwainSession session) : base(session) { }
/// <summary>
/// Returns the Sources preferred, minimum, and maximum allocation sizes for transfer memory
/// buffers.
/// </summary>
/// <param name="setupMemXfer">The setup mem xfer.</param>
/// <returns></returns>
public ReturnCode Get(ref TW_SETUPMEMXFER setupMemXfer)
{
if (Is32Bit)
{
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.SetupMemXfer, Message.Get, ref setupMemXfer);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.SetupMemXfer, Message.Get, ref setupMemXfer);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.SetupMemXfer, Message.Get, ref setupMemXfer);
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.SetupMemXfer, Message.Get, ref setupMemXfer);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.SetupMemXfer, Message.Get, ref setupMemXfer);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.SetupMemXfer, Message.Get, ref setupMemXfer);
return ReturnCode.Failure;
}
}
}

View File

@@ -57,6 +57,12 @@ namespace NTwain.Triplets
/// </summary>
public PassThru PassThru => _passThru ?? (_passThru = new PassThru(Session));
SetupMemXfer _memXfer;
/// <summary>
/// Gets the operations defined for DAT_SETUPMEMXFER.
/// </summary>
public SetupMemXfer SetupMemXfer => _memXfer ?? (_memXfer = new SetupMemXfer(Session));
XferGroup _xferGroup;
/// <summary>
/// Gets the operations defined for DAT_XFERGROUP.