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>
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;
Func<object, TValue> _getConvertRoutine;
Func<TValue, ReturnCode> _setCustomRoutine;
@ -37,13 +29,13 @@ namespace NTwain
/// <exception cref="System.ArgumentNullException">
/// source
/// or
/// valueConversionRoutine
/// getConversionRoutine
/// </exception>
public CapWrapper(ICapControl source, CapabilityId capability,
Func<object, TValue> getConversionRoutine)
{
if (source == null) { throw new ArgumentNullException("source"); }
if (getConversionRoutine == null) { throw new ArgumentNullException("valueConversionRoutine"); }
if (getConversionRoutine == null) { throw new ArgumentNullException("getConversionRoutine"); }
_source = source;
_getConvertRoutine = getConversionRoutine;
@ -62,7 +54,7 @@ namespace NTwain
/// <exception cref="System.ArgumentNullException">
/// source
/// or
/// valueConversionRoutine
/// getConversionRoutine
/// or
/// setValueProvider
/// </exception>
@ -71,7 +63,7 @@ namespace NTwain
Func<TValue, TWOneValue> setValueProvider)
{
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"); }
_source = source;
@ -87,11 +79,11 @@ namespace NTwain
/// <param name="source">The source.</param>
/// <param name="capability">The capability.</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">
/// source
/// or
/// valueConversionRoutine
/// getConversionRoutine
/// or
/// setValueRoutine
/// </exception>
@ -100,7 +92,7 @@ namespace NTwain
Func<TValue, ReturnCode> setValueRoutine)
{
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"); }
_source = source;

View File

@ -573,21 +573,21 @@ namespace NTwain.Data
_callBackProc = callback;
}
/// <summary>
/// An application defined reference constant.
/// </summary>
/// <value>
/// The reference constant.
/// </value>
public uint RefCon { get { return _refCon; } set { _refCon = value; } }
///// <summary>
///// An application defined reference constant.
///// </summary>
///// <value>
///// The reference constant.
///// </value>
//public uint RefCon { get { return _refCon; } set { _refCon = value; } }
/// <summary>
/// Initialized to any valid DG_CONTROL / DAT_NULL message.
/// </summary>
/// <value>
/// The message.
/// </value>
public short Message { get { return _message; } set { _message = value; } }
///// <summary>
///// Initialized to any valid DG_CONTROL / DAT_NULL message.
///// </summary>
///// <value>
///// The message.
///// </value>
//public short Message { get { return _message; } set { _message = value; } }
}
/// <summary>
/// Used in the Callback mechanism for sending messages from the Source to the Application.
@ -603,22 +603,22 @@ namespace NTwain.Data
_callBackProc = callback;
}
/// <summary>
/// An application defined reference constant. It has a different size on different
/// platforms.
/// </summary>
/// <value>
/// The reference constant.
/// </value>
public UIntPtr RefCon { get { return _refCon; } set { _refCon = value; } }
///// <summary>
///// An application defined reference constant. It has a different size on different
///// platforms.
///// </summary>
///// <value>
///// The reference constant.
///// </value>
//public UIntPtr RefCon { get { return _refCon; } set { _refCon = value; } }
/// <summary>
/// Initialized to any valid DG_CONTROL / DAT_NULL message.
/// </summary>
/// <value>
/// The message.
/// </value>
public short Message { get { return _message; } set { _message = value; } }
///// <summary>
///// Initialized to any valid DG_CONTROL / DAT_NULL message.
///// </summary>
///// <value>
///// The message.
///// </value>
//public short Message { get { return _message; } set { _message = value; } }
}
/// <summary>
@ -1460,7 +1460,7 @@ namespace NTwain.Data
/// Try to reads the values from the <see cref="Item"/> property.
/// </summary>
/// <returns></returns>
public List<object> ReadValues()
public IList<object> ReadValues()
{
var values = new List<object>();
if (NumItems > 0)
@ -1566,7 +1566,12 @@ namespace NTwain.Data
/// image information. The application should allocate memory and fill in the
/// attribute tag for image information.
/// </summary>
public uint NumInfos { get { return _numInfos; } set { _numInfos = value; } }
public uint NumInfos
{
//get { return _numInfos; }
set { _numInfos = value; }
}
/// <summary>
/// Array of information.
/// </summary>
@ -2501,17 +2506,29 @@ namespace NTwain.Data
/// interface. Otherwise, set to FALSE. Note that not all sources support ShowUI =
/// FALSE.
/// </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>
/// If ShowUI is TRUE, then an application setting this to TRUE requests the Source to
/// run Modal.
/// </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>
/// Microsoft Windows only: Applications window handle. The Source designates
/// the hWnd as its parent when creating the Source dialog.
/// </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,
Argentina = 54,
Aruba = 297,
AscensionI = 247,
AscensionIsland = 247,
Australia = 61,
Austria = 43,
Bahamas = 8092,
@ -1194,7 +1194,7 @@ namespace NTwain.Data
Bolivia = 591,
Botswana = 267,
Britain = 6,
BritVirginIs = 8095,
BritishVirginIslands = 8095,
Brazil = 55,
Brunei = 673,
Bulgaria = 359,
@ -1203,14 +1203,14 @@ namespace NTwain.Data
Burundi = 1006,
Camaroon = 237,
Canada = 2,
CapeVerdeIs = 238,
CaymanIs = 8096,
CentralAfrep = 1007,
CapeVerdeIslands = 238,
CaymanIslands = 8096,
CentralAfricanRepublic = 1007,
Chad = 1008,
Chile = 56,
China = 86,
ChristmasIs = 1009,
CocosLs = 1009,
ChristmasIsland = 1009,
CocosIslands = 1009,
Colombia = 57,
Comoros = 1010,
Congo = 1011,
@ -1966,7 +1966,7 @@ namespace NTwain.Data
/// Corresponds to TWEJ_*.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1028:EnumStorageShouldBeInt32")]
public enum TWEJ : ushort
public enum EndXferJob : ushort
{
None = 0x0000,
MidSeparator = 0x0001,

View File

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

View File

@ -1,6 +1,7 @@
using NTwain.Data;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace NTwain
@ -105,7 +106,7 @@ namespace NTwain
var request = new TWExtImageInfo { NumInfos = (uint)infoIds.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++)

View File

@ -28,7 +28,7 @@ namespace NTwain
/// <value>
/// <c>true</c> if the application is 64-bit; otherwise, <c>false</c>.
/// </value>
bool IsApp64bit { get; }
bool IsApp64Bit { get; }
/// <summary>
/// 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;
do
{
xrc = session.DGImage.ImageMemFileXfer.Get(xferInfo);
xrc = session.DGImage.ImageMemXfer.Get(xferInfo);
if (xrc == ReturnCode.Success ||
xrc == ReturnCode.XferDone)

View File

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

View File

@ -12,7 +12,7 @@ namespace NTwain
/// <summary>
/// Contains version info of this assembly.
/// </summary>
public class NTwainVersionInfo
static class NTwainVersionInfo
{
/// <summary>
/// The major release version number.
@ -23,7 +23,7 @@ namespace NTwain
/// <summary>
/// The build release version number.
/// </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 ITripletControl.DGControl
DGControl ITripletControl.DGControl { get { return DGControl; } }
protected DGControl DGControl
{
get
{
@ -82,8 +83,10 @@ namespace NTwain
}
}
DGImage _dgImage;
DGImage ITripletControl.DGImage
DGImage ITripletControl.DGImage { get { return DGImage; } }
protected DGImage DGImage
{
get
{
@ -93,7 +96,8 @@ namespace NTwain
}
DGCustom _dgCustom;
DGCustom ITripletControl.DGCustom
DGCustom ITripletControl.DGCustom { get { return DGCustom; } }
protected DGCustom DGCustom
{
get
{

View File

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

View File

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

View File

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