mirror of
https://github.com/soukoku/ntwain.git
synced 2025-09-18 17:47:57 +08:00
Test idea of wrapping source identity into .net class.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using NTwain.Internals;
|
||||
using NTwain.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
@@ -913,6 +914,48 @@ namespace NTwain.Data
|
||||
Dispose(false);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A general method that returns the data in a <see cref="TWCapability" />.
|
||||
/// </summary>
|
||||
/// <param name="toPopulate">The list to populate if necessary.</param>
|
||||
/// <returns></returns>
|
||||
public IList<object> ReadMultiCapValues(IList<object> toPopulate)
|
||||
{
|
||||
if (toPopulate == null) { toPopulate = new List<object>(); }
|
||||
|
||||
var read = CapabilityReadOut.ReadValue(this);
|
||||
|
||||
switch (read.ContainerType)
|
||||
{
|
||||
case ContainerType.OneValue:
|
||||
if (read.OneValue != null)
|
||||
{
|
||||
toPopulate.Add(read.OneValue);
|
||||
}
|
||||
break;
|
||||
case ContainerType.Array:
|
||||
case ContainerType.Enum:
|
||||
if (read.CollectionValues != null)
|
||||
{
|
||||
foreach (var o in read.CollectionValues)
|
||||
{
|
||||
toPopulate.Add(o);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ContainerType.Range:
|
||||
for (var i = read.RangeMinValue; i <= read.RangeMaxValue; i += read.RangeStepSize)
|
||||
{
|
||||
toPopulate.Add(i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return toPopulate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user