Added cap enum map idea.

This commit is contained in:
Eugene Wang
2023-04-08 15:20:38 -04:00
parent f015e82682
commit 7acbdb5e41
3 changed files with 161 additions and 4 deletions

View File

@@ -161,10 +161,11 @@ namespace WinFormSample
if (twain.GetCapCurrent(c, out TW_CAPABILITY twcap).RC == TWRC.SUCCESS)
{
var type = twcap.DetermineValueType(twain);
it.SubItems.Add(type.ToString());
it.SubItems.Add(ReadTypedValue(c, type, forCurrent: true));
it.SubItems.Add(ReadTypedValue(c, type, forCurrent: false));
var enumType = KnownCapEnumMap.GetEnumType(c);
var realType = twcap.DetermineValueType(twain);
it.SubItems.Add(enumType?.Name.ToString() ?? realType.ToString());
it.SubItems.Add(ReadTypedValue(c, realType, forCurrent: true));
it.SubItems.Add(ReadTypedValue(c, realType, forCurrent: false));
}
else
{

View File

@@ -1,5 +1,8 @@
using NTwain.Data;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace WinFormSample