Some non-functional change updates.

This commit is contained in:
soukoku
2014-09-11 21:14:41 -04:00
parent 669de30345
commit 9415d5d43d
17 changed files with 172 additions and 140 deletions

View File

@@ -2,32 +2,33 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using TW_BOOL = System.UInt16; // unsigned short
// The following TWAIN basic types are mapped with "using" // The following TWAIN basic types are mapped with "using"
// to aid in mapping against the twain.h file using copy-paste. // to aid in mapping against the twain.h file using copy-paste.
// Consumers will not see those names. // Consumers will not see those names.
using TW_BOOL = System.UInt16; // unsigned short
// use HandleRef instead? // use HandleRef instead?
using TW_HANDLE = System.IntPtr; // HANDLE, todo: should really be uintptr? using TW_HANDLE = System.IntPtr; // HANDLE, todo: should really be uintptr?
using TW_MEMREF = System.IntPtr; // LPVOID
using TW_UINTPTR = System.UIntPtr; // UINT_PTR
using TW_INT16 = System.Int16; // short using TW_INT16 = System.Int16; // short
using TW_INT32 = System.Int32; // long using TW_INT32 = System.Int32; // long
using TW_INT8 = System.SByte; // char using TW_INT8 = System.SByte; // char
using TW_MEMREF = System.IntPtr; // LPVOID
using TW_UINT16 = System.UInt16; // unsigned short using TW_UINT16 = System.UInt16; // unsigned short
using TW_UINT32 = System.UInt32; // unsigned long using TW_UINT32 = System.UInt32; // unsigned long
using TW_UINT8 = System.Byte; // unsigned char using TW_UINT8 = System.Byte; // unsigned char
// iffy
using TW_UINTPTR = System.UIntPtr; // UINT_PTR
// This mono doc is awesome. An interop must-read // This mono doc is awesome. An interop must-read
// http://www.mono-project.com/Interop_with_Native_Libraries // http://www.mono-project.com/Interop_with_Native_Libraries (old)
// http://www.mono-project.com/docs/advanced/pinvoke/ (new url)
////////////////////////////////// //////////////////////////////////
// most of the doc text are copied // Data structures that
// from the twain pdf. Data that
// are passed to the TWAIN method // are passed to the TWAIN method
// are defined as classes to reduce // are defined as classes to reduce
// ref/out in the low-level calls. // ref/out in the low-level calls.
@@ -321,7 +322,7 @@ namespace NTwain.Data
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
partial struct TWMemory partial struct TWMemory
{ {
// not a class due to being embedded next // this is not a class due to being embedded by other classes
TW_UINT32 _flags; TW_UINT32 _flags;
TW_UINT32 _length; TW_UINT32 _length;
@@ -448,8 +449,8 @@ namespace NTwain.Data
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWStatusUtf8 partial class TWStatusUtf8
{ {
// NOTE: rather than embedding the twstatus directly use its fields instead // NOTE: rather than embedding the TWStatus directly I'm using its fields instead
// so the twstatus could become a class object. If twstatus changes // so the TWStatus could become a class object. If TWStatus changes
// definition remember to change it here // definition remember to change it here
TW_UINT16 _conditionCode; TW_UINT16 _conditionCode;
TW_UINT16 _data; TW_UINT16 _data;

View File

@@ -13,13 +13,15 @@ namespace NTwain.Data
{ {
//// This file contains custom logic added to the twain types. //// This file contains custom logic added to the twain types.
//// Separating the field definitions out makes finding all the //// Separating the raw field definitions out makes finding all the
//// custom code logic easier. Mostly this is just making the fields //// custom code logic easier. Mostly this just makes the fields
//// into .net friendly properties. //// into .net friendly properties.
//// potentially unit tests for the twain types only need to target //// potentially unit tests for the twain types only need to target
//// code in this file since everything else is just interop and //// code in this file since everything else is just interop and
//// field definitions (pretty much have to hope it's correct). //// field definitions.
//// most of the doc text are copied from the twain spec pdf.
/// <summary> /// <summary>

View File

@@ -39,7 +39,7 @@ namespace NTwain.Internals
/// <returns></returns> /// <returns></returns>
ICommittable GetPendingStateChanger(int newState); ICommittable GetPendingStateChanger(int newState);
void ChangeSourceId(TwainSource source); void ChangeCurrentSource(TwainSource source);
ReturnCode DisableSource(); ReturnCode DisableSource();
@@ -48,6 +48,7 @@ namespace NTwain.Internals
void SafeSyncableRaiseEvent(TransferReadyEventArgs e); void SafeSyncableRaiseEvent(TransferReadyEventArgs e);
ReturnCode EnableSource(SourceEnableMode mode, bool modal, IntPtr windowHandle); ReturnCode EnableSource(SourceEnableMode mode, bool modal, IntPtr windowHandle);
SynchronizationContext SynchronizationContext { get; set; } SynchronizationContext SynchronizationContext { get; set; }
/// <summary> /// <summary>

View File

@@ -1,4 +1,5 @@
using System; using NTwain.Triplets;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@@ -22,8 +23,8 @@ namespace NTwain
if (IsWin) if (IsWin)
{ {
var newDsmPath = Path.Combine(Environment.SystemDirectory, "twaindsm.dll"); var newDsmPath = Path.Combine(Environment.SystemDirectory, Dsm.WIN_NEW_DSM_NAME);
var oldDsmPath = Path.Combine(Environment.SystemDirectory, "twain_32.dll"); var oldDsmPath = Path.Combine(Environment.SystemDirectory, Dsm.WIN_OLD_DSM_NAME);
if (IsApp64bit) if (IsApp64bit)
{ {
@@ -44,11 +45,12 @@ namespace NTwain
} }
else if (IsLinux) else if (IsLinux)
{ {
DsmExists = File.Exists(Triplets.Dsm.LINUX_DSM_PATH); DsmExists = File.Exists(Dsm.LINUX_DSM_PATH);
IsSupported = DsmExists && IsOnMono; IsSupported = DsmExists && IsOnMono;
} }
else else
{ {
// mac? not gonna happen
} }
_defaultMemManager = new WinMemoryManager(); _defaultMemManager = new WinMemoryManager();
@@ -56,8 +58,17 @@ namespace NTwain
// prefer the use of the twain dsm on windows. // prefer the use of the twain dsm on windows.
internal static readonly bool UseNewWinDSM; internal static readonly bool UseNewWinDSM;
internal static readonly bool IsOnMono;
internal static readonly bool IsWin;
internal static readonly bool IsLinux;
internal static readonly bool IsApp64bit; /// <summary>
/// Gets a value indicating whether the application is running in 64-bit.
/// </summary>
/// <value>
/// <c>true</c> if the application is 64-bit; otherwise, <c>false</c>.
/// </value>
public static bool IsApp64bit { get; private set; }
/// <summary> /// <summary>
/// Gets a value indicating whether the applicable TWAIN DSM library exists in the operating system. /// Gets a value indicating whether the applicable TWAIN DSM library exists in the operating system.
@@ -67,13 +78,9 @@ namespace NTwain
/// </value> /// </value>
public static bool DsmExists { get; private set; } public static bool DsmExists { get; private set; }
internal static readonly bool IsOnMono;
internal static readonly bool IsWin;
internal static readonly bool IsLinux;
/// <summary> /// <summary>
/// Gets a value indicating whether this library is supported on current OS. /// Gets a value indicating whether this library is supported on current OS.
/// Check the other platform properties to determine the reason if this is false.
/// </summary> /// </summary>
/// <value> /// <value>
/// <c>true</c> if this library is supported; otherwise, <c>false</c>. /// <c>true</c> if this library is supported; otherwise, <c>false</c>.
@@ -86,7 +93,7 @@ namespace NTwain
/// <summary> /// <summary>
/// Gets the <see cref="IMemoryManager"/> for communicating with data sources. /// Gets the <see cref="IMemoryManager"/> for communicating with data sources.
/// This should only be used after the DSM has been opened. /// This should only be used when a <see cref="TwainSession"/> is open.
/// </summary> /// </summary>
/// <value> /// <value>
/// The memory manager. /// The memory manager.

View File

@@ -23,7 +23,7 @@ namespace NTwain.Triplets
var rc = Dsm.DsmEntry(Session.AppId, Message.CloseDS, Session.CurrentSource.Identity); var rc = Dsm.DsmEntry(Session.AppId, Message.CloseDS, Session.CurrentSource.Identity);
if (rc == ReturnCode.Success) if (rc == ReturnCode.Success)
{ {
Session.ChangeSourceId(null); Session.ChangeCurrentSource(null);
Session.ChangeState(3, true); Session.ChangeState(3, true);
} }
return rc; return rc;
@@ -79,7 +79,7 @@ namespace NTwain.Triplets
var rc = Dsm.DsmEntry(Session.AppId, Message.OpenDS, source.Identity); var rc = Dsm.DsmEntry(Session.AppId, Message.OpenDS, source.Identity);
if (rc == ReturnCode.Success) if (rc == ReturnCode.Success)
{ {
Session.ChangeSourceId(source); Session.ChangeCurrentSource(source);
Session.ChangeState(4, true); Session.ChangeState(4, true);
} }
return rc; return rc;

View File

@@ -6,11 +6,10 @@ namespace NTwain.Triplets
{ {
static partial class Dsm static partial class Dsm
{ {
internal const string LINUX_DSM_PATH = "/usr/local/lib/libtwaindsm.so";
static partial class NativeMethods static partial class NativeMethods
{ {
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -19,7 +18,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref IntPtr data); ref IntPtr data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -28,7 +27,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref DataGroups data); ref DataGroups data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -37,7 +36,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWAudioInfo data); [In, Out]TWAudioInfo data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -46,7 +45,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCapability data); [In, Out]TWCapability data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -55,7 +54,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCustomDSData data); [In, Out]TWCustomDSData data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -64,7 +63,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWDeviceEvent data); [In, Out]TWDeviceEvent data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -73,7 +72,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCallback data); [In, Out]TWCallback data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -82,7 +81,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCallback2 data); [In, Out]TWCallback2 data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -91,7 +90,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWEntryPoint data); [In, Out]TWEntryPoint data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -100,7 +99,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWEvent data); [In, Out]TWEvent data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -109,7 +108,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWFileSystem data); [In, Out]TWFileSystem data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
IntPtr zero, IntPtr zero,
@@ -118,7 +117,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWIdentity data); [In, Out]TWIdentity data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -127,7 +126,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWPassThru data); [In, Out]TWPassThru data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -136,7 +135,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWPendingXfers data); [In, Out]TWPendingXfers data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -145,7 +144,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWSetupFileXfer data); [In, Out]TWSetupFileXfer data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -154,7 +153,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWSetupMemXfer data); [In, Out]TWSetupMemXfer data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -163,7 +162,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWStatusUtf8 data); [In, Out]TWStatusUtf8 data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -172,7 +171,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWUserInterface data); [In, Out]TWUserInterface data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -181,7 +180,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCieColor data); [In, Out]TWCieColor data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -190,7 +189,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWExtImageInfo data); [In, Out]TWExtImageInfo data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -199,7 +198,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWFilter data); [In, Out]TWFilter data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -208,7 +207,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWGrayResponse data); [In, Out]TWGrayResponse data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -217,7 +216,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWImageInfo data); [In, Out]TWImageInfo data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -226,7 +225,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWImageLayout data); [In, Out]TWImageLayout data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -235,7 +234,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWImageMemXfer data); [In, Out]TWImageMemXfer data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -244,7 +243,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWJpegCompression data); [In, Out]TWJpegCompression data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -253,7 +252,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWPalette8 data); [In, Out]TWPalette8 data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -262,7 +261,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWRgbResponse data); [In, Out]TWRgbResponse data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -271,7 +270,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWStatus data); [In, Out]TWStatus data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")] [DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux( public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
{ {
static partial class NativeMethods static partial class NativeMethods
{ {
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -17,7 +17,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref IntPtr data); ref IntPtr data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -26,7 +26,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref DataGroups data); ref DataGroups data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -35,7 +35,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWAudioInfo data); [In, Out]TWAudioInfo data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -44,7 +44,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCapability data); [In, Out]TWCapability data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -53,7 +53,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCustomDSData data); [In, Out]TWCustomDSData data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -62,7 +62,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWDeviceEvent data); [In, Out]TWDeviceEvent data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -71,7 +71,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCallback data); [In, Out]TWCallback data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -80,7 +80,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCallback2 data); [In, Out]TWCallback2 data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -89,7 +89,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWEntryPoint data); [In, Out]TWEntryPoint data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -98,7 +98,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWEvent data); [In, Out]TWEvent data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -107,7 +107,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWFileSystem data); [In, Out]TWFileSystem data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
IntPtr zero, IntPtr zero,
@@ -116,7 +116,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWIdentity data); [In, Out]TWIdentity data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -125,7 +125,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWPassThru data); [In, Out]TWPassThru data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -134,7 +134,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWPendingXfers data); [In, Out]TWPendingXfers data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -143,7 +143,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWSetupFileXfer data); [In, Out]TWSetupFileXfer data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -152,7 +152,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWSetupMemXfer data); [In, Out]TWSetupMemXfer data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -161,7 +161,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWStatusUtf8 data); [In, Out]TWStatusUtf8 data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -170,7 +170,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWUserInterface data); [In, Out]TWUserInterface data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -179,7 +179,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCieColor data); [In, Out]TWCieColor data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -188,7 +188,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWExtImageInfo data); [In, Out]TWExtImageInfo data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -197,7 +197,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWFilter data); [In, Out]TWFilter data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -206,7 +206,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWGrayResponse data); [In, Out]TWGrayResponse data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -215,7 +215,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWImageInfo data); [In, Out]TWImageInfo data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -224,7 +224,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWImageLayout data); [In, Out]TWImageLayout data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -233,7 +233,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWImageMemXfer data); [In, Out]TWImageMemXfer data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -242,7 +242,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWJpegCompression data); [In, Out]TWJpegCompression data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -251,7 +251,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWPalette8 data); [In, Out]TWPalette8 data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -260,7 +260,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWRgbResponse data); [In, Out]TWRgbResponse data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -269,7 +269,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWStatus data); [In, Out]TWStatus data);
[DllImport("twaindsm", EntryPoint = "#1")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew( public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
{ {
static partial class NativeMethods static partial class NativeMethods
{ {
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -17,7 +17,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref IntPtr data); ref IntPtr data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -26,7 +26,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref DataGroups data); ref DataGroups data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -35,7 +35,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWAudioInfo data); [In, Out]TWAudioInfo data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -44,7 +44,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCapability data); [In, Out]TWCapability data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -53,7 +53,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCustomDSData data); [In, Out]TWCustomDSData data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -62,7 +62,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWDeviceEvent data); [In, Out]TWDeviceEvent data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -71,7 +71,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCallback data); [In, Out]TWCallback data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -80,7 +80,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCallback2 data); [In, Out]TWCallback2 data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -89,7 +89,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWEntryPoint data); [In, Out]TWEntryPoint data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -98,7 +98,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWEvent data); [In, Out]TWEvent data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -107,7 +107,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWFileSystem data); [In, Out]TWFileSystem data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
IntPtr zero, IntPtr zero,
@@ -116,7 +116,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWIdentity data); [In, Out]TWIdentity data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -125,7 +125,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWPassThru data); [In, Out]TWPassThru data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -134,7 +134,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWPendingXfers data); [In, Out]TWPendingXfers data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -143,7 +143,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWSetupFileXfer data); [In, Out]TWSetupFileXfer data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -152,7 +152,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWSetupMemXfer data); [In, Out]TWSetupMemXfer data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -161,7 +161,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWStatusUtf8 data); [In, Out]TWStatusUtf8 data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -170,7 +170,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWUserInterface data); [In, Out]TWUserInterface data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -179,7 +179,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWCieColor data); [In, Out]TWCieColor data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -188,7 +188,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWExtImageInfo data); [In, Out]TWExtImageInfo data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -197,7 +197,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWFilter data); [In, Out]TWFilter data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -206,7 +206,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWGrayResponse data); [In, Out]TWGrayResponse data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -215,7 +215,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWImageInfo data); [In, Out]TWImageInfo data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -224,7 +224,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWImageLayout data); [In, Out]TWImageLayout data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -233,7 +233,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWImageMemXfer data); [In, Out]TWImageMemXfer data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -242,7 +242,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWJpegCompression data); [In, Out]TWJpegCompression data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -251,7 +251,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWPalette8 data); [In, Out]TWPalette8 data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -260,7 +260,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWRgbResponse data); [In, Out]TWRgbResponse data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
@@ -269,7 +269,7 @@ namespace NTwain.Triplets
Message msg, Message msg,
[In, Out]TWStatus data); [In, Out]TWStatus data);
[DllImport("twain_32", EntryPoint = "#1")] [DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld( public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
[In, Out]TWIdentity destination, [In, Out]TWIdentity destination,

View File

@@ -10,6 +10,11 @@ namespace NTwain.Triplets
/// </summary> /// </summary>
static partial class Dsm static partial class Dsm
{ {
internal const string DSM_ENTRY = "DSM_Entry";
internal const string LINUX_DSM_PATH = "/usr/local/lib/libtwaindsm.so";
internal const string WIN_NEW_DSM_NAME = "twaindsm.dll";
internal const string WIN_OLD_DSM_NAME = "twain_32.dll";
#region wrapped calls #region wrapped calls
public static ReturnCode DsmEntry( public static ReturnCode DsmEntry(

View File

@@ -16,7 +16,7 @@ or better explained in code:
DGControl.Status.Get(...) DGControl.Status.Get(...)
and that's the triplet at-a-glance. Only triplets usable by the and that's the triplet at-a-glance. Only triplets usable by the
application-side are explicitly defined this way. application-side are defined here.
Also some of the operations are marked as internal when there are Also some of the operations are marked as internal when there are
better wrapped managed version available. Goal is to better wrapped managed version available. Goal is to

View File

@@ -114,10 +114,10 @@ namespace NTwain
return new TentativeStateCommitable(this, newState); return new TentativeStateCommitable(this, newState);
} }
void ITwainSessionInternal.ChangeSourceId(TwainSource source) void ITwainSessionInternal.ChangeCurrentSource(TwainSource source)
{ {
CurrentSource = source; CurrentSource = source;
OnPropertyChanged("SourceId"); OnPropertyChanged("CurrentSource");
SafeAsyncSyncableRaiseOnEvent(OnSourceChanged, SourceChanged); SafeAsyncSyncableRaiseOnEvent(OnSourceChanged, SourceChanged);
} }

View File

@@ -6,6 +6,9 @@ using System.Text;
namespace NTwain namespace NTwain
{ {
// this contains all cap-related methods prefixed with Cap
partial class TwainSource partial class TwainSource
{ {
/// <summary> /// <summary>

View File

@@ -69,7 +69,20 @@ namespace NTwain
/// <param name="modal">if set to <c>true</c> any driver UI will display as modal.</param> /// <param name="modal">if set to <c>true</c> any driver UI will display as modal.</param>
/// <param name="windowHandle">The window handle if modal.</param> /// <param name="windowHandle">The window handle if modal.</param>
/// <returns></returns> /// <returns></returns>
[Obsolete("Use Enable() instead.")]
public ReturnCode StartTransfer(SourceEnableMode mode, bool modal, IntPtr windowHandle) public ReturnCode StartTransfer(SourceEnableMode mode, bool modal, IntPtr windowHandle)
{
return Enable(mode, modal, windowHandle);
}
/// <summary>
/// Enables the source to start transferring.
/// </summary>
/// <param name="mode">The mode.</param>
/// <param name="modal">if set to <c>true</c> any driver UI will display as modal.</param>
/// <param name="windowHandle">The window handle if modal.</param>
/// <returns></returns>
public ReturnCode Enable(SourceEnableMode mode, bool modal, IntPtr windowHandle)
{ {
return _session.EnableSource(mode, modal, windowHandle); return _session.EnableSource(mode, modal, windowHandle);
} }
@@ -261,7 +274,7 @@ namespace NTwain
#region cameras #region cameras
/// <summary> /// <summary>
/// Gets the cameras supported by the source. /// [Experimental] Gets the cameras supported by the source.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public IList<string> GetCameras() public IList<string> GetCameras()
@@ -286,7 +299,7 @@ namespace NTwain
} }
/// <summary> /// <summary>
/// Sets the target camera for cap negotiation that can be set per camera. /// [Experimental] Sets the target camera for cap negotiation that can be set per camera.
/// </summary> /// </summary>
/// <param name="cameraName"></param> /// <param name="cameraName"></param>
/// <returns></returns> /// <returns></returns>

View File

@@ -16,7 +16,7 @@ A nuget package is also [available here](https://www.nuget.org/packages/ntwain)
Using the lib Using the lib
-------------------------------------- --------------------------------------
To properly use this lib you will need to be reasonably familiar with the TWAIN spec To properly use this lib you will need to be reasonably familiar with the TWAIN spec
and how it works in general (especially capability). and understand how it works in general (especially capability).
The spec can be downloaded from [twain.org](http://twain.org/). The spec can be downloaded from [twain.org](http://twain.org/).
Except for those that have been abstracted away with .net equivalents, most triplet operations are Except for those that have been abstracted away with .net equivalents, most triplet operations are
@@ -24,9 +24,9 @@ provided as-is so you will need to know when and how to use them.
There are no high-level, single-line scan-a-page-for-me-now functions yet. There are no high-level, single-line scan-a-page-for-me-now functions yet.
The main class to use is TwainSession. You can either use it directly by subscribing The main class to use is TwainSession. You can either use it directly by subscribing
to the important events or sub-class it and override the OnMethods related to those events. to the important events or sub-class it and override the On* methods related to those events.
The sample projects contain both usages. Note that an application process should only The sample projects contain both usages. Note that an application process should only
have one TwainSession, unless you really know what you're doing. have one active (open) TwainSession at a time.
``` ```
#!c# #!c#
@@ -59,7 +59,7 @@ and call Open() to start using it.
``` ```
#!c# #!c#
// choose and open a source // choose and open the first source found
IEnumerable<TwainSources> sources = session.GetSources(); IEnumerable<TwainSources> sources = session.GetSources();
var myDS = sources.First(); var myDS = sources.First();
myDS.Open(); myDS.Open();
@@ -70,16 +70,16 @@ At this point you can negotiate with the source using all the typical TWAIN trip
The TwainSource class itself has some handy pre-defined methods for common capability negotiation The TwainSource class itself has some handy pre-defined methods for common capability negotiation
such as DPI, bitdepth, or paper size to get you started. such as DPI, bitdepth, or paper size to get you started.
When you're ready to get into transfer mode, just call StartTransfer() on the source object. When you're ready to get into transfer mode, just call Enable() on the source object.
``` ```
#!c# #!c#
var myDS = sources.StartTransfer(...); sources.Enable(...);
``` ```
After transfer has completed (you are notified of this with the SourceDisabled event from session) After transfer has completed (remember you are notified of this with the SourceDisabled event from session)
and you're done with TWAIN, you can close the source and the session in sequence to clean things up. and you're done with TWAIN, you can close the source and the session in sequence to clean things up.
``` ```
@@ -120,6 +120,7 @@ newer data source manager (twaindsm.dll) from below installed.
[DSM from TWAIN.org](http://sourceforge.net/projects/twain-dsm/files/TWAIN%20DSM%202%20Win/) [DSM from TWAIN.org](http://sourceforge.net/projects/twain-dsm/files/TWAIN%20DSM%202%20Win/)
Otherwise just compile and run the app as x86 and it'll use the 32-bit version (twain_32.dll) that comes with Windows. In fact, installing the new DSM is recommended whether you're running in 64-bit or not.
If your scanner driver is still 32-bit (and most likely it will be) you'll have no choice but to
compile as x86 anyway, even if you have installed the newer dsm dll. If the scanner's TWAIN driver is still 32-bit (and most likely it will be) then you'll have no choice but to
compile the app as x86.

View File

@@ -55,7 +55,7 @@ namespace Tester
if (rc == ReturnCode.Success) if (rc == ReturnCode.Success)
{ {
Console.WriteLine("Start capture from the sample source."); Console.WriteLine("Start capture from the sample source.");
rc = hit.StartTransfer(SourceEnableMode.NoUI, false, IntPtr.Zero); rc = hit.Enable(SourceEnableMode.NoUI, false, IntPtr.Zero);
} }
else else
{ {

View File

@@ -132,7 +132,7 @@ namespace Tester.WPF
this.CurrentSource.CapSetImageXferMech(XferMech.File); this.CurrentSource.CapSetImageXferMech(XferMech.File);
} }
var rc = this.CurrentSource.StartTransfer(SourceEnableMode.NoUI, false, hwnd); var rc = this.CurrentSource.Enable(SourceEnableMode.NoUI, false, hwnd);
} }
} }
} }

View File

@@ -173,7 +173,7 @@ namespace Tester.Winform
if (_twain.CurrentSource.SupportedCaps.Contains(CapabilityId.CapUIControllable)) if (_twain.CurrentSource.SupportedCaps.Contains(CapabilityId.CapUIControllable))
{ {
// hide scanner ui if possible // hide scanner ui if possible
if (_twain.CurrentSource.StartTransfer(SourceEnableMode.NoUI, false, this.Handle) == ReturnCode.Success) if (_twain.CurrentSource.Enable(SourceEnableMode.NoUI, false, this.Handle) == ReturnCode.Success)
{ {
btnStopScan.Enabled = true; btnStopScan.Enabled = true;
btnStartCapture.Enabled = false; btnStartCapture.Enabled = false;
@@ -182,7 +182,7 @@ namespace Tester.Winform
} }
else else
{ {
if (_twain.CurrentSource.StartTransfer(SourceEnableMode.ShowUI, true, this.Handle) == ReturnCode.Success) if (_twain.CurrentSource.Enable(SourceEnableMode.ShowUI, true, this.Handle) == ReturnCode.Success)
{ {
btnStopScan.Enabled = true; btnStopScan.Enabled = true;
btnStartCapture.Enabled = false; btnStartCapture.Enabled = false;
@@ -372,7 +372,7 @@ namespace Tester.Winform
private void btnAllSettings_Click(object sender, EventArgs e) private void btnAllSettings_Click(object sender, EventArgs e)
{ {
_twain.CurrentSource.StartTransfer(SourceEnableMode.ShowUIOnly, true, this.Handle); _twain.CurrentSource.Enable(SourceEnableMode.ShowUIOnly, true, this.Handle);
} }
#endregion #endregion