1
0
mirror of https://github.com/soukoku/ntwain.git synced 2025-04-05 20:59:23 +08:00

Random non-functional changes.

This commit is contained in:
soukoku 2014-04-20 08:10:20 -04:00
parent d6e2f0e811
commit 5b1997236a
5 changed files with 9 additions and 23 deletions

View File

@ -3,10 +3,7 @@ using System;
namespace NTwain
{
/// <summary>
/// Some utility stuff.
/// </summary>
public static class Extensions
static class Extensions
{
/// <summary>
/// Verifies the string length is under the maximum length

View File

@ -10,10 +10,11 @@ namespace NTwain
/// </summary>
public class MemoryManager : IMemoryManager
{
static readonly MemoryManager _instance = new MemoryManager();
/// <summary>
/// Gets the singleton <see cref="MemoryManager"/> instance.
/// </summary>
public static readonly MemoryManager Instance = new MemoryManager();
public static MemoryManager Instance { get { return _instance; } }
private MemoryManager() { }
@ -49,7 +50,7 @@ namespace NTwain
if (retVal == IntPtr.Zero)
{
throw new OutOfMemoryException(Resources.MemAllocError);
throw new OutOfMemoryException();
}
return retVal;
}

View File

@ -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>
/// Looks up a localized string similar to Message loop has not started yet..
/// </summary>

View File

@ -129,9 +129,6 @@
<data name="MaxStringLengthExceeded" xml:space="preserve">
<value>The string value has exceeded the maximum length allowed.</value>
</data>
<data name="MemAllocError" xml:space="preserve">
<value>Failed to allocate requested memory.</value>
</data>
<data name="MsgLoopUnavailble" xml:space="preserve">
<value>Message loop has not started yet.</value>
</data>

View File

@ -13,7 +13,7 @@ using System.Threading;
namespace NTwain
{
/// <summary>
/// Basic class for interfacing with TWAIN.
/// Basic class for interfacing with TWAIN. You should only have one of this per application process.
/// </summary>
public class TwainSession : ITwainStateInternal, ITwainOperation
{
@ -270,7 +270,7 @@ namespace NTwain
/// <returns></returns>
public ReturnCode CloseManager()
{
ReturnCode rc = ReturnCode.Failure;
var rc = ReturnCode.Failure;
MessageLoop.Instance.Invoke(() =>
{
Debug.WriteLine(string.Format("Thread {0}: CloseManager.", Thread.CurrentThread.ManagedThreadId));
@ -282,17 +282,17 @@ namespace NTwain
/// <summary>
/// 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.
/// </summary>
/// <param name="sourceProductName">Name of the source.</param>
/// <returns></returns>
/// <exception cref="ArgumentException">Source name is required.;sourceProductName</exception>
/// <exception cref="System.ArgumentException">sourceProductName</exception>
public ReturnCode OpenSource(string sourceProductName)
{
if (string.IsNullOrEmpty(sourceProductName)) { throw new ArgumentException(Resources.SourceRequired, "sourceProductName"); }
ReturnCode rc = ReturnCode.Failure;
var rc = ReturnCode.Failure;
MessageLoop.Instance.Invoke(() =>
{
Debug.WriteLine(string.Format("Thread {0}: OpenSource.", Thread.CurrentThread.ManagedThreadId));