Some refactor ideas

This commit is contained in:
soukoku
2014-04-05 16:48:28 -04:00
parent 4fa3e77fba
commit 67c6705224
49 changed files with 183 additions and 163 deletions

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
sealed class Callback : OpBase
{
internal Callback(ITwainSessionInternal session) : base(session) { }
internal Callback(ITwainStateInternal 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(ITwainSessionInternal session) : base(session) { }
internal Callback2(ITwainStateInternal 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

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

View File

@@ -9,7 +9,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class CustomDSData : OpBase
{
internal CustomDSData(ITwainSessionInternal session) : base(session) { }
internal CustomDSData(ITwainStateInternal 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

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

View File

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

View File

@@ -9,7 +9,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class FileSystem : OpBase
{
internal FileSystem(ITwainSessionInternal session) : base(session) { }
internal FileSystem(ITwainStateInternal 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

@@ -9,7 +9,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class Identity : OpBase
{
internal Identity(ITwainSessionInternal session) : base(session) { }
internal Identity(ITwainStateInternal 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
@@ -23,6 +23,7 @@ namespace NTwain.Triplets
var rc = PInvoke.DsmEntry(Session.AppId, Message.CloseDS, Session.SourceId);
if (rc == ReturnCode.Success)
{
Session.ChangeSourceId(null);
Session.ChangeState(3, true);
}
return rc;
@@ -78,6 +79,7 @@ namespace NTwain.Triplets
var rc = PInvoke.DsmEntry(Session.AppId, Message.OpenDS, source);
if (rc == ReturnCode.Success)
{
Session.ChangeSourceId(source);
Session.ChangeState(4, true);
}
return rc;

View File

@@ -10,7 +10,7 @@ namespace NTwain.Triplets
/// </summary>
sealed class Parent : OpBase
{
internal Parent(ITwainSessionInternal session) : base(session) { }
internal Parent(ITwainStateInternal session) : base(session) { }
/// <summary>
/// When the application has closed all the Sources it had previously opened, and is finished with

View File

@@ -9,7 +9,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class PassThru : OpBase
{
internal PassThru(ITwainSessionInternal session) : base(session) { }
internal PassThru(ITwainStateInternal 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

@@ -9,7 +9,7 @@ namespace NTwain.Triplets
/// </summary>
sealed class PendingXfers : OpBase
{
internal PendingXfers(ITwainSessionInternal session) : base(session) { }
internal PendingXfers(ITwainStateInternal 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

@@ -9,7 +9,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class SetupFileXfer : OpBase
{
internal SetupFileXfer(ITwainSessionInternal session) : base(session) { }
internal SetupFileXfer(ITwainStateInternal 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

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

View File

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

View File

@@ -9,7 +9,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class StatusUtf8 : OpBase
{
internal StatusUtf8(ITwainSessionInternal session) : base(session) { }
internal StatusUtf8(ITwainStateInternal 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

@@ -9,7 +9,7 @@ namespace NTwain.Triplets
/// </summary>
sealed class UserInterface : OpBase
{
internal UserInterface(ITwainSessionInternal session) : base(session) { }
internal UserInterface(ITwainStateInternal 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

View File

@@ -9,7 +9,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class XferGroup : OpBase
{
internal XferGroup(ITwainSessionInternal session) : base(session) { }
internal XferGroup(ITwainStateInternal session) : base(session) { }
/// <summary>
/// Returns the Data Group (the type of data) for the upcoming transfer. The Source is required to

View File

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