mirror of
https://github.com/soukoku/ntwain.git
synced 2025-09-19 18:27:56 +08:00
Added quickie to open a source.
This commit is contained in:
@@ -81,6 +81,13 @@ namespace NTwain
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IEnumerable<TwainSource> GetSources();
|
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>
|
/// <summary>
|
||||||
/// Gets the manager status. Only call this at state 2 or higher.
|
/// Gets the manager status. Only call this at state 2 or higher.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -14,6 +14,6 @@ namespace NTwain
|
|||||||
// keep this same in majors releases
|
// keep this same in majors releases
|
||||||
public const string Release = "2.0.0.0";
|
public const string Release = "2.0.0.0";
|
||||||
// change this for each nuget release
|
// 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.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
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>
|
/// <summary>
|
||||||
/// Gets the manager status. Only call this at state 2 or higher.
|
/// Gets the manager status. Only call this at state 2 or higher.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Reference in New Issue
Block a user