mirror of
https://github.com/soukoku/ntwain.git
synced 2025-04-05 20:59:23 +08:00
DBG break if ever encounters drivers with cap label support.
This commit is contained in:
parent
13521c71d6
commit
e4a6d8d8d3
@ -1,6 +1,7 @@
|
||||
using NTwain;
|
||||
using NTwain.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
@ -42,7 +43,15 @@ namespace WinFormSample
|
||||
foreach (var c in caps)
|
||||
listCaps.Items.Add(c);
|
||||
|
||||
var sts = twain.GetCapLabel(CAP.ICAP_XRESOLUTION, out string? test);
|
||||
// never seen a driver support these but here it is
|
||||
var sts = twain.GetCapLabel(CAP.ICAP_SUPPORTEDSIZES, out string? test);
|
||||
var sts2 = twain.GetCapHelp(CAP.ICAP_SUPPORTEDSIZES, out string? test2);
|
||||
var sts3 = twain.GetCapLabelEnum(CAP.ICAP_SUPPORTEDSIZES, out IList<string>? test3);
|
||||
|
||||
if (sts.RC == TWRC.SUCCESS || sts2.RC == TWRC.SUCCESS || sts3.RC == TWRC.SUCCESS)
|
||||
{
|
||||
Debugger.Break();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -232,6 +232,11 @@ namespace NTwain.Data
|
||||
//{
|
||||
// return new STS { RC = rc };
|
||||
//}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{RC} - {STATUS.ConditionCode}";
|
||||
}
|
||||
}
|
||||
|
||||
partial struct TW_STATUS
|
||||
|
@ -424,8 +424,6 @@ namespace NTwain.Data
|
||||
intptr += 2 * itemIndex;
|
||||
if (isEnum)
|
||||
{
|
||||
var shor = MarshalTo<short>(intptr);
|
||||
if (shor == 0x1125) Debugger.Break();
|
||||
return NumericToEnum<ushort, TValue>(MarshalTo<ushort>(intptr));
|
||||
}
|
||||
return MarshalTo<TValue>(intptr);
|
||||
|
@ -129,7 +129,7 @@ namespace NTwain
|
||||
/// <param name="cap"></param>
|
||||
/// <param name="labels"></param>
|
||||
/// <returns></returns>
|
||||
public STS GetCapLabelEnum(CAP cap, out string[]? labels)
|
||||
public STS GetCapLabelEnum(CAP cap, out IList<string>? labels)
|
||||
{
|
||||
labels = null;
|
||||
var value = new TW_CAPABILITY(cap);
|
||||
@ -137,7 +137,7 @@ namespace NTwain
|
||||
if (rc == TWRC.SUCCESS)
|
||||
{
|
||||
// spec says they're utf8
|
||||
labels = value.ReadArray<TW_STR255>(this, false).Select(t => t.Get(Encoding.UTF8)).ToArray();
|
||||
labels = value.ReadArray<TW_STR255>(this, false).Select(t => t.Get(Encoding.UTF8)).ToList();
|
||||
}
|
||||
value.Free(this);
|
||||
return WrapInSTS(rc);
|
||||
|
Loading…
Reference in New Issue
Block a user