mirror of
https://github.com/soukoku/ntwain.git
synced 2026-02-25 13:04:07 +08:00
Added twaindirect triplet.
This commit is contained in:
47
src/NTwain/Triplets/Control/TwainDirect.cs
Normal file
47
src/NTwain/Triplets/Control/TwainDirect.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using NTwain.Data;
|
||||||
|
using NTwain.Internals;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace NTwain.Triplets.Control
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents <see cref="DataArgumentType.TwainDirect"/>.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class TwainDirect : BaseTriplet
|
||||||
|
{
|
||||||
|
internal TwainDirect(TwainSession session) : base(session) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sends a TWAIN Direct task from the application to the driver.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="task"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ReturnCode SetTask(ref TW_TWAINDIRECT task)
|
||||||
|
{
|
||||||
|
if (Is32Bit)
|
||||||
|
{
|
||||||
|
if (IsWin)
|
||||||
|
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||||
|
DataGroups.Control, DataArgumentType.TwainDirect, Message.SetTask, ref task);
|
||||||
|
if (IsLinux)
|
||||||
|
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||||
|
DataGroups.Control, DataArgumentType.TwainDirect, Message.SetTask, ref task);
|
||||||
|
if (IsMac)
|
||||||
|
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||||
|
DataGroups.Control, DataArgumentType.TwainDirect, Message.SetTask, ref task);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsWin)
|
||||||
|
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||||
|
DataGroups.Control, DataArgumentType.TwainDirect, Message.SetTask, ref task);
|
||||||
|
if (IsLinux)
|
||||||
|
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||||
|
DataGroups.Control, DataArgumentType.TwainDirect, Message.SetTask, ref task);
|
||||||
|
if (IsMac)
|
||||||
|
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||||
|
DataGroups.Control, DataArgumentType.TwainDirect, Message.SetTask, ref task);
|
||||||
|
|
||||||
|
return ReturnCode.Failure;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -92,5 +92,11 @@ namespace NTwain.Triplets
|
|||||||
/// Gets the operations defined for DAT_METRICS.
|
/// Gets the operations defined for DAT_METRICS.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Metrics Metrics => _metrics ?? (_metrics = new Metrics(Session));
|
public Metrics Metrics => _metrics ?? (_metrics = new Metrics(Session));
|
||||||
|
|
||||||
|
TwainDirect _twDirect;
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the operations defined for DAT_TWAINDIRECT.
|
||||||
|
/// </summary>
|
||||||
|
public TwainDirect TwainDirect => _twDirect ?? (_twDirect = new TwainDirect(Session));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,5 +288,14 @@ namespace NTwain.Triplets
|
|||||||
Message msg,
|
Message msg,
|
||||||
ref TW_METRICS data);
|
ref TW_METRICS data);
|
||||||
|
|
||||||
|
[DllImport(LinuxDll, EntryPoint = EntryName)]
|
||||||
|
public static extern ReturnCode DsmLinux32(
|
||||||
|
[In, Out]TW_IDENTITY origin,
|
||||||
|
[In, Out]TW_IDENTITY destination,
|
||||||
|
DataGroups dg,
|
||||||
|
DataArgumentType dat,
|
||||||
|
Message msg,
|
||||||
|
ref TW_TWAINDIRECT data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,5 +288,14 @@ namespace NTwain.Triplets
|
|||||||
Message msg,
|
Message msg,
|
||||||
ref TW_METRICS data);
|
ref TW_METRICS data);
|
||||||
|
|
||||||
|
[DllImport(LinuxDll, EntryPoint = EntryName)]
|
||||||
|
public static extern ReturnCode DsmLinux64(
|
||||||
|
[In, Out]TW_IDENTITY origin,
|
||||||
|
[In, Out]TW_IDENTITY destination,
|
||||||
|
DataGroups dg,
|
||||||
|
DataArgumentType dat,
|
||||||
|
Message msg,
|
||||||
|
ref TW_TWAINDIRECT data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,5 +288,14 @@ namespace NTwain.Triplets
|
|||||||
Message msg,
|
Message msg,
|
||||||
ref TW_METRICS data);
|
ref TW_METRICS data);
|
||||||
|
|
||||||
|
[DllImport(Mac32Dll, EntryPoint = EntryName)]
|
||||||
|
public static extern ReturnCode DsmMac32(
|
||||||
|
[In, Out]TW_IDENTITY origin,
|
||||||
|
[In, Out]TW_IDENTITY destination,
|
||||||
|
DataGroups dg,
|
||||||
|
DataArgumentType dat,
|
||||||
|
Message msg,
|
||||||
|
ref TW_TWAINDIRECT data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,5 +288,14 @@ namespace NTwain.Triplets
|
|||||||
Message msg,
|
Message msg,
|
||||||
ref TW_METRICS data);
|
ref TW_METRICS data);
|
||||||
|
|
||||||
|
[DllImport(Mac64Dll, EntryPoint = EntryName)]
|
||||||
|
public static extern ReturnCode DsmMac64(
|
||||||
|
[In, Out]TW_IDENTITY origin,
|
||||||
|
[In, Out]TW_IDENTITY destination,
|
||||||
|
DataGroups dg,
|
||||||
|
DataArgumentType dat,
|
||||||
|
Message msg,
|
||||||
|
ref TW_TWAINDIRECT data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,5 +288,14 @@ namespace NTwain.Triplets
|
|||||||
Message msg,
|
Message msg,
|
||||||
ref TW_METRICS data);
|
ref TW_METRICS data);
|
||||||
|
|
||||||
|
[DllImport(WinDll, EntryPoint = EntryName)]
|
||||||
|
public static extern ReturnCode DsmWin32(
|
||||||
|
[In, Out]TW_IDENTITY origin,
|
||||||
|
[In, Out]TW_IDENTITY destination,
|
||||||
|
DataGroups dg,
|
||||||
|
DataArgumentType dat,
|
||||||
|
Message msg,
|
||||||
|
ref TW_TWAINDIRECT data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,5 +288,14 @@ namespace NTwain.Triplets
|
|||||||
Message msg,
|
Message msg,
|
||||||
ref TW_METRICS data);
|
ref TW_METRICS data);
|
||||||
|
|
||||||
|
[DllImport(WinDll, EntryPoint = EntryName)]
|
||||||
|
public static extern ReturnCode DsmWin64(
|
||||||
|
[In, Out]TW_IDENTITY origin,
|
||||||
|
[In, Out]TW_IDENTITY destination,
|
||||||
|
DataGroups dg,
|
||||||
|
DataArgumentType dat,
|
||||||
|
Message msg,
|
||||||
|
ref TW_TWAINDIRECT data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user