mirror of
https://github.com/soukoku/ntwain.git
synced 2025-10-25 19:19:03 +08:00
More sanity checks.
This commit is contained in:
@@ -1700,14 +1700,14 @@ namespace NTwain.Data
|
|||||||
{
|
{
|
||||||
return new TWIdentity
|
return new TWIdentity
|
||||||
{
|
{
|
||||||
Manufacturer = manufacturer ?? "UNKNOWN",
|
Manufacturer = string.IsNullOrEmpty(manufacturer) ? "UNKNOWN" : manufacturer,
|
||||||
ProtocolMajor = TwainConst.ProtocolMajor,
|
ProtocolMajor = TwainConst.ProtocolMajor,
|
||||||
ProtocolMinor = TwainConst.ProtocolMinor,
|
ProtocolMinor = TwainConst.ProtocolMinor,
|
||||||
DataGroup = DataGroups.Control | supportedGroups,
|
DataGroup = DataGroups.Control | supportedGroups,
|
||||||
DataFunctionalities = DataFunctionalities.App2,
|
DataFunctionalities = DataFunctionalities.App2,
|
||||||
|
|
||||||
ProductFamily = productFamily ?? "UNKNOWN",
|
ProductFamily = string.IsNullOrEmpty(productFamily) ? "UNKNOWN" : productFamily,
|
||||||
ProductName = productName ?? "UNKNOWN",
|
ProductName = string.IsNullOrEmpty(productName) ? "UNKNOWN" : productName,
|
||||||
Version = new TWVersion
|
Version = new TWVersion
|
||||||
{
|
{
|
||||||
Major = (short)version.Major,
|
Major = (short)version.Major,
|
||||||
|
|||||||
@@ -18,7 +18,10 @@ namespace Tester
|
|||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
// just an amusing example to do twain in console without UI
|
// just an amusing example to do twain in console without UI
|
||||||
DoTwainWork();
|
ThreadPool.QueueUserWorkItem(o =>
|
||||||
|
{
|
||||||
|
DoTwainWork();
|
||||||
|
});
|
||||||
Console.WriteLine("Test started, press Enter to exit.");
|
Console.WriteLine("Test started, press Enter to exit.");
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
}
|
}
|
||||||
@@ -66,6 +69,10 @@ namespace Tester
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to open dsm with rc={0}!", rc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void twain_SourceDisabled(object sender, EventArgs e)
|
static void twain_SourceDisabled(object sender, EventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user