mirror of
https://github.com/soukoku/ntwain.git
synced 2025-07-15 09:20:18 +08:00
Added quickie to open a source.
This commit is contained in:
parent
91c7e0f83e
commit
ac881c0438
@ -81,6 +81,13 @@ namespace NTwain
|
||||
/// <returns></returns>
|
||||
IEnumerable<TwainSource> GetSources();
|
||||
|
||||
/// <summary>
|
||||
/// Quick shortcut to open a source.
|
||||
/// </summary>
|
||||
/// <param name="sourceName">Name of the source.</param>
|
||||
/// <returns></returns>
|
||||
ReturnCode OpenSource(string sourceName);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the manager status. Only call this at state 2 or higher.
|
||||
/// </summary>
|
||||
|
@ -14,6 +14,6 @@ namespace NTwain
|
||||
// keep this same in majors releases
|
||||
public const string Release = "2.0.0.0";
|
||||
// change this for each nuget release
|
||||
public const string Build = "2.0.0";
|
||||
public const string Build = "2.0.1";
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
@ -332,6 +333,21 @@ namespace NTwain
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Quick shortcut to open a source.
|
||||
/// </summary>
|
||||
/// <param name="sourceName">Name of the source.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode OpenSource(string sourceName)
|
||||
{
|
||||
var hit = GetSources().Where(s => string.Equals(s.Name, sourceName)).FirstOrDefault();
|
||||
if (hit != null)
|
||||
{
|
||||
return hit.Open();
|
||||
}
|
||||
return ReturnCode.Failure;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the manager status. Only call this at state 2 or higher.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user