mirror of
https://github.com/soukoku/ntwain.git
synced 2025-09-19 10:08:00 +08:00
Some internal refactoring.
This commit is contained in:
@@ -62,6 +62,28 @@ namespace NTwain
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies the session is within the specified state range (inclusive). Throws
|
||||
/// <see cref="TwainStateException" /> if violated.
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
/// <param name="allowedMinimum">The allowed minimum.</param>
|
||||
/// <param name="allowedMaximum">The allowed maximum.</param>
|
||||
/// <param name="group">The triplet data group.</param>
|
||||
/// <param name="dataArgumentType">The triplet data argument type.</param>
|
||||
/// <param name="message">The triplet message.</param>
|
||||
/// <exception cref="TwainStateException"></exception>
|
||||
internal static void VerifyState(this ITwainSessionInternal session, int allowedMinimum, int allowedMaximum, DataGroups group, DataArgumentType dataArgumentType, NTwain.Values.Message message)
|
||||
{
|
||||
if (session.EnforceState && (session.State < allowedMinimum || session.State > allowedMaximum))
|
||||
{
|
||||
throw new TwainStateException(session.State, allowedMinimum, allowedMaximum, group, dataArgumentType, message,
|
||||
string.Format("TWAIN state {0} does not match required range {1}-{2} for operation {3}-{4}-{5}.",
|
||||
session.State, allowedMinimum, allowedMaximum, group, dataArgumentType, message));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region common caps
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user