Refactoring xfer logic from twainsession out.

This commit is contained in:
soukoku
2014-04-20 18:42:51 -04:00
parent 1743b8379b
commit 4b08d3bc29
55 changed files with 717 additions and 688 deletions

View File

@@ -9,7 +9,7 @@ namespace NTwain.Triplets
/// </summary>
sealed class AudioFileXfer : OpBase
{
internal AudioFileXfer(ITwainStateInternal session) : base(session) { }
internal AudioFileXfer(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This operation is used to initiate the transfer of audio from the Source to the application via the
/// disk-file transfer mechanism. It causes the transfer to begin.

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class AudioInfo : OpBase
{
internal AudioInfo(ITwainStateInternal session) : base(session) { }
internal AudioInfo(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// Used to get the information of the current audio data ready to transfer.
/// </summary>

View File

@@ -9,7 +9,7 @@ namespace NTwain.Triplets
/// </summary>
sealed class AudioNativeXfer : OpBase
{
internal AudioNativeXfer(ITwainStateInternal session) : base(session) { }
internal AudioNativeXfer(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// Causes the transfer of an audio data from the Source to the application, via the Native
/// transfer mechanism, to begin. The resulting data is stored in main memory in a single block.

View File

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

View File

@@ -5,7 +5,7 @@ namespace NTwain.Triplets
{
sealed class Callback : OpBase
{
internal Callback(ITwainStateInternal 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

@@ -5,7 +5,7 @@ namespace NTwain.Triplets
{
sealed class Callback2 : OpBase
{
internal Callback2(ITwainStateInternal 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

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class Capability : OpBase
{
internal Capability(ITwainStateInternal 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

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class CustomDSData : OpBase
{
internal CustomDSData(ITwainStateInternal 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

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class DeviceEvent : OpBase
{
internal DeviceEvent(ITwainStateInternal 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

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

View File

@@ -5,7 +5,7 @@ namespace NTwain.Triplets
{
sealed class Event : OpBase
{
internal Event(ITwainStateInternal 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

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class FileSystem : OpBase
{
internal FileSystem(ITwainStateInternal 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

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class Identity : OpBase
{
internal Identity(ITwainStateInternal 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

View File

@@ -9,7 +9,7 @@ namespace NTwain.Triplets
/// </summary>
sealed class Parent : OpBase
{
internal Parent(ITwainStateInternal 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

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class PassThru : OpBase
{
internal PassThru(ITwainStateInternal 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

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
sealed class PendingXfers : OpBase
{
internal PendingXfers(ITwainStateInternal 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

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class SetupFileXfer : OpBase
{
internal SetupFileXfer(ITwainStateInternal 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

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class SetupMemXfer : OpBase
{
internal SetupMemXfer(ITwainStateInternal 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

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

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class StatusUtf8 : OpBase
{
internal StatusUtf8(ITwainStateInternal 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

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
sealed class UserInterface : OpBase
{
internal UserInterface(ITwainStateInternal 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

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class XferGroup : OpBase
{
internal XferGroup(ITwainStateInternal 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

View File

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

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class CieColor : OpBase
{
internal CieColor(ITwainStateInternal session) : base(session) { }
internal CieColor(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This operation causes the Source to report the currently active parameters to be used in

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class ExtImageInfo : OpBase
{
internal ExtImageInfo(ITwainStateInternal session) : base(session) { }
internal ExtImageInfo(ITwainSessionInternal session) : base(session) { }
public ReturnCode Get(out TWExtImageInfo info)
{

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class Filter : OpBase
{
internal Filter(ITwainStateInternal session) : base(session) { }
internal Filter(ITwainSessionInternal session) : base(session) { }
/// <summary>

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class GrayResponse : OpBase
{
internal GrayResponse(ITwainStateInternal session) : base(session) { }
internal GrayResponse(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// The Reset operation causes the Source to use its "identity response curve." The identity

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class IccProfile : OpBase
{
internal IccProfile(ITwainStateInternal session) : base(session) { }
internal IccProfile(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This operation provides the application with the ICC profile associated with the image which is

View File

@@ -9,7 +9,7 @@ namespace NTwain.Triplets
/// </summary>
sealed class ImageFileXfer : OpBase
{
internal ImageFileXfer(ITwainStateInternal session) : base(session) { }
internal ImageFileXfer(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This operation is used to initiate the transfer of an image from the Source to the application via

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class ImageInfo : OpBase
{
internal ImageInfo(ITwainStateInternal session) : base(session) { }
internal ImageInfo(ITwainSessionInternal session) : base(session) { }
public ReturnCode Get(out TWImageInfo info)
{

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class ImageLayout : OpBase
{
internal ImageLayout(ITwainStateInternal session) : base(session) { }
internal ImageLayout(ITwainSessionInternal session) : base(session) { }
public ReturnCode Get(out TWImageLayout layout)
{

View File

@@ -5,7 +5,7 @@ namespace NTwain.Triplets
{
sealed class ImageMemFileXfer : OpBase
{
internal ImageMemFileXfer(ITwainStateInternal session) : base(session) { }
internal ImageMemFileXfer(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This operation is used to initiate the transfer of an image from the Source to the application via

View File

@@ -5,7 +5,7 @@ namespace NTwain.Triplets
{
sealed class ImageMemXfer : OpBase
{
internal ImageMemXfer(ITwainStateInternal session) : base(session) { }
internal ImageMemXfer(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This operation is used to initiate the transfer of an image from the Source to the application via

View File

@@ -6,7 +6,7 @@ namespace NTwain.Triplets
{
sealed class ImageNativeXfer : OpBase
{
internal ImageNativeXfer(ITwainStateInternal session) : base(session) { }
internal ImageNativeXfer(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// Causes the transfer of an images data from the Source to the application, via the Native transfer

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class JpegCompression : OpBase
{
internal JpegCompression(ITwainStateInternal session) : base(session) { }
internal JpegCompression(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// Causes the Source to return the parameters that will be used during the compression of data

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class Palette8 : OpBase
{
internal Palette8(ITwainStateInternal session) : base(session) { }
internal Palette8(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// This operation causes the Source to report its current palette information.

View File

@@ -8,7 +8,7 @@ namespace NTwain.Triplets
/// </summary>
public sealed class RgbResponse : OpBase
{
internal RgbResponse(ITwainStateInternal session) : base(session) { }
internal RgbResponse(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// Causes the Source to use its "identity" response curves for future RGB transfers. The identity

View File

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

View File

@@ -13,7 +13,7 @@ namespace NTwain.Triplets
/// </summary>
/// <param name="session">The session.</param>
/// <exception cref="System.ArgumentNullException"></exception>
internal OpBase(ITwainStateInternal session)
internal OpBase(ITwainSessionInternal session)
{
if (session == null) { throw new ArgumentNullException("session"); }
Session = session;
@@ -25,6 +25,6 @@ namespace NTwain.Triplets
/// <value>
/// The session.
/// </value>
internal ITwainStateInternal Session { get; private set; }
internal ITwainSessionInternal Session { get; private set; }
}
}