mirror of
https://github.com/soukoku/ntwain.git
synced 2026-02-25 13:04:07 +08:00
Added xfergroup.
This commit is contained in:
@@ -74,5 +74,12 @@ namespace NTwain.DSM
|
||||
ref TW_IDENTITY_MACOSX origin, ref TW_IDENTITY_MACOSX dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CALLBACK2 twcallback
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
internal static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_MACOSX origin, ref TW_IDENTITY_MACOSX dest,
|
||||
DG dg, DAT dat, MSG msg, ref DG xfergroup
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,5 +74,12 @@ namespace NTwain.DSM
|
||||
ref TW_IDENTITY_MACOSX origin, ref TW_IDENTITY_MACOSX dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CALLBACK2 twcallback
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
internal static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_MACOSX origin, ref TW_IDENTITY_MACOSX dest,
|
||||
DG dg, DAT dat, MSG msg, ref DG xfergroup
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,5 +74,12 @@ namespace NTwain.DSM
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CALLBACK2 twcallback
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
internal static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref DG xfergroup
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,5 +74,12 @@ namespace NTwain.DSM
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref TW_CALLBACK2 twcallback
|
||||
);
|
||||
|
||||
[DllImport(DsmName, CharSet = CharSet.Ansi)]
|
||||
internal static extern ushort DSM_Entry
|
||||
(
|
||||
ref TW_IDENTITY_LEGACY origin, ref TW_IDENTITY_LEGACY dest,
|
||||
DG dg, DAT dat, MSG msg, ref DG xfergroup
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ namespace NTwain.Triplets.ControlDATs
|
||||
var ds = Session.CurrentSource;
|
||||
if (TwainPlatform.Is32bit && TwainPlatform.PreferLegacyDSM)
|
||||
{
|
||||
rc = (STS)WinLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data);
|
||||
rc = (STS)WinLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.CALLBACK, msg, ref data);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = (STS)WinNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data);
|
||||
rc = (STS)WinNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.CALLBACK, msg, ref data);
|
||||
}
|
||||
}
|
||||
else if (TwainPlatform.IsMacOSX)
|
||||
@@ -44,11 +44,11 @@ namespace NTwain.Triplets.ControlDATs
|
||||
TW_IDENTITY_MACOSX ds = Session.CurrentSource;
|
||||
if (TwainPlatform.PreferLegacyDSM)
|
||||
{
|
||||
rc = (STS)OSXLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data);
|
||||
rc = (STS)OSXLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.CALLBACK, msg, ref data);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = (STS)OSXNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data);
|
||||
rc = (STS)OSXNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.CALLBACK, msg, ref data);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
|
||||
@@ -31,11 +31,11 @@ namespace NTwain.Triplets.ControlDATs
|
||||
var ds = Session.CurrentSource;
|
||||
if (TwainPlatform.Is32bit && TwainPlatform.PreferLegacyDSM)
|
||||
{
|
||||
rc = (STS)WinLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data);
|
||||
rc = (STS)WinLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.CALLBACK2, msg, ref data);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = (STS)WinNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data);
|
||||
rc = (STS)WinNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.CALLBACK2, msg, ref data);
|
||||
}
|
||||
}
|
||||
else if (TwainPlatform.IsMacOSX)
|
||||
@@ -44,11 +44,11 @@ namespace NTwain.Triplets.ControlDATs
|
||||
TW_IDENTITY_MACOSX ds = Session.CurrentSource;
|
||||
if (TwainPlatform.PreferLegacyDSM)
|
||||
{
|
||||
rc = (STS)OSXLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data);
|
||||
rc = (STS)OSXLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.CALLBACK2, msg, ref data);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = (STS)OSXNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.DEVICEEVENT, msg, ref data);
|
||||
rc = (STS)OSXNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.CALLBACK2, msg, ref data);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
|
||||
68
src/NTwain/Triplets/ControlDATs/XferGroup.cs
Normal file
68
src/NTwain/Triplets/ControlDATs/XferGroup.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using NTwain.DSM;
|
||||
using TWAINWorkingGroup;
|
||||
|
||||
namespace NTwain.Triplets.ControlDATs
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains calls used with <see cref="DG.CONTROL"/> and <see cref="DAT.XFERGROUP"/>.
|
||||
/// </summary>
|
||||
public class XferGroup : TripletBase
|
||||
{
|
||||
public XferGroup(TwainSession session) : base(session)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the transfer group used.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public STS Get(out DG data)
|
||||
{
|
||||
data = default;
|
||||
return DoIt(MSG.GET, ref data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the transfer group to be used.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public STS Set(DG data)
|
||||
{
|
||||
return DoIt(MSG.SET, ref data);
|
||||
}
|
||||
|
||||
STS DoIt(MSG msg, ref DG data)
|
||||
{
|
||||
var rc = STS.FAILURE;
|
||||
if (TwainPlatform.IsWindows)
|
||||
{
|
||||
var app = Session.AppIdentity;
|
||||
var ds = Session.CurrentSource;
|
||||
if (TwainPlatform.Is32bit && TwainPlatform.PreferLegacyDSM)
|
||||
{
|
||||
rc = (STS)WinLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.XFERGROUP, msg, ref data);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = (STS)WinNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.XFERGROUP, msg, ref data);
|
||||
}
|
||||
}
|
||||
else if (TwainPlatform.IsMacOSX)
|
||||
{
|
||||
TW_IDENTITY_MACOSX app = Session.AppIdentity;
|
||||
TW_IDENTITY_MACOSX ds = Session.CurrentSource;
|
||||
if (TwainPlatform.PreferLegacyDSM)
|
||||
{
|
||||
rc = (STS)OSXLegacyDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.XFERGROUP, msg, ref data);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = (STS)OSXNewDSM.DSM_Entry(ref app, ref ds, DG.CONTROL, DAT.XFERGROUP, msg, ref data);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,5 +38,8 @@ namespace NTwain.Triplets
|
||||
private Callback2? _callback2;
|
||||
public Callback2 Callback2 => _callback2 ??= new Callback2(Session);
|
||||
|
||||
private XferGroup? _xferGroup;
|
||||
public XferGroup XferGroup => _xferGroup ??= new XferGroup(Session);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user