mirror of
https://github.com/soukoku/ntwain.git
synced 2026-02-25 13:04:07 +08:00
Minor change to work with some DS behaviors.
This commit is contained in:
@@ -65,14 +65,13 @@ namespace NTwain.Internals
|
|||||||
xferGroup = DataGroups.None;
|
xferGroup = DataGroups.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((xferGroup & DataGroups.Image) == DataGroups.Image)
|
// some DS end up getting none but we will assume it's image
|
||||||
|
if (xferGroup == DataGroups.None ||
|
||||||
|
(xferGroup & DataGroups.Image) == DataGroups.Image)
|
||||||
{
|
{
|
||||||
var mech = session.GetCurrentCap(CapabilityId.ICapXferMech).ConvertToEnum<XferMech>();
|
var mech = session.GetCurrentCap(CapabilityId.ICapXferMech).ConvertToEnum<XferMech>();
|
||||||
switch (mech)
|
switch (mech)
|
||||||
{
|
{
|
||||||
case XferMech.Native:
|
|
||||||
DoImageNativeXfer(session);
|
|
||||||
break;
|
|
||||||
case XferMech.Memory:
|
case XferMech.Memory:
|
||||||
DoImageMemoryXfer(session);
|
DoImageMemoryXfer(session);
|
||||||
break;
|
break;
|
||||||
@@ -82,6 +81,11 @@ namespace NTwain.Internals
|
|||||||
case XferMech.MemFile:
|
case XferMech.MemFile:
|
||||||
DoImageMemoryFileXfer(session);
|
DoImageMemoryFileXfer(session);
|
||||||
break;
|
break;
|
||||||
|
case XferMech.Native:
|
||||||
|
default: // always assume native
|
||||||
|
DoImageNativeXfer(session);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((xferGroup & DataGroups.Audio) == DataGroups.Audio)
|
if ((xferGroup & DataGroups.Audio) == DataGroups.Audio)
|
||||||
@@ -89,12 +93,13 @@ namespace NTwain.Internals
|
|||||||
var mech = session.GetCurrentCap(CapabilityId.ACapXferMech).ConvertToEnum<XferMech>();
|
var mech = session.GetCurrentCap(CapabilityId.ACapXferMech).ConvertToEnum<XferMech>();
|
||||||
switch (mech)
|
switch (mech)
|
||||||
{
|
{
|
||||||
case XferMech.Native:
|
|
||||||
DoAudioNativeXfer(session);
|
|
||||||
break;
|
|
||||||
case XferMech.File:
|
case XferMech.File:
|
||||||
DoAudioFileXfer(session);
|
DoAudioFileXfer(session);
|
||||||
break;
|
break;
|
||||||
|
case XferMech.Native:
|
||||||
|
default: // always assume native
|
||||||
|
DoAudioNativeXfer(session);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ namespace NTwain
|
|||||||
// keep this same in majors releases
|
// keep this same in majors releases
|
||||||
public const string Release = "1.0.0.0";
|
public const string Release = "1.0.0.0";
|
||||||
// change this for each nuget release
|
// change this for each nuget release
|
||||||
public const string Build = "1.0.0";
|
public const string Build = "1.0.1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -631,7 +631,7 @@ namespace NTwain
|
|||||||
void HandleWndProcMessage(ref WindowsHook.MESSAGE winMsg, ref bool handled)
|
void HandleWndProcMessage(ref WindowsHook.MESSAGE winMsg, ref bool handled)
|
||||||
{
|
{
|
||||||
// this handles the message from a typical WndProc message loop and check if it's from the TWAIN source.
|
// this handles the message from a typical WndProc message loop and check if it's from the TWAIN source.
|
||||||
if (State >= 5)
|
if (_state >= 5)
|
||||||
{
|
{
|
||||||
// transform it into a pointer for twain
|
// transform it into a pointer for twain
|
||||||
IntPtr msgPtr = IntPtr.Zero;
|
IntPtr msgPtr = IntPtr.Zero;
|
||||||
@@ -659,7 +659,7 @@ namespace NTwain
|
|||||||
|
|
||||||
ReturnCode HandleCallback(TWIdentity origin, TWIdentity destination, DataGroups dg, DataArgumentType dat, Message msg, IntPtr data)
|
ReturnCode HandleCallback(TWIdentity origin, TWIdentity destination, DataGroups dg, DataArgumentType dat, Message msg, IntPtr data)
|
||||||
{
|
{
|
||||||
if (origin != null && SourceId != null && origin.Id == SourceId.Id)
|
if (origin != null && SourceId != null && origin.Id == SourceId.Id && _state >= 5)
|
||||||
{
|
{
|
||||||
Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "Thread {0}: CallbackHandler at state {1} with MSG={2}.", Thread.CurrentThread.ManagedThreadId, State, msg));
|
Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "Thread {0}: CallbackHandler at state {1} with MSG={2}.", Thread.CurrentThread.ManagedThreadId, State, msg));
|
||||||
// spec says we must handle this on the thread that enabled the DS.
|
// spec says we must handle this on the thread that enabled the DS.
|
||||||
|
|||||||
Reference in New Issue
Block a user