Typos and debug msg updates.

This commit is contained in:
Eugene Wang
2023-04-07 20:39:14 -04:00
parent c29f4944e9
commit 416c3a80b0
5 changed files with 9 additions and 7 deletions

View File

@@ -260,7 +260,7 @@ namespace NTwain.Data
/// <returns></returns>
public static TW_CAPABILITY CreateRangeCap<TValue>(this CAP cap, IMemoryManager memMgr, Range<TValue> value) where TValue : struct
{
TW_CAPABILITY twCap = new() { Cap = cap, ConType = TWON.ENUMERATION };
TW_CAPABILITY twCap = new() { Cap = cap, ConType = TWON.RANGE };
IntPtr lockedPtr = IntPtr.Zero;
try

View File

@@ -2,6 +2,7 @@
using NTwain.Triplets;
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace NTwain
@@ -87,11 +88,13 @@ namespace NTwain
bool _closeDsRequested;
private void HandleSourceMsg(MSG msg)
private void HandleSourceMsg(MSG msg, [CallerMemberName] string? caller = null)
{
Debug.WriteLine($"[thread {Environment.CurrentManagedThreadId}] {nameof(HandleSourceMsg)} called by {caller} at state {State} with {msg}.");
// the reason we post these to the background is
// if they're coming from UI message loop then
// this needs to return asap
// this needs to return asap (?)
switch (msg)
{
case MSG.XFERREADY:

View File

@@ -175,7 +175,7 @@ namespace NTwain
public STS GetCapValues<TValue>(CAP cap, out IList<TValue> values) where TValue : struct
{
values = new List<TValue>();
var sts = GetCapCurrent(cap, out TW_CAPABILITY twcap);
var sts = GetCapValues(cap, out TW_CAPABILITY twcap);
if (sts.RC == TWRC.SUCCESS)
{
switch (twcap.ConType)

View File

@@ -5,7 +5,6 @@ using NTwain.Triplets;
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using System.Windows.Interop;
using MSG = NTwain.Data.MSG;
@@ -92,7 +91,7 @@ namespace NTwain
handled = rc == TWRC.DSEVENT;
if (_procEvent.TWMessage != 0 && (handled || rc == TWRC.NOTDSEVENT))
{
Debug.WriteLine($"[thread {Environment.CurrentManagedThreadId}]: CheckIfTwainMessage at state {State} with MSG={_procEvent.TWMessage}.");
//Debug.WriteLine($"[thread {Environment.CurrentManagedThreadId}] CheckIfTwainMessage at state {State} with MSG={_procEvent.TWMessage}.");
HandleSourceMsg((MSG)_procEvent.TWMessage);
}
}

View File

@@ -122,7 +122,7 @@ namespace NTwain
{
switch (msg)
{
case MSG.CLOSEDS:
case MSG.CLOSEDSOK:
case MSG.CLOSEDSREQ:
// this should be done on ui thread (or same one that enabled the ds)
_uiThreadMarshaller.BeginInvoke(() =>