mirror of
https://github.com/soukoku/ntwain.git
synced 2026-02-25 13:04:07 +08:00
Random non-functional changes.
This commit is contained in:
@@ -3,10 +3,7 @@ using System;
|
|||||||
|
|
||||||
namespace NTwain
|
namespace NTwain
|
||||||
{
|
{
|
||||||
/// <summary>
|
static class Extensions
|
||||||
/// Some utility stuff.
|
|
||||||
/// </summary>
|
|
||||||
public static class Extensions
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Verifies the string length is under the maximum length
|
/// Verifies the string length is under the maximum length
|
||||||
|
|||||||
@@ -10,10 +10,11 @@ namespace NTwain
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MemoryManager : IMemoryManager
|
public class MemoryManager : IMemoryManager
|
||||||
{
|
{
|
||||||
|
static readonly MemoryManager _instance = new MemoryManager();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the singleton <see cref="MemoryManager"/> instance.
|
/// Gets the singleton <see cref="MemoryManager"/> instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly MemoryManager Instance = new MemoryManager();
|
public static MemoryManager Instance { get { return _instance; } }
|
||||||
|
|
||||||
private MemoryManager() { }
|
private MemoryManager() { }
|
||||||
|
|
||||||
@@ -49,7 +50,7 @@ namespace NTwain
|
|||||||
|
|
||||||
if (retVal == IntPtr.Zero)
|
if (retVal == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new OutOfMemoryException(Resources.MemAllocError);
|
throw new OutOfMemoryException();
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|||||||
9
NTwain/Properties/Resources.Designer.cs
generated
9
NTwain/Properties/Resources.Designer.cs
generated
@@ -96,15 +96,6 @@ namespace NTwain.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Failed to allocate requested memory..
|
|
||||||
/// </summary>
|
|
||||||
internal static string MemAllocError {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("MemAllocError", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Message loop has not started yet..
|
/// Looks up a localized string similar to Message loop has not started yet..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -129,9 +129,6 @@
|
|||||||
<data name="MaxStringLengthExceeded" xml:space="preserve">
|
<data name="MaxStringLengthExceeded" xml:space="preserve">
|
||||||
<value>The string value has exceeded the maximum length allowed.</value>
|
<value>The string value has exceeded the maximum length allowed.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="MemAllocError" xml:space="preserve">
|
|
||||||
<value>Failed to allocate requested memory.</value>
|
|
||||||
</data>
|
|
||||||
<data name="MsgLoopUnavailble" xml:space="preserve">
|
<data name="MsgLoopUnavailble" xml:space="preserve">
|
||||||
<value>Message loop has not started yet.</value>
|
<value>Message loop has not started yet.</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using System.Threading;
|
|||||||
namespace NTwain
|
namespace NTwain
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Basic class for interfacing with TWAIN.
|
/// Basic class for interfacing with TWAIN. You should only have one of this per application process.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TwainSession : ITwainStateInternal, ITwainOperation
|
public class TwainSession : ITwainStateInternal, ITwainOperation
|
||||||
{
|
{
|
||||||
@@ -270,7 +270,7 @@ namespace NTwain
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public ReturnCode CloseManager()
|
public ReturnCode CloseManager()
|
||||||
{
|
{
|
||||||
ReturnCode rc = ReturnCode.Failure;
|
var rc = ReturnCode.Failure;
|
||||||
MessageLoop.Instance.Invoke(() =>
|
MessageLoop.Instance.Invoke(() =>
|
||||||
{
|
{
|
||||||
Debug.WriteLine(string.Format("Thread {0}: CloseManager.", Thread.CurrentThread.ManagedThreadId));
|
Debug.WriteLine(string.Format("Thread {0}: CloseManager.", Thread.CurrentThread.ManagedThreadId));
|
||||||
@@ -282,17 +282,17 @@ namespace NTwain
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads the specified source into main memory and causes its initialization.
|
/// Loads the specified source into main memory and causes its initialization.
|
||||||
/// Calls to this must be followed by
|
/// Calls to this must be followed by
|
||||||
/// <see cref="CloseSource" /> when not using it anymore.
|
/// <see cref="CloseSource" /> when not using it anymore.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sourceProductName">Name of the source.</param>
|
/// <param name="sourceProductName">Name of the source.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="ArgumentException">Source name is required.;sourceProductName</exception>
|
/// <exception cref="System.ArgumentException">sourceProductName</exception>
|
||||||
public ReturnCode OpenSource(string sourceProductName)
|
public ReturnCode OpenSource(string sourceProductName)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(sourceProductName)) { throw new ArgumentException(Resources.SourceRequired, "sourceProductName"); }
|
if (string.IsNullOrEmpty(sourceProductName)) { throw new ArgumentException(Resources.SourceRequired, "sourceProductName"); }
|
||||||
|
|
||||||
ReturnCode rc = ReturnCode.Failure;
|
var rc = ReturnCode.Failure;
|
||||||
MessageLoop.Instance.Invoke(() =>
|
MessageLoop.Instance.Invoke(() =>
|
||||||
{
|
{
|
||||||
Debug.WriteLine(string.Format("Thread {0}: OpenSource.", Thread.CurrentThread.ManagedThreadId));
|
Debug.WriteLine(string.Format("Thread {0}: OpenSource.", Thread.CurrentThread.ManagedThreadId));
|
||||||
|
|||||||
Reference in New Issue
Block a user