Just for fun.

This commit is contained in:
soukoku
2014-04-11 23:16:33 -04:00
parent efe9b469ba
commit 55edb65608
2 changed files with 544 additions and 307 deletions

View File

@@ -7,280 +7,277 @@ namespace NTwain.Triplets
{ {
static partial class PInvoke static partial class PInvoke
{ {
// not sure if the signatures are correct yet static partial class NativeMethods
// so just a placeholder for now {
[DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
public static extern ReturnCode DsmEntryLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
DataGroups dg,
DataArgumentType dat,
Message msg,
ref IntPtr data);
//static partial class NativeMethods [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
//{ public static extern ReturnCode DsmEntryLinux(
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [In, Out]TWIdentity origin,
// public static extern ReturnCode DsmEntryLinux( [In, Out]TWIdentity destination,
// [In, Out]TWIdentity origin, DataGroups dg,
// [In, Out]TWIdentity destination, DataArgumentType dat,
// DataGroups dg, Message msg,
// DataArgumentType dat, ref DataGroups data);
// Message msg,
// ref IntPtr data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// ref DataGroups data); [In, Out]TWAudioInfo data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWAudioInfo data); [In, Out]TWCapability data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWCapability data); [In, Out]TWCustomDSData data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWCustomDSData data); [In, Out]TWDeviceEvent data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWDeviceEvent data); [In, Out]TWCallback data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWCallback data); [In, Out]TWCallback2 data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWCallback2 data); [In, Out]TWEntryPoint data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWEntryPoint data); [In, Out]TWEvent data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWEvent data); [In, Out]TWFileSystem data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, IntPtr zero,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWFileSystem data); [In, Out]TWIdentity data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// IntPtr zero, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWIdentity data); [In, Out]TWPassThru data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWPassThru data); [In, Out]TWPendingXfers data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWPendingXfers data); [In, Out]TWSetupFileXfer data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWSetupFileXfer data); [In, Out]TWSetupMemXfer data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWSetupMemXfer data); [In, Out]TWStatusUtf8 data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWStatusUtf8 data); [In, Out]TWUserInterface data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWUserInterface data); [In, Out]TWCieColor data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWCieColor data); [In, Out]TWExtImageInfo data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWExtImageInfo data); [In, Out]TWFilter data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWFilter data); [In, Out]TWGrayResponse data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWGrayResponse data); [In, Out]TWImageInfo data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWImageInfo data); [In, Out]TWImageLayout data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWImageLayout data); [In, Out]TWImageMemXfer data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWImageMemXfer data); [In, Out]TWJpegCompression data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWJpegCompression data); [In, Out]TWPalette8 data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWPalette8 data); [In, Out]TWRgbResponse data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWRgbResponse data); [In, Out]TWStatus data);
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")] [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux( public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin, [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination, [In, Out]TWIdentity destination,
// DataGroups dg, DataGroups dg,
// DataArgumentType dat, DataArgumentType dat,
// Message msg, Message msg,
// [In, Out]TWStatus data); ref TWMemory data);
}
// [DllImport("/usr/local/lib/libtwaindsm.so", EntryPoint = "#1")]
// public static extern ReturnCode DsmEntryLinux(
// [In, Out]TWIdentity origin,
// [In, Out]TWIdentity destination,
// DataGroups dg,
// DataArgumentType dat,
// Message msg,
// ref TWMemory data);
//}
} }
} }

View File

@@ -21,7 +21,7 @@ namespace NTwain.Triplets
// in essence it only exists in 64 bit systems and thus // in essence it only exists in 64 bit systems and thus
// the 2 sets of identical pinvokes :( // the 2 sets of identical pinvokes :(
public static readonly bool CanUseTwainDSM = CheckIfCanUseNewDSM(); public static readonly bool CanUseNewDSM = CheckIfCanUseNewDSM();
private static bool CheckIfCanUseNewDSM() private static bool CheckIfCanUseNewDSM()
{ {
@@ -47,8 +47,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref IntPtr data) ref IntPtr data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, dg, dat, msg, ref data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, dg, dat, msg, ref data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, dg, dat, msg, ref data); }
else { return NativeMethods.DsmEntry32(origin, destination, dg, dat, msg, ref data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, dg, dat, msg, ref data);
}
throw new PlatformNotSupportedException();
} }
public static ReturnCode DsmEntry( public static ReturnCode DsmEntry(
@@ -59,8 +67,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref DataGroups data) ref DataGroups data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, dg, dat, msg, ref data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, dg, dat, msg, ref data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, dg, dat, msg, ref data); }
else { return NativeMethods.DsmEntry32(origin, destination, dg, dat, msg, ref data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, dg, dat, msg, ref data);
}
throw new PlatformNotSupportedException();
} }
public static ReturnCode DsmEntry( public static ReturnCode DsmEntry(
@@ -69,8 +85,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWAudioInfo data) TWAudioInfo data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Audio, DataArgumentType.AudioInfo, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Audio, DataArgumentType.AudioInfo, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Audio, DataArgumentType.AudioInfo, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Audio, DataArgumentType.AudioInfo, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Audio, DataArgumentType.AudioInfo, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -80,8 +104,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWCapability data) TWCapability data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.Capability, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.Capability, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.Capability, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.Capability, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.Capability, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -91,8 +123,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWCustomDSData data) TWCustomDSData data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.CustomDSData, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.CustomDSData, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.CustomDSData, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.CustomDSData, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.CustomDSData, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -102,8 +142,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWDeviceEvent data) TWDeviceEvent data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.DeviceEvent, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.DeviceEvent, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.DeviceEvent, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.DeviceEvent, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.DeviceEvent, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -113,8 +161,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWCallback data) TWCallback data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.Callback, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.Callback, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.Callback, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.Callback, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.Callback, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -124,8 +180,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWCallback2 data) TWCallback2 data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.Callback, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.Callback, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.Callback, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.Callback, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.Callback, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -135,8 +199,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWEntryPoint data) TWEntryPoint data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.EntryPoint, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.EntryPoint, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.EntryPoint, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.EntryPoint, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.EntryPoint, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -146,8 +218,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWEvent data) TWEvent data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.Event, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.Event, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.Event, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.Event, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.Event, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -157,8 +237,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWFileSystem data) TWFileSystem data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.FileSystem, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.FileSystem, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.FileSystem, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.FileSystem, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.FileSystem, msg, data);
}
throw new PlatformNotSupportedException();
} }
public static ReturnCode DsmEntry( public static ReturnCode DsmEntry(
@@ -166,8 +254,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWIdentity data) TWIdentity data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, IntPtr.Zero, DataGroups.Control, DataArgumentType.Identity, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, IntPtr.Zero, DataGroups.Control, DataArgumentType.Identity, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, IntPtr.Zero, DataGroups.Control, DataArgumentType.Identity, msg, data); }
else { return NativeMethods.DsmEntry32(origin, IntPtr.Zero, DataGroups.Control, DataArgumentType.Identity, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, IntPtr.Zero, DataGroups.Control, DataArgumentType.Identity, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -177,8 +273,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWPassThru data) TWPassThru data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.PassThru, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.PassThru, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.PassThru, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.PassThru, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.PassThru, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -188,8 +292,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWPendingXfers data) TWPendingXfers data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.PendingXfers, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.PendingXfers, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.PendingXfers, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.PendingXfers, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.PendingXfers, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -199,8 +311,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWSetupFileXfer data) TWSetupFileXfer data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.SetupFileXfer, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.SetupFileXfer, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.SetupFileXfer, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.SetupFileXfer, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.SetupFileXfer, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -210,8 +330,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWSetupMemXfer data) TWSetupMemXfer data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.SetupMemXfer, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.SetupMemXfer, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.SetupMemXfer, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.SetupMemXfer, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.SetupMemXfer, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -221,8 +349,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWStatusUtf8 data) TWStatusUtf8 data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.StatusUtf8, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.StatusUtf8, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.StatusUtf8, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.StatusUtf8, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.StatusUtf8, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -232,8 +368,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWUserInterface data) TWUserInterface data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.UserInterface, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.UserInterface, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.UserInterface, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.UserInterface, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.UserInterface, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -243,8 +387,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWCieColor data) TWCieColor data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.CieColor, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.CieColor, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.CieColor, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.CieColor, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Image, DataArgumentType.CieColor, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -254,8 +406,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWExtImageInfo data) TWExtImageInfo data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.ExtImageInfo, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.ExtImageInfo, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.ExtImageInfo, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.ExtImageInfo, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Image, DataArgumentType.ExtImageInfo, msg, data);
}
throw new PlatformNotSupportedException();
} }
public static ReturnCode DsmEntry( public static ReturnCode DsmEntry(
@@ -264,8 +424,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWFilter data) TWFilter data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.Filter, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.Filter, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.Filter, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.Filter, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Image, DataArgumentType.Filter, msg, data);
}
throw new PlatformNotSupportedException();
} }
public static ReturnCode DsmEntry( public static ReturnCode DsmEntry(
@@ -274,8 +442,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWGrayResponse data) TWGrayResponse data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.GrayResponse, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.GrayResponse, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.GrayResponse, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.GrayResponse, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Image, DataArgumentType.GrayResponse, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -285,8 +461,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWImageInfo data) TWImageInfo data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.ImageInfo, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.ImageInfo, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.ImageInfo, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.ImageInfo, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Image, DataArgumentType.ImageInfo, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -296,8 +480,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWImageLayout data) TWImageLayout data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.ImageLayout, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.ImageLayout, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.ImageLayout, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.ImageLayout, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Image, DataArgumentType.ImageLayout, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -307,8 +499,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWImageMemXfer data) TWImageMemXfer data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.ImageMemXfer, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.ImageMemXfer, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.ImageMemXfer, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.ImageMemXfer, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Image, DataArgumentType.ImageMemXfer, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -318,8 +518,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWJpegCompression data) TWJpegCompression data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.JpegCompression, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.JpegCompression, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.JpegCompression, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.JpegCompression, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Image, DataArgumentType.JpegCompression, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -329,8 +537,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWPalette8 data) TWPalette8 data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.Palette8, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.Palette8, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.Palette8, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.Palette8, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Image, DataArgumentType.Palette8, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -340,8 +556,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWRgbResponse data) TWRgbResponse data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.RgbResponse, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.RgbResponse, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.RgbResponse, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.RgbResponse, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Image, DataArgumentType.RgbResponse, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -351,8 +575,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
TWStatus data) TWStatus data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.Status, msg, data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.Status, msg, data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, DataArgumentType.Status, msg, data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, DataArgumentType.Status, msg, data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, DataArgumentType.Status, msg, data);
}
throw new PlatformNotSupportedException();
} }
@@ -363,8 +595,16 @@ namespace NTwain.Triplets
Message msg, Message msg,
ref TWMemory data) ref TWMemory data)
{ {
if (CanUseTwainDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, dat, msg, ref data); } if (IsWin)
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, dat, msg, ref data); } {
if (CanUseNewDSM) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Control, dat, msg, ref data); }
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Control, dat, msg, ref data); }
}
else if (IsLinux)
{
return NativeMethods.DsmEntryLinux(origin, destination, DataGroups.Control, dat, msg, ref data);
}
throw new PlatformNotSupportedException();
} }