Some internal refactoring.

This commit is contained in:
soukoku
2014-04-04 07:25:11 -04:00
parent d418b0c751
commit 0d4f60171f
44 changed files with 157 additions and 109 deletions

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
sealed class Callback : OpBase
{
internal Callback(TwainSession session) : base(session) { }
internal Callback(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This triplet is sent to the DSM by the Application to register the applications entry point with
/// the DSM, so that the DSM can use callbacks to inform the application of events generated by the

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
sealed class Callback2 : OpBase
{
internal Callback2(TwainSession session) : base(session) { }
internal Callback2(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This triplet is sent to the DSM by the Application to register the applications entry point with
/// the DSM, so that the DSM can use callbacks to inform the application of events generated by the

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
public sealed class Capability : OpBase
{
internal Capability(TwainSession session) : base(session) { }
internal Capability(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// Returns the Sources Current, Default and Available Values for a specified capability.
/// </summary>

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
public sealed class CustomDSData : OpBase
{
internal CustomDSData(TwainSession session) : base(session) { }
internal CustomDSData(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This operation is used by the application to query the data source for its current settings, e.g.
/// DPI, paper size, color format. The actual format of the data is data source dependent and not

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
public sealed class DeviceEvent : OpBase
{
internal DeviceEvent(TwainSession session) : base(session) { }
internal DeviceEvent(ITwainSessionInternal session) : base(session) { }
public ReturnCode Get(out TWDeviceEvent sourceDeviceEvent)
{
Session.VerifyState(4, 7, DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get);

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
sealed class EntryPoint : OpBase
{
internal EntryPoint(TwainSession session) : base(session) { }
internal EntryPoint(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// Gets the function entry points for twain 2.0 or higher.
/// </summary>

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
sealed class Event : OpBase
{
internal Event(TwainSession session) : base(session) { }
internal Event(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This operation supports the distribution of events from the application to Sources so that the

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
public sealed class FileSystem : OpBase
{
internal FileSystem(TwainSession session) : base(session) { }
internal FileSystem(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This operation selects the destination directory within the Source (camera, storage, etc), where
/// images captured using CapAutomaticCapture will be stored. This command only selects

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
public sealed class Identity : OpBase
{
internal Identity(TwainSession session) : base(session) { }
internal Identity(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// When an application is finished with a Source, it must formally close the session between them
/// using this operation. This is necessary in case the Source only supports connection with a single
@@ -19,8 +19,8 @@ namespace NTwain.Triplets
Session.VerifyState(4, 4, DataGroups.Control, DataArgumentType.Identity, Message.CloseDS);
var rc = PInvoke.DsmEntry(Session.AppId, Message.CloseDS, Session.SourceId);
if (rc == ReturnCode.Success)
{
Session.State = 3;
{
Session.ChangeState(3, true);
}
return rc;
}
@@ -74,8 +74,8 @@ namespace NTwain.Triplets
Session.VerifyState(3, 3, DataGroups.Control, DataArgumentType.Identity, Message.OpenDS);
var rc = PInvoke.DsmEntry(Session.AppId, Message.OpenDS, source);
if (rc == ReturnCode.Success)
{
Session.State = 4;
{
Session.ChangeState(4, true);
}
return rc;
}

View File

@@ -7,7 +7,7 @@ namespace NTwain.Triplets
{
sealed class Parent : OpBase
{
internal Parent(TwainSession session) : base(session) { }
internal Parent(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// When the application has closed all the Sources it had previously opened, and is finished with
@@ -23,7 +23,7 @@ namespace NTwain.Triplets
var rc = PInvoke.DsmEntry(Session.AppId, null, DataGroups.Control, DataArgumentType.Parent, Message.CloseDsm, ref handle);
if (rc == ReturnCode.Success)
{
Session.State = 2;
Session.ChangeState(2, true);
}
return rc;
}
@@ -41,7 +41,7 @@ namespace NTwain.Triplets
var rc = PInvoke.DsmEntry(Session.AppId, null, DataGroups.Control, DataArgumentType.Parent, Message.OpenDsm, ref handle);
if (rc == ReturnCode.Success)
{
Session.State = 3;
Session.ChangeState(3, true);
}
return rc;
}

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
public sealed class PassThru : OpBase
{
internal PassThru(TwainSession session) : base(session) { }
internal PassThru(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// PASSTHRU is intended for the use of Source writers writing diagnostic applications. It allows
/// raw communication with the currently selected device in the Source.

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
sealed class PendingXfers : OpBase
{
internal PendingXfers(TwainSession session) : base(session) { }
internal PendingXfers(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This triplet is used to cancel or terminate a transfer. Issued in state 6, this triplet cancels the next
/// pending transfer, discards the transfer data, and decrements the pending transfers count. In

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
public sealed class SetupFileXfer : OpBase
{
internal SetupFileXfer(TwainSession session) : base(session) { }
internal SetupFileXfer(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// Returns information about the file into which the Source has or will put the acquired image
/// or audio data.

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
public sealed class SetupMemXfer : OpBase
{
internal SetupMemXfer(TwainSession session) : base(session) { }
internal SetupMemXfer(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// Returns the Sources preferred, minimum, and maximum allocation sizes for transfer memory
/// buffers.

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
public sealed class Status : OpBase
{
internal Status(TwainSession session) : base(session) { }
internal Status(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// Returns the current Condition Code for the Source Manager.
/// </summary>

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
public sealed class StatusUtf8 : OpBase
{
internal StatusUtf8(TwainSession session) : base(session) { }
internal StatusUtf8(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// Translate the contents of a TW_STATUS structure received from a Source into a localized UTF-8
/// encoded string.

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
sealed class UserInterface : OpBase
{
internal UserInterface(TwainSession session) : base(session) { }
internal UserInterface(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This operation causes the Sources user interface, if displayed during the
/// EnableDS operation, to be lowered. The Source is returned to
@@ -23,7 +23,7 @@ namespace NTwain.Triplets
var rc = PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.DisableDS, userInterface);
if (rc == ReturnCode.Success)
{
Session.State = 4;
Session.ChangeState(4, true);
}
return rc;
}

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
public sealed class XferGroup : OpBase
{
internal XferGroup(TwainSession session) : base(session) { }
internal XferGroup(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// Returns the Data Group (the type of data) for the upcoming transfer. The Source is required to
/// only supply one of the DGs specified in the SupportedGroups field of origin.

View File

@@ -6,8 +6,8 @@ namespace NTwain.Triplets
/// </summary>
public sealed class DGControl
{
TwainSession _session;
internal DGControl(TwainSession session)
ITwainSessionInternal _session;
internal DGControl(ITwainSessionInternal session)
{
if (session == null) { throw new ArgumentNullException("session"); }
_session = session;