mirror of
https://github.com/soukoku/ntwain.git
synced 2025-11-08 02:24:46 +08:00
Typos and others.
This commit is contained in:
@@ -43,8 +43,8 @@
|
|||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\NTwain\CapabilityReadout.cs">
|
<Compile Include="..\NTwain\CapabilityReader.cs">
|
||||||
<Link>CapabilityReadout.cs</Link>
|
<Link>CapabilityReader.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="..\NTwain\DataTransferredEventArgs.cs">
|
<Compile Include="..\NTwain\DataTransferredEventArgs.cs">
|
||||||
<Link>DataTransferredEventArgs.cs</Link>
|
<Link>DataTransferredEventArgs.cs</Link>
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ using System.Runtime.InteropServices;
|
|||||||
namespace NTwain
|
namespace NTwain
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The one-stop class for reading TWAIN cap values.
|
/// The one-stop class for reading raw TWAIN cap values.
|
||||||
/// This contains all the properties for the 4 container types.
|
/// This contains all the properties for the 4 container types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CapabilityReadOut
|
public class CapabilityReader
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads the value from a <see cref="TWCapability"/> that was returned
|
/// Reads the value from a <see cref="TWCapability"/> that was returned
|
||||||
@@ -25,7 +25,7 @@ namespace NTwain
|
|||||||
/// or
|
/// or
|
||||||
/// capability
|
/// capability
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public static CapabilityReadOut ReadValue(TWCapability capability)
|
public static CapabilityReader ReadValue(TWCapability capability)
|
||||||
{
|
{
|
||||||
if (capability == null) { throw new ArgumentNullException("capability"); }
|
if (capability == null) { throw new ArgumentNullException("capability"); }
|
||||||
if (capability.Container == IntPtr.Zero) { throw new ArgumentException(Resources.CapHasNoData, "capability"); }
|
if (capability.Container == IntPtr.Zero) { throw new ArgumentException(Resources.CapHasNoData, "capability"); }
|
||||||
@@ -37,22 +37,22 @@ namespace NTwain
|
|||||||
switch (capability.ContainerType)
|
switch (capability.ContainerType)
|
||||||
{
|
{
|
||||||
case ContainerType.Array:
|
case ContainerType.Array:
|
||||||
return new CapabilityReadOut
|
return new CapabilityReader
|
||||||
{
|
{
|
||||||
ContainerType = capability.ContainerType,
|
ContainerType = capability.ContainerType,
|
||||||
}.ReadArrayValue(baseAddr);
|
}.ReadArrayValue(baseAddr);
|
||||||
case ContainerType.Enum:
|
case ContainerType.Enum:
|
||||||
return new CapabilityReadOut
|
return new CapabilityReader
|
||||||
{
|
{
|
||||||
ContainerType = capability.ContainerType,
|
ContainerType = capability.ContainerType,
|
||||||
}.ReadEnumValue(baseAddr);
|
}.ReadEnumValue(baseAddr);
|
||||||
case ContainerType.OneValue:
|
case ContainerType.OneValue:
|
||||||
return new CapabilityReadOut
|
return new CapabilityReader
|
||||||
{
|
{
|
||||||
ContainerType = capability.ContainerType,
|
ContainerType = capability.ContainerType,
|
||||||
}.ReadOneValue(baseAddr);
|
}.ReadOneValue(baseAddr);
|
||||||
case ContainerType.Range:
|
case ContainerType.Range:
|
||||||
return new CapabilityReadOut
|
return new CapabilityReader
|
||||||
{
|
{
|
||||||
ContainerType = capability.ContainerType,
|
ContainerType = capability.ContainerType,
|
||||||
}.ReadRangeValue(baseAddr);
|
}.ReadRangeValue(baseAddr);
|
||||||
@@ -161,7 +161,7 @@ namespace NTwain
|
|||||||
|
|
||||||
#region reader methods
|
#region reader methods
|
||||||
|
|
||||||
CapabilityReadOut ReadOneValue(IntPtr baseAddr)
|
CapabilityReader ReadOneValue(IntPtr baseAddr)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
ItemType = (ItemType)(ushort)Marshal.ReadInt16(baseAddr, offset);
|
ItemType = (ItemType)(ushort)Marshal.ReadInt16(baseAddr, offset);
|
||||||
@@ -170,7 +170,7 @@ namespace NTwain
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CapabilityReadOut ReadArrayValue(IntPtr baseAddr)
|
CapabilityReader ReadArrayValue(IntPtr baseAddr)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
ItemType = (ItemType)(ushort)Marshal.ReadInt16(baseAddr, offset);
|
ItemType = (ItemType)(ushort)Marshal.ReadInt16(baseAddr, offset);
|
||||||
@@ -188,7 +188,7 @@ namespace NTwain
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CapabilityReadOut ReadEnumValue(IntPtr baseAddr)
|
CapabilityReader ReadEnumValue(IntPtr baseAddr)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
ItemType = (ItemType)(ushort)Marshal.ReadInt16(baseAddr, offset);
|
ItemType = (ItemType)(ushort)Marshal.ReadInt16(baseAddr, offset);
|
||||||
@@ -210,7 +210,7 @@ namespace NTwain
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CapabilityReadOut ReadRangeValue(IntPtr baseAddr)
|
CapabilityReader ReadRangeValue(IntPtr baseAddr)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
ItemType = (ItemType)(ushort)Marshal.ReadInt16(baseAddr, offset);
|
ItemType = (ItemType)(ushort)Marshal.ReadInt16(baseAddr, offset);
|
||||||
@@ -926,7 +926,7 @@ namespace NTwain.Data
|
|||||||
{
|
{
|
||||||
if (toPopulate == null) { toPopulate = new List<object>(); }
|
if (toPopulate == null) { toPopulate = new List<object>(); }
|
||||||
|
|
||||||
var read = CapabilityReadOut.ReadValue(this);
|
var read = CapabilityReader.ReadValue(this);
|
||||||
|
|
||||||
switch (read.ContainerType)
|
switch (read.ContainerType)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -93,14 +93,12 @@ namespace NTwain
|
|||||||
/// <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>
|
||||||
/// <param name="session">The session.</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
TWStatus GetStatus();
|
TWStatus GetStatus();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the manager status. Only call this at state 3 or higher.
|
/// Gets the manager status. Only call this at state 3 or higher.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="session">The session.</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
TWStatusUtf8 GetStatusUtf8();
|
TWStatusUtf8 GetStatusUtf8();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="CapabilityReadout.cs" />
|
<Compile Include="CapabilityReader.cs" />
|
||||||
<Compile Include="Data\TypeReader.cs" />
|
<Compile Include="Data\TypeReader.cs" />
|
||||||
<Compile Include="Data\TwainTypesExtended.cs" />
|
<Compile Include="Data\TwainTypesExtended.cs" />
|
||||||
<Compile Include="DeviceEventArgs.cs" />
|
<Compile Include="DeviceEventArgs.cs" />
|
||||||
|
|||||||
@@ -318,7 +318,6 @@ namespace NTwain
|
|||||||
/// <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>
|
||||||
/// <param name="session">The session.</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public TWStatus GetStatus()
|
public TWStatus GetStatus()
|
||||||
{
|
{
|
||||||
@@ -330,7 +329,6 @@ namespace NTwain
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the manager status. Only call this at state 3 or higher.
|
/// Gets the manager status. Only call this at state 3 or higher.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="session">The session.</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public TWStatusUtf8 GetStatusUtf8()
|
public TWStatusUtf8 GetStatusUtf8()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace NTwain
|
|||||||
var rc = _session.DGControl.Capability.QuerySupport(cap);
|
var rc = _session.DGControl.Capability.QuerySupport(cap);
|
||||||
if (rc == ReturnCode.Success)
|
if (rc == ReturnCode.Success)
|
||||||
{
|
{
|
||||||
var read = CapabilityReadOut.ReadValue(cap);
|
var read = CapabilityReader.ReadValue(cap);
|
||||||
|
|
||||||
if (read.ContainerType == ContainerType.OneValue)
|
if (read.ContainerType == ContainerType.OneValue)
|
||||||
{
|
{
|
||||||
@@ -44,7 +44,7 @@ namespace NTwain
|
|||||||
var rc = _session.DGControl.Capability.GetCurrent(cap);
|
var rc = _session.DGControl.Capability.GetCurrent(cap);
|
||||||
if (rc == ReturnCode.Success)
|
if (rc == ReturnCode.Success)
|
||||||
{
|
{
|
||||||
var read = CapabilityReadOut.ReadValue(cap);
|
var read = CapabilityReader.ReadValue(cap);
|
||||||
|
|
||||||
switch (read.ContainerType)
|
switch (read.ContainerType)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace NTwain
|
|||||||
|
|
||||||
internal static TwainSource GetInstance(ITwainSessionInternal session, TWIdentity sourceId)
|
internal static TwainSource GetInstance(ITwainSessionInternal session, TWIdentity sourceId)
|
||||||
{
|
{
|
||||||
var key = string.Format("{0}|{1}", sourceId.Manufacturer, sourceId.ProductFamily, sourceId.ProductName);
|
var key = string.Format(CultureInfo.InvariantCulture, "{0}|{1}|{2}", sourceId.Manufacturer, sourceId.ProductFamily, sourceId.ProductName);
|
||||||
if (__globalInstances.ContainsKey(key))
|
if (__globalInstances.ContainsKey(key))
|
||||||
{
|
{
|
||||||
return __globalInstances[key];
|
return __globalInstances[key];
|
||||||
@@ -88,7 +88,6 @@ namespace NTwain
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the source status. Only call this at state 4 or higher.
|
/// Gets the source status. Only call this at state 4 or higher.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="session">The session.</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public TWStatus GetStatus()
|
public TWStatus GetStatus()
|
||||||
{
|
{
|
||||||
@@ -99,7 +98,6 @@ namespace NTwain
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the source status. Only call this at state 4 or higher.
|
/// Gets the source status. Only call this at state 4 or higher.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="session">The session.</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public TWStatusUtf8 GetStatusUtf8()
|
public TWStatusUtf8 GetStatusUtf8()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user