Typo and other fixes.

This commit is contained in:
soukoku
2014-11-13 21:49:12 -05:00
parent d2134fbcd3
commit b4865c988e
13 changed files with 96 additions and 82 deletions

View File

@@ -15,14 +15,6 @@ namespace NTwain
/// <typeparam name="TValue">The TWAIN type of the value.</typeparam> /// <typeparam name="TValue">The TWAIN type of the value.</typeparam>
public class CapWrapper<TValue> : NTwain.ICapWrapper<TValue> public class CapWrapper<TValue> : NTwain.ICapWrapper<TValue>
{ {
/// <summary>
/// Routine that does nothing.
/// </summary>
/// <param name="value">The value.</param>
/// <returns></returns>
public static ReturnCode NoSetRoutine(TValue value) { return ReturnCode.Failure; }
ICapControl _source; ICapControl _source;
Func<object, TValue> _getConvertRoutine; Func<object, TValue> _getConvertRoutine;
Func<TValue, ReturnCode> _setCustomRoutine; Func<TValue, ReturnCode> _setCustomRoutine;
@@ -37,13 +29,13 @@ namespace NTwain
/// <exception cref="System.ArgumentNullException"> /// <exception cref="System.ArgumentNullException">
/// source /// source
/// or /// or
/// valueConversionRoutine /// getConversionRoutine
/// </exception> /// </exception>
public CapWrapper(ICapControl source, CapabilityId capability, public CapWrapper(ICapControl source, CapabilityId capability,
Func<object, TValue> getConversionRoutine) Func<object, TValue> getConversionRoutine)
{ {
if (source == null) { throw new ArgumentNullException("source"); } if (source == null) { throw new ArgumentNullException("source"); }
if (getConversionRoutine == null) { throw new ArgumentNullException("valueConversionRoutine"); } if (getConversionRoutine == null) { throw new ArgumentNullException("getConversionRoutine"); }
_source = source; _source = source;
_getConvertRoutine = getConversionRoutine; _getConvertRoutine = getConversionRoutine;
@@ -62,7 +54,7 @@ namespace NTwain
/// <exception cref="System.ArgumentNullException"> /// <exception cref="System.ArgumentNullException">
/// source /// source
/// or /// or
/// valueConversionRoutine /// getConversionRoutine
/// or /// or
/// setValueProvider /// setValueProvider
/// </exception> /// </exception>
@@ -71,7 +63,7 @@ namespace NTwain
Func<TValue, TWOneValue> setValueProvider) Func<TValue, TWOneValue> setValueProvider)
{ {
if (source == null) { throw new ArgumentNullException("source"); } if (source == null) { throw new ArgumentNullException("source"); }
if (getConversionRoutine == null) { throw new ArgumentNullException("valueConversionRoutine"); } if (getConversionRoutine == null) { throw new ArgumentNullException("getConversionRoutine"); }
if (setValueProvider == null) { throw new ArgumentNullException("setValueProvider"); } if (setValueProvider == null) { throw new ArgumentNullException("setValueProvider"); }
_source = source; _source = source;
@@ -87,11 +79,11 @@ namespace NTwain
/// <param name="source">The source.</param> /// <param name="source">The source.</param>
/// <param name="capability">The capability.</param> /// <param name="capability">The capability.</param>
/// <param name="getConversionRoutine">The value conversion routine in Get methods.</param> /// <param name="getConversionRoutine">The value conversion routine in Get methods.</param>
/// <param name="setValueRoutine">Callback to perform set value. Pass <see cref="NoSetRoutine"/> to not do sets.</param> /// <param name="setValueRoutine">Callback to perform set value.</param>
/// <exception cref="System.ArgumentNullException"> /// <exception cref="System.ArgumentNullException">
/// source /// source
/// or /// or
/// valueConversionRoutine /// getConversionRoutine
/// or /// or
/// setValueRoutine /// setValueRoutine
/// </exception> /// </exception>
@@ -100,7 +92,7 @@ namespace NTwain
Func<TValue, ReturnCode> setValueRoutine) Func<TValue, ReturnCode> setValueRoutine)
{ {
if (source == null) { throw new ArgumentNullException("source"); } if (source == null) { throw new ArgumentNullException("source"); }
if (getConversionRoutine == null) { throw new ArgumentNullException("valueConversionRoutine"); } if (getConversionRoutine == null) { throw new ArgumentNullException("getConversionRoutine"); }
if (setValueRoutine == null) { throw new ArgumentNullException("setValueRoutine"); } if (setValueRoutine == null) { throw new ArgumentNullException("setValueRoutine"); }
_source = source; _source = source;

View File

@@ -573,21 +573,21 @@ namespace NTwain.Data
_callBackProc = callback; _callBackProc = callback;
} }
/// <summary> ///// <summary>
/// An application defined reference constant. ///// An application defined reference constant.
/// </summary> ///// </summary>
/// <value> ///// <value>
/// The reference constant. ///// The reference constant.
/// </value> ///// </value>
public uint RefCon { get { return _refCon; } set { _refCon = value; } } //public uint RefCon { get { return _refCon; } set { _refCon = value; } }
/// <summary> ///// <summary>
/// Initialized to any valid DG_CONTROL / DAT_NULL message. ///// Initialized to any valid DG_CONTROL / DAT_NULL message.
/// </summary> ///// </summary>
/// <value> ///// <value>
/// The message. ///// The message.
/// </value> ///// </value>
public short Message { get { return _message; } set { _message = value; } } //public short Message { get { return _message; } set { _message = value; } }
} }
/// <summary> /// <summary>
/// Used in the Callback mechanism for sending messages from the Source to the Application. /// Used in the Callback mechanism for sending messages from the Source to the Application.
@@ -603,22 +603,22 @@ namespace NTwain.Data
_callBackProc = callback; _callBackProc = callback;
} }
/// <summary> ///// <summary>
/// An application defined reference constant. It has a different size on different ///// An application defined reference constant. It has a different size on different
/// platforms. ///// platforms.
/// </summary> ///// </summary>
/// <value> ///// <value>
/// The reference constant. ///// The reference constant.
/// </value> ///// </value>
public UIntPtr RefCon { get { return _refCon; } set { _refCon = value; } } //public UIntPtr RefCon { get { return _refCon; } set { _refCon = value; } }
/// <summary> ///// <summary>
/// Initialized to any valid DG_CONTROL / DAT_NULL message. ///// Initialized to any valid DG_CONTROL / DAT_NULL message.
/// </summary> ///// </summary>
/// <value> ///// <value>
/// The message. ///// The message.
/// </value> ///// </value>
public short Message { get { return _message; } set { _message = value; } } //public short Message { get { return _message; } set { _message = value; } }
} }
/// <summary> /// <summary>
@@ -1460,7 +1460,7 @@ namespace NTwain.Data
/// Try to reads the values from the <see cref="Item"/> property. /// Try to reads the values from the <see cref="Item"/> property.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<object> ReadValues() public IList<object> ReadValues()
{ {
var values = new List<object>(); var values = new List<object>();
if (NumItems > 0) if (NumItems > 0)
@@ -1566,7 +1566,12 @@ namespace NTwain.Data
/// image information. The application should allocate memory and fill in the /// image information. The application should allocate memory and fill in the
/// attribute tag for image information. /// attribute tag for image information.
/// </summary> /// </summary>
public uint NumInfos { get { return _numInfos; } set { _numInfos = value; } } public uint NumInfos
{
//get { return _numInfos; }
set { _numInfos = value; }
}
/// <summary> /// <summary>
/// Array of information. /// Array of information.
/// </summary> /// </summary>
@@ -2501,17 +2506,29 @@ namespace NTwain.Data
/// interface. Otherwise, set to FALSE. Note that not all sources support ShowUI = /// interface. Otherwise, set to FALSE. Note that not all sources support ShowUI =
/// FALSE. /// FALSE.
/// </summary> /// </summary>
public bool ShowUI { get { return _showUI > 0; } set { _showUI = value ? TwainConst.True : TwainConst.False; } } public bool ShowUI
{
get { return _showUI > 0; }
set { _showUI = value ? TwainConst.True : TwainConst.False; }
}
/// <summary> /// <summary>
/// If ShowUI is TRUE, then an application setting this to TRUE requests the Source to /// If ShowUI is TRUE, then an application setting this to TRUE requests the Source to
/// run Modal. /// run Modal.
/// </summary> /// </summary>
public bool ModalUI { get { return _modalUI > 0; } set { _modalUI = value ? TwainConst.True : TwainConst.False; } } public bool ModalUI
{
//get { return _modalUI > 0; }
set { _modalUI = value ? TwainConst.True : TwainConst.False; }
}
/// <summary> /// <summary>
/// Microsoft Windows only: Applications window handle. The Source designates /// Microsoft Windows only: Applications window handle. The Source designates
/// the hWnd as its parent when creating the Source dialog. /// the hWnd as its parent when creating the Source dialog.
/// </summary> /// </summary>
public IntPtr hParent { get { return _hParent; } set { _hParent = value; } } public IntPtr hParent
{
//get { return _hParent; }
set { _hParent = value; }
}
} }

View File

@@ -1179,7 +1179,7 @@ namespace NTwain.Data
Antigua = 8091, Antigua = 8091,
Argentina = 54, Argentina = 54,
Aruba = 297, Aruba = 297,
AscensionI = 247, AscensionIsland = 247,
Australia = 61, Australia = 61,
Austria = 43, Austria = 43,
Bahamas = 8092, Bahamas = 8092,
@@ -1194,7 +1194,7 @@ namespace NTwain.Data
Bolivia = 591, Bolivia = 591,
Botswana = 267, Botswana = 267,
Britain = 6, Britain = 6,
BritVirginIs = 8095, BritishVirginIslands = 8095,
Brazil = 55, Brazil = 55,
Brunei = 673, Brunei = 673,
Bulgaria = 359, Bulgaria = 359,
@@ -1203,14 +1203,14 @@ namespace NTwain.Data
Burundi = 1006, Burundi = 1006,
Camaroon = 237, Camaroon = 237,
Canada = 2, Canada = 2,
CapeVerdeIs = 238, CapeVerdeIslands = 238,
CaymanIs = 8096, CaymanIslands = 8096,
CentralAfrep = 1007, CentralAfricanRepublic = 1007,
Chad = 1008, Chad = 1008,
Chile = 56, Chile = 56,
China = 86, China = 86,
ChristmasIs = 1009, ChristmasIsland = 1009,
CocosLs = 1009, CocosIslands = 1009,
Colombia = 57, Colombia = 57,
Comoros = 1010, Comoros = 1010,
Congo = 1011, Congo = 1011,
@@ -1966,7 +1966,7 @@ namespace NTwain.Data
/// Corresponds to TWEJ_*. /// Corresponds to TWEJ_*.
/// </summary> /// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1028:EnumStorageShouldBeInt32")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1028:EnumStorageShouldBeInt32")]
public enum TWEJ : ushort public enum EndXferJob : ushort
{ {
None = 0x0000, None = 0x0000,
MidSeparator = 0x0001, MidSeparator = 0x0001,

View File

@@ -19,12 +19,12 @@ namespace NTwain
/// <summary> /// <summary>
/// Gets the actual supported operations for a capability. /// Gets the actual supported operations for a capability.
/// </summary> /// </summary>
/// <param name="capId">The cap identifier.</param> /// <param name="capabilityId">The capability id.</param>
/// <returns></returns> /// <returns></returns>
public QuerySupports CapQuerySupport(CapabilityId capId) public QuerySupports CapQuerySupport(CapabilityId capabilityId)
{ {
QuerySupports retVal = QuerySupports.None; QuerySupports retVal = QuerySupports.None;
using (TWCapability cap = new TWCapability(capId)) using (TWCapability cap = new TWCapability(capabilityId))
{ {
var rc = _session.DGControl.Capability.QuerySupport(cap); var rc = _session.DGControl.Capability.QuerySupport(cap);
if (rc == ReturnCode.Success) if (rc == ReturnCode.Success)
@@ -43,11 +43,11 @@ namespace NTwain
/// <summary> /// <summary>
/// Gets the current value for a capability. /// Gets the current value for a capability.
/// </summary> /// </summary>
/// <param name="capId">The cap id.</param> /// <param name="capabilityId">The capability id.</param>
/// <returns></returns> /// <returns></returns>
public object CapGetCurrent(CapabilityId capId) public object CapGetCurrent(CapabilityId capabilityId)
{ {
using (TWCapability cap = new TWCapability(capId)) using (TWCapability cap = new TWCapability(capabilityId))
{ {
var rc = _session.DGControl.Capability.GetCurrent(cap); var rc = _session.DGControl.Capability.GetCurrent(cap);
if (rc == ReturnCode.Success) if (rc == ReturnCode.Success)
@@ -82,11 +82,11 @@ namespace NTwain
/// <summary> /// <summary>
/// Gets the default value for a capability. /// Gets the default value for a capability.
/// </summary> /// </summary>
/// <param name="capId">The cap id.</param> /// <param name="capabilityId">The capability id.</param>
/// <returns></returns> /// <returns></returns>
public object CapGetDefault(CapabilityId capId) public object CapGetDefault(CapabilityId capabilityId)
{ {
using (TWCapability cap = new TWCapability(capId)) using (TWCapability cap = new TWCapability(capabilityId))
{ {
var rc = _session.DGControl.Capability.GetDefault(cap); var rc = _session.DGControl.Capability.GetDefault(cap);
if (rc == ReturnCode.Success) if (rc == ReturnCode.Success)
@@ -121,7 +121,7 @@ namespace NTwain
/// <summary> /// <summary>
/// A general method that tries to get capability values from current <see cref="DataSource" />. /// A general method that tries to get capability values from current <see cref="DataSource" />.
/// </summary> /// </summary>
/// <param name="capabilityId">The capability unique identifier.</param> /// <param name="capabilityId">The capability id.</param>
/// <returns></returns> /// <returns></returns>
public IList<object> CapGet(CapabilityId capabilityId) public IList<object> CapGet(CapabilityId capabilityId)
{ {
@@ -153,7 +153,7 @@ namespace NTwain
/// <summary> /// <summary>
/// Resets the current value to power-on default. /// Resets the current value to power-on default.
/// </summary> /// </summary>
/// <param name="capabilityId">The capability identifier.</param> /// <param name="capabilityId">The capability id.</param>
/// <returns></returns> /// <returns></returns>
public ReturnCode CapReset(CapabilityId capabilityId) public ReturnCode CapReset(CapabilityId capabilityId)
{ {

View File

@@ -1,6 +1,7 @@
using NTwain.Data; using NTwain.Data;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
namespace NTwain namespace NTwain
@@ -105,7 +106,7 @@ namespace NTwain
var request = new TWExtImageInfo { NumInfos = (uint)infoIds.Length }; var request = new TWExtImageInfo { NumInfos = (uint)infoIds.Length };
if (infoIds.Length > request.Info.Length) if (infoIds.Length > request.Info.Length)
{ {
throw new InvalidOperationException(string.Format("Info ID array excdd maximum length of {0}.", request.Info.Length)); throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Info ID array exceeded maximum length of {0}.", request.Info.Length));
} }
for (int i = 0; i < infoIds.Length; i++) for (int i = 0; i < infoIds.Length; i++)

View File

@@ -28,7 +28,7 @@ namespace NTwain
/// <value> /// <value>
/// <c>true</c> if the application is 64-bit; otherwise, <c>false</c>. /// <c>true</c> if the application is 64-bit; otherwise, <c>false</c>.
/// </value> /// </value>
bool IsApp64bit { get; } bool IsApp64Bit { get; }
/// <summary> /// <summary>
/// Gets a value indicating whether this library is supported on current OS. /// Gets a value indicating whether this library is supported on current OS.

View File

@@ -278,7 +278,7 @@ namespace NTwain.Internals
var xrc = ReturnCode.Success; var xrc = ReturnCode.Success;
do do
{ {
xrc = session.DGImage.ImageMemFileXfer.Get(xferInfo); xrc = session.DGImage.ImageMemXfer.Get(xferInfo);
if (xrc == ReturnCode.Success || if (xrc == ReturnCode.Success ||
xrc == ReturnCode.XferDone) xrc == ReturnCode.XferDone)

View File

@@ -25,7 +25,7 @@ namespace NTwain
PlatformInfo() PlatformInfo()
{ {
IsApp64bit = IntPtr.Size == 8; IsApp64Bit = IntPtr.Size == 8;
IsOnMono = Type.GetType("Mono.Runtime") != null; IsOnMono = Type.GetType("Mono.Runtime") != null;
IsWindows = Environment.OSVersion.Platform == PlatformID.Win32NT; IsWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
@@ -36,7 +36,7 @@ namespace NTwain
var newDsmPath = Path.Combine(Environment.SystemDirectory, Dsm.WIN_NEW_DSM_NAME); var newDsmPath = Path.Combine(Environment.SystemDirectory, Dsm.WIN_NEW_DSM_NAME);
var oldDsmPath = Path.Combine(Environment.SystemDirectory, Dsm.WIN_OLD_DSM_NAME); var oldDsmPath = Path.Combine(Environment.SystemDirectory, Dsm.WIN_OLD_DSM_NAME);
if (IsApp64bit) if (IsApp64Bit)
{ {
ExpectedDsmPath = newDsmPath; ExpectedDsmPath = newDsmPath;
IsSupported = DsmExists = File.Exists(ExpectedDsmPath); IsSupported = DsmExists = File.Exists(ExpectedDsmPath);
@@ -81,7 +81,7 @@ namespace NTwain
/// <value> /// <value>
/// <c>true</c> if the application is 64-bit; otherwise, <c>false</c>. /// <c>true</c> if the application is 64-bit; otherwise, <c>false</c>.
/// </value> /// </value>
public bool IsApp64bit { get; private set; } public bool IsApp64Bit { get; private set; }
/// <summary> /// <summary>
/// Gets a value indicating whether the applicable TWAIN DSM library exists in the operating system. /// Gets a value indicating whether the applicable TWAIN DSM library exists in the operating system.

View File

@@ -12,7 +12,7 @@ namespace NTwain
/// <summary> /// <summary>
/// Contains version info of this assembly. /// Contains version info of this assembly.
/// </summary> /// </summary>
public class NTwainVersionInfo static class NTwainVersionInfo
{ {
/// <summary> /// <summary>
/// The major release version number. /// The major release version number.
@@ -23,7 +23,7 @@ namespace NTwain
/// <summary> /// <summary>
/// The build release version number. /// The build release version number.
/// </summary> /// </summary>
public const string Build = "3.2.0"; // change this for each nuget release public const string Build = "3.2.1"; // change this for each nuget release
} }

View File

@@ -73,7 +73,8 @@ namespace NTwain
} }
DGControl _dgControl; DGControl _dgControl;
DGControl ITripletControl.DGControl DGControl ITripletControl.DGControl { get { return DGControl; } }
protected DGControl DGControl
{ {
get get
{ {
@@ -82,8 +83,10 @@ namespace NTwain
} }
} }
DGImage _dgImage; DGImage _dgImage;
DGImage ITripletControl.DGImage DGImage ITripletControl.DGImage { get { return DGImage; } }
protected DGImage DGImage
{ {
get get
{ {
@@ -93,7 +96,8 @@ namespace NTwain
} }
DGCustom _dgCustom; DGCustom _dgCustom;
DGCustom ITripletControl.DGCustom DGCustom ITripletControl.DGCustom { get { return DGCustom; } }
protected DGCustom DGCustom
{ {
get get
{ {

View File

@@ -11,7 +11,7 @@ namespace Tester
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
if (PlatformInfo.Current.IsApp64bit) if (PlatformInfo.Current.IsApp64Bit)
{ {
Console.WriteLine("[64bit]"); Console.WriteLine("[64bit]");
} }

View File

@@ -25,7 +25,7 @@ namespace Tester.WPF
InitializeComponent(); InitializeComponent();
if (!DesignerProperties.GetIsInDesignMode(this)) if (!DesignerProperties.GetIsInDesignMode(this))
{ {
if (IntPtr.Size == 8) if (PlatformInfo.Current.IsApp64Bit)
{ {
Title = Title + " (64bit)"; Title = Title + " (64bit)";
} }

View File

@@ -25,7 +25,7 @@ namespace Tester.Winform
public TestForm() public TestForm()
{ {
InitializeComponent(); InitializeComponent();
if (IntPtr.Size == 8) if (NTwain.PlatformInfo.Current.IsApp64Bit)
{ {
Text = Text + " (64bit)"; Text = Text + " (64bit)";
} }