Added placeholder methods for all to be supported archtectures.

This commit is contained in:
Eugene Wang
2018-11-17 10:55:37 -05:00
parent a73df1320f
commit 12d74b88f5
23 changed files with 1875 additions and 175 deletions

View File

@@ -4,11 +4,12 @@
This is a library created to make working with This is a library created to make working with
[TWAIN](http://twain.org/) easier in dotnet. [TWAIN](http://twain.org/) easier in dotnet.
This project has these features/goals: This project has these goals:
* Targets latest TWAIN version (2.4 as of this writing) * Targets latest TWAIN version (2.4 as of this writing)
* Supports all the TWAIN functions in the spec (may never happen but will be close). * Supports all the TWAIN functions in the spec
* Works with both 32 and 64 bit data sources (eventually) * Works with both 32 and 64 bit data sources
* Works on non-Windows platforms using dotnet core or mono (maybe)
## Using the lib ## Using the lib

View File

@@ -14,7 +14,7 @@ namespace ConsoleApp
.DefineApp(Assembly.GetExecutingAssembly()) .DefineApp(Assembly.GetExecutingAssembly())
.Build(); .Build();
Console.WriteLine($"App = {(config.Is64Bit ? "64bit" : "32bit")}"); Console.WriteLine($"App = {(config.Is32Bit ? "32bit" : "64bit")}");
Console.WriteLine($"Platform = {config.Platform}"); Console.WriteLine($"Platform = {config.Platform}");
Console.WriteLine(); Console.WriteLine();

View File

@@ -12,27 +12,27 @@ namespace NTwain
/// <summary> /// <summary>
/// Gets the source name. /// Gets the source name.
/// </summary> /// </summary>
public string Name => Identity.ProductName; public string Name => Identity32.ProductName;
/// <summary> /// <summary>
/// Gets the source's manufacturer name. /// Gets the source's manufacturer name.
/// </summary> /// </summary>
public string Manufacturer => Identity.Manufacturer; public string Manufacturer => Identity32.Manufacturer;
/// <summary> /// <summary>
/// Gets the source's product family. /// Gets the source's product family.
/// </summary> /// </summary>
public string ProductFamily => Identity.ProductFamily; public string ProductFamily => Identity32.ProductFamily;
/// <summary> /// <summary>
/// Gets the source's version info. /// Gets the source's version info.
/// </summary> /// </summary>
public TW_VERSION Version => Identity.Version; public TW_VERSION Version => Identity32.Version;
/// <summary> /// <summary>
/// Gets the supported data group. /// Gets the supported data group.
/// </summary> /// </summary>
public DataGroups DataGroup => Identity.DataGroup; public DataGroups DataGroup => Identity32.DataGroup;
/// <summary> /// <summary>
/// Gets the supported TWAIN protocol version. /// Gets the supported TWAIN protocol version.

View File

@@ -13,12 +13,12 @@ namespace NTwain
{ {
internal readonly TwainSession Session; internal readonly TwainSession Session;
internal TW_IDENTITY Identity { get; } internal TW_IDENTITY Identity32 { get; }
internal DataSource(TwainSession session, TW_IDENTITY src) internal DataSource(TwainSession session, TW_IDENTITY src)
{ {
this.Session = session; this.Session = session;
this.Identity = src; this.Identity32 = src;
ProtocolVersion = new Version(src.ProtocolMajor, src.ProtocolMinor); ProtocolVersion = new Version(src.ProtocolMajor, src.ProtocolMinor);
} }
@@ -26,13 +26,13 @@ namespace NTwain
/// Opens the source for capability negotiation. /// Opens the source for capability negotiation.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public ReturnCode Open() => Session.DGControl.Identity.OpenDS(Identity); public ReturnCode Open() => Session.DGControl.Identity.OpenDS(Identity32);
/// <summary> /// <summary>
/// Closes the source. /// Closes the source.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public ReturnCode Close() => Session.DGControl.Identity.CloseDS(Identity); public ReturnCode Close() => Session.DGControl.Identity.CloseDS(Identity32);
/// <summary> /// <summary>
@@ -42,7 +42,7 @@ namespace NTwain
public TW_STATUS GetStatus() public TW_STATUS GetStatus()
{ {
TW_STATUS stat = default; TW_STATUS stat = default;
var rc = Session.DGControl.Status.GetSourceStatus(ref stat); var rc = Session.DGControl.Status.Get(ref stat, this);
return stat; return stat;
} }

View File

@@ -21,14 +21,26 @@ namespace NTwain.Triplets
{ {
this.Session = session ?? throw new ArgumentNullException(nameof(session)); this.Session = session ?? throw new ArgumentNullException(nameof(session));
// windows can always use 32bit structs even in 64bit app Is32Bit = session.Config.Is32Bit;
Use32BitData = session.Config.Platform == System.PlatformID.Win32NT || IsWin = session.Config.Platform == System.PlatformID.Win32NT;
!session.Config.Is64Bit; IsLinux = session.Config.Platform == System.PlatformID.Unix;
IsMac = session.Config.Platform == System.PlatformID.MacOSX;
} }
/// <summary> /// <summary>
/// Whether to use 32bit data structures. /// Whether to use 32bit data structures.
/// </summary> /// </summary>
protected readonly bool Use32BitData; protected readonly bool Is32Bit;
/// <summary>
/// Whether platform is Windows.
/// </summary>
protected readonly bool IsWin;
/// <summary>
/// Whether platform is Linux.
/// </summary>
protected readonly bool IsLinux;
/// Whether platform is MacOS.
protected readonly bool IsMac;
} }
} }

View File

@@ -9,11 +9,29 @@ namespace NTwain.Triplets.Control
public ReturnCode RegisterCallback(ref TW_CALLBACK callback) public ReturnCode RegisterCallback(ref TW_CALLBACK callback)
{ {
if (Use32BitData) if (Is32Bit)
{ {
return NativeMethods.Dsm32(Session.Config.App32, Session.CurrentSource.Identity, if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback); DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback);
} }
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback, Message.RegisterCallback, ref callback);
return ReturnCode.Failure; return ReturnCode.Failure;
} }
} }

View File

@@ -7,13 +7,31 @@ namespace NTwain.Triplets.Control
{ {
internal Callback2(TwainSession session) : base(session) { } internal Callback2(TwainSession session) : base(session) { }
public ReturnCode RegisterCallback(ref TW_CALLBACK2 callback) public ReturnCode RegisterCallback(ref TW_CALLBACK2 callback2)
{ {
if (Use32BitData) if (Is32Bit)
{ {
return NativeMethods.Dsm32(Session.Config.App32, Session.CurrentSource.Identity, if (IsWin)
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback); return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback2);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback2);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback2);
} }
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback2);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback2);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.Callback2, Message.RegisterCallback, ref callback2);
return ReturnCode.Failure; return ReturnCode.Failure;
} }
} }

View File

@@ -7,13 +7,31 @@ namespace NTwain.Triplets.Control
{ {
internal DeviceEvent(TwainSession session) : base(session) { } internal DeviceEvent(TwainSession session) : base(session) { }
public ReturnCode Get(ref TW_DEVICEEVENT sourceDeviceEvent) public ReturnCode Get(ref TW_DEVICEEVENT evt)
{ {
if (Use32BitData) if (Is32Bit)
{ {
return NativeMethods.Dsm32(Session.Config.App32, Session.CurrentSource.Identity, if (IsWin)
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref sourceDeviceEvent); return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref evt);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref evt);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref evt);
} }
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref evt);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref evt);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get, ref evt);
return ReturnCode.Failure; return ReturnCode.Failure;
} }
} }

View File

@@ -10,14 +10,32 @@ namespace NTwain.Triplets.Control
{ {
internal EntryPoint(TwainSession session) : base(session) { } internal EntryPoint(TwainSession session) : base(session) { }
public ReturnCode Get(out TW_ENTRYPOINT entryPoint) public ReturnCode Get(out TW_ENTRYPOINT entry)
{ {
entryPoint = new TW_ENTRYPOINT(); entry = new TW_ENTRYPOINT();
if (Use32BitData) if (Is32Bit)
{ {
return NativeMethods.Dsm32(Session.Config.App32, null, if (IsWin)
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entryPoint); return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entry);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entry);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entry);
} }
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entry);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entry);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.EntryPoint, Message.Get, entry);
return ReturnCode.Failure; return ReturnCode.Failure;
} }
} }

View File

@@ -12,9 +12,28 @@ namespace NTwain.Triplets.Control
{ {
var rc = ReturnCode.Failure; var rc = ReturnCode.Failure;
if (Use32BitData) if (Is32Bit)
{ {
rc = NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero, if (IsWin)
rc = NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
else if (IsLinux)
rc = NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
else if (IsMac)
rc = NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
}
else
{
if (IsWin)
rc = NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
else if (IsLinux)
rc = NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
else if (IsMac)
rc = NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source); DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
} }
@@ -26,44 +45,33 @@ namespace NTwain.Triplets.Control
return rc; return rc;
} }
public ReturnCode GetDefault(out TW_IDENTITY source)
{
source = new TW_IDENTITY();
if (Use32BitData)
{
return NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
}
return ReturnCode.Failure;
}
public ReturnCode GetFirst(out TW_IDENTITY source)
{
source = new TW_IDENTITY();
if (Use32BitData)
{
return NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
}
return ReturnCode.Failure;
}
public ReturnCode GetNext(out TW_IDENTITY source)
{
source = new TW_IDENTITY();
return NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
}
public ReturnCode OpenDS(TW_IDENTITY source) public ReturnCode OpenDS(TW_IDENTITY source)
{ {
Session.StepDown(TwainState.DsmOpened); Session.StepDown(TwainState.DsmOpened);
var rc = ReturnCode.Failure; var rc = ReturnCode.Failure;
if (Use32BitData) if (Is32Bit)
{ {
rc = NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero, if (IsWin)
rc = NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
else if (IsLinux)
rc = NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
else if (IsMac)
rc = NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
}
else
{
if (IsWin)
rc = NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
else if (IsLinux)
rc = NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
else if (IsMac)
rc = NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source); DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
} }
@@ -76,24 +84,147 @@ namespace NTwain.Triplets.Control
return rc; return rc;
} }
public ReturnCode GetDefault(out TW_IDENTITY source)
{
source = new TW_IDENTITY();
if (Is32Bit)
{
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
return ReturnCode.Failure;
}
public ReturnCode GetFirst(out TW_IDENTITY source)
{
source = new TW_IDENTITY();
if (Is32Bit)
{
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
return ReturnCode.Failure;
}
public ReturnCode GetNext(out TW_IDENTITY source)
{
source = new TW_IDENTITY();
if (Is32Bit)
{
if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
}
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
return ReturnCode.Failure;
}
public ReturnCode Set(DataSource source) public ReturnCode Set(DataSource source)
{ {
if (Use32BitData) if (Is32Bit)
{ {
return NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero, if (IsWin)
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity); return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
} }
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
return ReturnCode.Failure; return ReturnCode.Failure;
} }
public ReturnCode UserSelect(out TW_IDENTITY source) public ReturnCode UserSelect(out TW_IDENTITY source)
{ {
source = new TW_IDENTITY(); source = new TW_IDENTITY();
if (Use32BitData) if (Is32Bit)
{ {
return NativeMethods.Dsm32(Session.Config.App32, IntPtr.Zero, if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source); DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
} }
if (IsWin)
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
return ReturnCode.Failure; return ReturnCode.Failure;
} }
} }

View File

@@ -16,10 +16,32 @@ namespace NTwain.Triplets.Control
bool isDsm2 = false; bool isDsm2 = false;
if (Use32BitData) if (Is32Bit)
{ {
rc = NativeMethods.Dsm32(Session.Config.App32, null, if (IsWin)
DataGroups.Control, DataArgumentType.Parent, Message.OpenDSM, ref hWnd); rc = NativeMethods.DsmWin32(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.OpenDSM, ref hWnd);
else if (IsLinux)
rc = NativeMethods.DsmLinux32(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.OpenDSM, ref hWnd);
else if (IsMac)
rc = NativeMethods.DsmMac32(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.OpenDSM, ref hWnd);
isDsm2 = rc == ReturnCode.Success &&
(Session.Config.App32.DataFlags & DataFlags.DSM2) == DataFlags.DSM2;
}
else
{
if (IsWin)
rc = NativeMethods.DsmWin64(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.OpenDSM, ref hWnd);
else if (IsLinux)
rc = NativeMethods.DsmLinux64(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.OpenDSM, ref hWnd);
else if (IsMac)
rc = NativeMethods.DsmMac64(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.OpenDSM, ref hWnd);
isDsm2 = rc == ReturnCode.Success && isDsm2 = rc == ReturnCode.Success &&
(Session.Config.App32.DataFlags & DataFlags.DSM2) == DataFlags.DSM2; (Session.Config.App32.DataFlags & DataFlags.DSM2) == DataFlags.DSM2;
@@ -45,9 +67,28 @@ namespace NTwain.Triplets.Control
{ {
var rc = ReturnCode.Failure; var rc = ReturnCode.Failure;
if (Use32BitData) if (Is32Bit)
{ {
rc = NativeMethods.Dsm32(Session.Config.App32, null, DataGroups.Control, if (IsWin)
rc = NativeMethods.DsmWin32(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.CloseDSM, ref hWnd);
else if (IsLinux)
rc = NativeMethods.DsmLinux32(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.CloseDSM, ref hWnd);
else if (IsMac)
rc = NativeMethods.DsmMac32(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.CloseDSM, ref hWnd);
}
else
{
if (IsWin)
rc = NativeMethods.DsmWin64(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.CloseDSM, ref hWnd);
else if (IsLinux)
rc = NativeMethods.DsmLinux64(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.CloseDSM, ref hWnd);
else if (IsMac)
rc = NativeMethods.DsmMac64(Session.Config.App32, null, DataGroups.Control,
DataArgumentType.Parent, Message.CloseDSM, ref hWnd); DataArgumentType.Parent, Message.CloseDSM, ref hWnd);
} }

View File

@@ -7,23 +7,30 @@ namespace NTwain.Triplets.Control
{ {
internal Status(TwainSession session) : base(session) { } internal Status(TwainSession session) : base(session) { }
public ReturnCode GetManagerStatus(ref TW_STATUS status) public ReturnCode Get(ref TW_STATUS status, DataSource source)
{ {
if (Use32BitData) if (Is32Bit)
{ {
return NativeMethods.Dsm32(Session.Config.App32, null, if (IsWin)
return NativeMethods.DsmWin32(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
if (IsLinux)
return NativeMethods.DsmLinux32(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
if (IsMac)
return NativeMethods.DsmMac32(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status); DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
} }
return ReturnCode.Failure; if (IsWin)
} return NativeMethods.DsmWin64(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
if (IsLinux)
return NativeMethods.DsmLinux64(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
if (IsMac)
return NativeMethods.DsmMac64(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
public ReturnCode GetSourceStatus(ref TW_STATUS status)
{
if (Use32BitData)
{
return NativeMethods.Dsm32(Session.Config.App32, Session.CurrentSource.Identity,
DataGroups.Control, DataArgumentType.Status, Message.Get, ref status);
}
return ReturnCode.Failure; return ReturnCode.Failure;
} }
} }

View File

@@ -10,15 +10,34 @@ namespace NTwain.Triplets.Control
{ {
internal StatusUtf8(TwainSession session) : base(session) { } internal StatusUtf8(TwainSession session) : base(session) { }
public ReturnCode Get(ref TW_STATUS status, out string message) public ReturnCode Get(ref TW_STATUS status, DataSource source, out string message)
{ {
message = null; message = null;
var rc = ReturnCode.Failure; var rc = ReturnCode.Failure;
TW_STATUSUTF8 real = new TW_STATUSUTF8 { Status = status }; TW_STATUSUTF8 real = new TW_STATUSUTF8 { Status = status };
if (Use32BitData) if (Is32Bit)
{ {
rc = NativeMethods.Dsm32(Session.Config.App32, Session.CurrentSource?.Identity, if (IsWin)
rc = NativeMethods.DsmWin32(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real);
else if (IsLinux)
rc = NativeMethods.DsmLinux32(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real);
else if (IsMac)
rc = NativeMethods.DsmMac32(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real);
}
else
{
if (IsWin)
rc = NativeMethods.DsmWin64(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real);
else if (IsLinux)
rc = NativeMethods.DsmLinux64(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real);
else if (IsMac)
rc = NativeMethods.DsmMac64(Session.Config.App32, source?.Identity32,
DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real); DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get, ref real);
} }

View File

@@ -0,0 +1,283 @@
using NTwain.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace NTwain.Triplets
{
static partial class NativeMethods
{
[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 IntPtr 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 DataGroups 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_AUDIOINFO data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmLinux32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWCapability 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_CUSTOMDSDATA 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_DEVICEEVENT 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_CALLBACK 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_CALLBACK2 data);
[DllImport(LinuxDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmLinux32(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_ENTRYPOINT 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_EVENT 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_FILESYSTEM data);
[DllImport(LinuxDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmLinux32(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_IDENTITY 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_PASSTHRU 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_PENDINGXFERS 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_SETUPFILEXFER 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_SETUPMEMXFER 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_STATUSUTF8 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_USERINTERFACE 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_CIECOLOR 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_EXTIMAGEINFO 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_FILTER data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmLinux32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWGrayResponse 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_IMAGEINFO 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_IMAGELAYOUT 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_IMAGEMEMXFER 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_JPEGCOMPRESSION 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_PALETTE8 data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmLinux32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWRgbResponse 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_STATUS 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_MEMORY data);
}
}

View File

@@ -0,0 +1,283 @@
using NTwain.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace NTwain.Triplets
{
static partial class NativeMethods
{
[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 IntPtr 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 DataGroups 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_AUDIOINFO data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmLinux64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWCapability 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_CUSTOMDSDATA 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_DEVICEEVENT 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_CALLBACK 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_CALLBACK2 data);
[DllImport(LinuxDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmLinux64(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_ENTRYPOINT 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_EVENT 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_FILESYSTEM data);
[DllImport(LinuxDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmLinux64(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_IDENTITY 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_PASSTHRU 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_PENDINGXFERS 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_SETUPFILEXFER 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_SETUPMEMXFER 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_STATUSUTF8 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_USERINTERFACE 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_CIECOLOR 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_EXTIMAGEINFO 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_FILTER data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmLinux64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWGrayResponse 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_IMAGEINFO 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_IMAGELAYOUT 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_IMAGEMEMXFER 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_JPEGCOMPRESSION 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_PALETTE8 data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmLinux64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWRgbResponse 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_STATUS 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_MEMORY data);
}
}

View File

@@ -0,0 +1,283 @@
using NTwain.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace NTwain.Triplets
{
static partial class NativeMethods
{
[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 IntPtr 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 DataGroups 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_AUDIOINFO data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmMac32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWCapability 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_CUSTOMDSDATA 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_DEVICEEVENT 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_CALLBACK 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_CALLBACK2 data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac32(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_ENTRYPOINT 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_EVENT 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_FILESYSTEM data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac32(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_IDENTITY 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_PASSTHRU 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_PENDINGXFERS 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_SETUPFILEXFER 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_SETUPMEMXFER 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_STATUSUTF8 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_USERINTERFACE 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_CIECOLOR 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_EXTIMAGEINFO 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_FILTER data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmMac32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWGrayResponse 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_IMAGEINFO 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_IMAGELAYOUT 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_IMAGEMEMXFER 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_JPEGCOMPRESSION 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_PALETTE8 data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmMac32(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWRgbResponse 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_STATUS 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_MEMORY data);
}
}

View File

@@ -0,0 +1,283 @@
using NTwain.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace NTwain.Triplets
{
static partial class NativeMethods
{
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref IntPtr data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref DataGroups data);
[DllImport(Mac32Dll, 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_AUDIOINFO data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmMac64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWCapability data);
[DllImport(Mac32Dll, 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_CUSTOMDSDATA data);
[DllImport(Mac32Dll, 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_DEVICEEVENT data);
[DllImport(Mac32Dll, 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_CALLBACK data);
[DllImport(Mac32Dll, 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_CALLBACK2 data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_ENTRYPOINT data);
[DllImport(Mac32Dll, 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_EVENT data);
[DllImport(Mac32Dll, 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_FILESYSTEM data);
[DllImport(Mac32Dll, EntryPoint = EntryName)]
public static extern ReturnCode DsmMac64(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_IDENTITY data);
[DllImport(Mac32Dll, 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_PASSTHRU data);
[DllImport(Mac32Dll, 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_PENDINGXFERS data);
[DllImport(Mac32Dll, 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_SETUPFILEXFER data);
[DllImport(Mac32Dll, 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_SETUPMEMXFER data);
[DllImport(Mac32Dll, 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_STATUSUTF8 data);
[DllImport(Mac32Dll, 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_USERINTERFACE data);
[DllImport(Mac32Dll, 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_CIECOLOR data);
[DllImport(Mac32Dll, 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_EXTIMAGEINFO data);
[DllImport(Mac32Dll, 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_FILTER data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmMac64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWGrayResponse data);
[DllImport(Mac32Dll, 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_IMAGEINFO data);
[DllImport(Mac32Dll, 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_IMAGELAYOUT data);
[DllImport(Mac32Dll, 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_IMAGEMEMXFER data);
[DllImport(Mac32Dll, 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_JPEGCOMPRESSION data);
[DllImport(Mac32Dll, 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_PALETTE8 data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmMac64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWRgbResponse data);
[DllImport(Mac32Dll, 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_STATUS data);
[DllImport(Mac32Dll, 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_MEMORY data);
}
}

View File

@@ -9,8 +9,8 @@ namespace NTwain.Triplets
{ {
static partial class NativeMethods static partial class NativeMethods
{ {
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -18,8 +18,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref IntPtr data); ref IntPtr data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -27,8 +27,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref DataGroups data); ref DataGroups data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -37,7 +37,7 @@ namespace NTwain.Triplets
ref TW_AUDIOINFO data); ref TW_AUDIOINFO data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)] //[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode Dsm32( //public static extern ReturnCode DsmWin32(
// [In, Out]TW_IDENTITY origin, // [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination, // [In, Out]TW_IDENTITY destination,
// DataGroups dg, // DataGroups dg,
@@ -45,8 +45,8 @@ namespace NTwain.Triplets
// Message msg, // Message msg,
// ref TWCapability data); // ref TWCapability data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -54,8 +54,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_CUSTOMDSDATA data); ref TW_CUSTOMDSDATA data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -63,8 +63,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_DEVICEEVENT data); ref TW_DEVICEEVENT data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -72,8 +72,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_CALLBACK data); ref TW_CALLBACK data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -81,17 +81,17 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_CALLBACK2 data); ref TW_CALLBACK2 data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, IntPtr zero,
DataGroups dg, DataGroups dg,
DataArgumentType dat, DataArgumentType dat,
Message msg, Message msg,
[In, Out]TW_ENTRYPOINT data); [In, Out]TW_ENTRYPOINT data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -99,8 +99,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_EVENT data); ref TW_EVENT data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -108,8 +108,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_FILESYSTEM data); ref TW_FILESYSTEM data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
IntPtr zero, IntPtr zero,
DataGroups dg, DataGroups dg,
@@ -117,8 +117,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TW_IDENTITY data); [In, Out]TW_IDENTITY data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -126,8 +126,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_PASSTHRU data); ref TW_PASSTHRU data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -135,8 +135,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_PENDINGXFERS data); ref TW_PENDINGXFERS data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -144,8 +144,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_SETUPFILEXFER data); ref TW_SETUPFILEXFER data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -153,8 +153,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_SETUPMEMXFER data); ref TW_SETUPMEMXFER data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -162,8 +162,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_STATUSUTF8 data); ref TW_STATUSUTF8 data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -171,8 +171,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_USERINTERFACE data); ref TW_USERINTERFACE data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -180,8 +180,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_CIECOLOR data); ref TW_CIECOLOR data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -189,8 +189,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_EXTIMAGEINFO data); ref TW_EXTIMAGEINFO data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -199,7 +199,7 @@ namespace NTwain.Triplets
ref TW_FILTER data); ref TW_FILTER data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)] //[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode Dsm32( //public static extern ReturnCode DsmWin32(
// [In, Out]TW_IDENTITY origin, // [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination, // [In, Out]TW_IDENTITY destination,
// DataGroups dg, // DataGroups dg,
@@ -207,8 +207,8 @@ namespace NTwain.Triplets
// Message msg, // Message msg,
// ref TWGrayResponse data); // ref TWGrayResponse data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -216,8 +216,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_IMAGEINFO data); ref TW_IMAGEINFO data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -225,8 +225,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_IMAGELAYOUT data); ref TW_IMAGELAYOUT data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -234,8 +234,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_IMAGEMEMXFER data); ref TW_IMAGEMEMXFER data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -243,8 +243,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_JPEGCOMPRESSION data); ref TW_JPEGCOMPRESSION data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -253,7 +253,7 @@ namespace NTwain.Triplets
ref TW_PALETTE8 data); ref TW_PALETTE8 data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)] //[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode Dsm32( //public static extern ReturnCode DsmWin32(
// [In, Out]TW_IDENTITY origin, // [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination, // [In, Out]TW_IDENTITY destination,
// DataGroups dg, // DataGroups dg,
@@ -261,8 +261,8 @@ namespace NTwain.Triplets
// Message msg, // Message msg,
// ref TWRgbResponse data); // ref TWRgbResponse data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,
@@ -270,8 +270,8 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TW_STATUS data); ref TW_STATUS data);
[DllImport(WinDsmDll, EntryPoint = EntryName)] [DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode Dsm32( public static extern ReturnCode DsmWin32(
[In, Out]TW_IDENTITY origin, [In, Out]TW_IDENTITY origin,
[In, Out]TW_IDENTITY destination, [In, Out]TW_IDENTITY destination,
DataGroups dg, DataGroups dg,

View File

@@ -0,0 +1,283 @@
using NTwain.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace NTwain.Triplets
{
static partial class NativeMethods
{
[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 IntPtr 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 DataGroups 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_AUDIOINFO data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmWin64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWCapability 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_CUSTOMDSDATA 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_DEVICEEVENT 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_CALLBACK 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_CALLBACK2 data);
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin64(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_ENTRYPOINT 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_EVENT 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_FILESYSTEM data);
[DllImport(WinDll, EntryPoint = EntryName)]
public static extern ReturnCode DsmWin64(
[In, Out]TW_IDENTITY origin,
IntPtr zero,
DataGroups dg,
DataArgumentType dat,
Message msg,
[In, Out]TW_IDENTITY 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_PASSTHRU 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_PENDINGXFERS 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_SETUPFILEXFER 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_SETUPMEMXFER 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_STATUSUTF8 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_USERINTERFACE 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_CIECOLOR 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_EXTIMAGEINFO 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_FILTER data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmWin64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWGrayResponse 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_IMAGEINFO 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_IMAGELAYOUT 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_IMAGEMEMXFER 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_JPEGCOMPRESSION 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_PALETTE8 data);
//[DllImport(DSM.WinDsmDll, EntryPoint = DSM.EntryName)]
//public static extern ReturnCode DsmWin64(
// [In, Out]TW_IDENTITY origin,
// [In, Out]TW_IDENTITY destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWRgbResponse 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_STATUS 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_MEMORY data);
}
}

View File

@@ -10,9 +10,10 @@ namespace NTwain.Triplets
{ {
const string EntryName = "DSM_Entry"; const string EntryName = "DSM_Entry";
const string WinDsmDll = "twaindsm.dll"; const string WinDll = "twaindsm.dll";
const string LinuxDsmDll = "/usr/local/lib/libtwaindsm.so"; const string LinuxDll = "/usr/local/lib/libtwaindsm.so";
const string MacDsmDll = "/Library/Frameworks/TWAINDSM.framework/TWAINDSM"; const string Mac32Dll = "/System/Library/Frameworks/TWAIN.framework/TWAIN";
const string Mac64Dll = "/Library/Frameworks/TWAINDSM.framework/TWAINDSM";
} }
} }

View File

@@ -17,9 +17,9 @@ namespace NTwain
internal TwainConfig() { } internal TwainConfig() { }
/// <summary> /// <summary>
/// Gets whether the app is running in 64bit. /// Gets whether the app is running in 32bit.
/// </summary> /// </summary>
public bool Is64Bit { get; internal set; } public bool Is32Bit { get; internal set; }
/// <summary> /// <summary>
/// Gets the platform the app is running on. /// Gets the platform the app is running on.

View File

@@ -17,7 +17,7 @@ namespace NTwain
private string _companyName; private string _companyName;
private Language _lang; private Language _lang;
private DataGroups _dg = DataGroups.Image; private DataGroups _dg = DataGroups.Image;
private bool _64bit; private bool _32bit;
private PlatformID _platform; private PlatformID _platform;
private Country _country; private Country _country;
@@ -26,7 +26,7 @@ namespace NTwain
/// </summary> /// </summary>
public TwainConfigBuilder() public TwainConfigBuilder()
{ {
_64bit = IntPtr.Size == 8; _32bit = IntPtr.Size == 4;
_platform = Environment.OSVersion.Platform; _platform = Environment.OSVersion.Platform;
} }
@@ -108,7 +108,7 @@ namespace NTwain
var config = new TwainConfig var config = new TwainConfig
{ {
Platform = _platform, Platform = _platform,
Is64Bit = _64bit Is32Bit = _32bit
}; };
// todo: change id based on platform // todo: change id based on platform

View File

@@ -74,7 +74,7 @@ namespace NTwain
if (rc != ReturnCode.Success) return rc; if (rc != ReturnCode.Success) return rc;
break; break;
case TwainState.SourceOpened: case TwainState.SourceOpened:
rc = DGControl.Identity.CloseDS(CurrentSource.Identity); rc = DGControl.Identity.CloseDS(CurrentSource.Identity32);
if (rc != ReturnCode.Success) return rc; if (rc != ReturnCode.Success) return rc;
break; break;
} }
@@ -89,7 +89,7 @@ namespace NTwain
public TW_STATUS GetStatus() public TW_STATUS GetStatus()
{ {
TW_STATUS stat = default; TW_STATUS stat = default;
var rc = DGControl.Status.GetManagerStatus(ref stat); var rc = DGControl.Status.Get(ref stat, null);
return stat; return stat;
} }
@@ -97,10 +97,11 @@ namespace NTwain
/// Gets the translated string for a <see cref="TW_STATUS"/>. /// Gets the translated string for a <see cref="TW_STATUS"/>.
/// </summary> /// </summary>
/// <param name="status"></param> /// <param name="status"></param>
/// <param name="source"></param>
/// <returns></returns> /// <returns></returns>
public string GetLocalizedStatus(ref TW_STATUS status) public string GetLocalizedStatus(ref TW_STATUS status, DataSource source = null)
{ {
var rc = DGControl.StatusUtf8.Get(ref status, out string message); var rc = DGControl.StatusUtf8.Get(ref status, source, out string message);
return message; return message;
} }