mirror of
https://github.com/soukoku/ntwain.git
synced 2025-09-19 01:57:56 +08:00
Added SetupMemXfer triplet.
This commit is contained in:
47
src/NTwain/Triplets/Control/SetupMemXfer.cs
Normal file
47
src/NTwain/Triplets/Control/SetupMemXfer.cs
Normal 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 Source’s 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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -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.
|
||||
|
Reference in New Issue
Block a user