mirror of
https://github.com/soukoku/ntwain.git
synced 2026-02-25 13:04:07 +08:00
#37 CapabilityReader should not throw for no data
This commit is contained in:
@@ -35,18 +35,19 @@ namespace NTwain
|
||||
/// <param name="capability">The capability.</param>
|
||||
/// <param name="memoryManager">The memory manager.</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.ArgumentNullException">capability
|
||||
/// <exception cref="System.ArgumentNullException">
|
||||
/// capability
|
||||
/// or
|
||||
/// platformInfo</exception>
|
||||
/// <exception cref="System.ArgumentException">Capability contains no data.;capability
|
||||
/// or
|
||||
/// capability</exception>
|
||||
/// memoryManager
|
||||
/// </exception>
|
||||
/// <exception cref="System.ArgumentException">capability</exception>
|
||||
public static CapabilityReader ReadValue(TWCapability capability, IMemoryManager memoryManager)
|
||||
{
|
||||
if (capability == null) { throw new ArgumentNullException("capability"); }
|
||||
if (capability.Container == IntPtr.Zero) { throw new ArgumentException(Resources.CapHasNoData, "capability"); }
|
||||
if (memoryManager == null) { throw new ArgumentNullException("memoryManager"); }
|
||||
|
||||
if (capability.Container != IntPtr.Zero)
|
||||
{
|
||||
IntPtr baseAddr = IntPtr.Zero;
|
||||
try
|
||||
{
|
||||
@@ -86,6 +87,11 @@ namespace NTwain
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return new CapabilityReader();
|
||||
}
|
||||
}
|
||||
|
||||
#region common prop
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace NTwain
|
||||
/// <summary>
|
||||
/// The build release version number.
|
||||
/// </summary>
|
||||
public const string Build = "3.2.8"; // change this for each nuget release
|
||||
public const string Build = "3.3.0"; // change this for each nuget release
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user