mirror of
https://github.com/soukoku/ntwain.git
synced 2025-11-24 08:47:06 +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;
|
||||
}
|
||||
|
||||
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>();
|
||||
switch (mech)
|
||||
{
|
||||
case XferMech.Native:
|
||||
DoImageNativeXfer(session);
|
||||
break;
|
||||
case XferMech.Memory:
|
||||
DoImageMemoryXfer(session);
|
||||
break;
|
||||
@@ -82,6 +81,11 @@ namespace NTwain.Internals
|
||||
case XferMech.MemFile:
|
||||
DoImageMemoryFileXfer(session);
|
||||
break;
|
||||
case XferMech.Native:
|
||||
default: // always assume native
|
||||
DoImageNativeXfer(session);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
if ((xferGroup & DataGroups.Audio) == DataGroups.Audio)
|
||||
@@ -89,12 +93,13 @@ namespace NTwain.Internals
|
||||
var mech = session.GetCurrentCap(CapabilityId.ACapXferMech).ConvertToEnum<XferMech>();
|
||||
switch (mech)
|
||||
{
|
||||
case XferMech.Native:
|
||||
DoAudioNativeXfer(session);
|
||||
break;
|
||||
case XferMech.File:
|
||||
DoAudioFileXfer(session);
|
||||
break;
|
||||
case XferMech.Native:
|
||||
default: // always assume native
|
||||
DoAudioNativeXfer(session);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,6 @@ namespace NTwain
|
||||
// keep this same in majors releases
|
||||
public const string Release = "1.0.0.0";
|
||||
// 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)
|
||||
{
|
||||
// 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
|
||||
IntPtr msgPtr = IntPtr.Zero;
|
||||
@@ -659,7 +659,7 @@ namespace NTwain
|
||||
|
||||
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));
|
||||
// spec says we must handle this on the thread that enabled the DS.
|
||||
|
||||
Reference in New Issue
Block a user