mirror of
https://github.com/soukoku/ntwain.git
synced 2025-09-18 09:44:24 +08:00
Some internal refactoring.
This commit is contained in:
@@ -5,7 +5,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
sealed class AudioFileXfer : OpBase
|
||||
{
|
||||
internal AudioFileXfer(TwainSession 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.
|
||||
|
@@ -5,7 +5,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class AudioInfo : OpBase
|
||||
{
|
||||
internal AudioInfo(TwainSession session) : base(session) { }
|
||||
internal AudioInfo(ITwainSessionInternal session) : base(session) { }
|
||||
/// <summary>
|
||||
/// Used to get the information of the current audio data ready to transfer.
|
||||
/// </summary>
|
||||
|
@@ -5,7 +5,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
sealed class AudioNativeXfer : OpBase
|
||||
{
|
||||
internal AudioNativeXfer(TwainSession 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.
|
||||
|
@@ -6,8 +6,8 @@ namespace NTwain.Triplets
|
||||
/// </summary>
|
||||
public sealed class DGAudio
|
||||
{
|
||||
TwainSession _session;
|
||||
internal DGAudio(TwainSession session)
|
||||
ITwainSessionInternal _session;
|
||||
internal DGAudio(ITwainSessionInternal session)
|
||||
{
|
||||
if (session == null) { throw new ArgumentNullException("session"); }
|
||||
_session = session;
|
||||
|
@@ -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 application’s entry point with
|
||||
/// the DSM, so that the DSM can use callbacks to inform the application of events generated by the
|
||||
|
@@ -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 application’s entry point with
|
||||
/// the DSM, so that the DSM can use callbacks to inform the application of events generated by the
|
||||
|
@@ -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 Source’s Current, Default and Available Values for a specified capability.
|
||||
/// </summary>
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -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>
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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.
|
||||
|
@@ -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
|
||||
|
@@ -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.
|
||||
|
@@ -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 Source’s preferred, minimum, and maximum allocation sizes for transfer memory
|
||||
/// buffers.
|
||||
|
@@ -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>
|
||||
|
@@ -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.
|
||||
|
@@ -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 Source’s 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;
|
||||
}
|
||||
|
@@ -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.
|
||||
|
@@ -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;
|
||||
|
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class CieColor : OpBase
|
||||
{
|
||||
internal CieColor(TwainSession 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
|
||||
|
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class ExtImageInfo : OpBase
|
||||
{
|
||||
internal ExtImageInfo(TwainSession session) : base(session) { }
|
||||
internal ExtImageInfo(ITwainSessionInternal session) : base(session) { }
|
||||
|
||||
public ReturnCode Get(TWExtImageInfo info)
|
||||
{
|
||||
|
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class GrayResponse : OpBase
|
||||
{
|
||||
internal GrayResponse(TwainSession session) : base(session) { }
|
||||
internal GrayResponse(ITwainSessionInternal session) : base(session) { }
|
||||
|
||||
/// <summary>
|
||||
/// The Reset operation causes the Source to use its "identity response curve." The identity
|
||||
|
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class IccProfile : OpBase
|
||||
{
|
||||
internal IccProfile(TwainSession 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
|
||||
|
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
sealed class ImageFileXfer : OpBase
|
||||
{
|
||||
internal ImageFileXfer(TwainSession 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
|
||||
|
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class ImageInfo : OpBase
|
||||
{
|
||||
internal ImageInfo(TwainSession session) : base(session) { }
|
||||
internal ImageInfo(ITwainSessionInternal session) : base(session) { }
|
||||
|
||||
public ReturnCode Get(out TWImageInfo info)
|
||||
{
|
||||
|
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class ImageLayout : OpBase
|
||||
{
|
||||
internal ImageLayout(TwainSession session) : base(session) { }
|
||||
internal ImageLayout(ITwainSessionInternal session) : base(session) { }
|
||||
|
||||
public ReturnCode Get(out TWImageLayout layout)
|
||||
{
|
||||
|
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
sealed class ImageMemFileXfer : OpBase
|
||||
{
|
||||
internal ImageMemFileXfer(TwainSession 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
|
||||
|
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
sealed class ImageMemXfer : OpBase
|
||||
{
|
||||
internal ImageMemXfer(TwainSession 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
|
||||
|
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
sealed class ImageNativeXfer : OpBase
|
||||
{
|
||||
internal ImageNativeXfer(TwainSession session) : base(session) { }
|
||||
internal ImageNativeXfer(ITwainSessionInternal session) : base(session) { }
|
||||
|
||||
/// <summary>
|
||||
/// Causes the transfer of an image’s data from the Source to the application, via the Native transfer
|
||||
|
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class JpegCompression : OpBase
|
||||
{
|
||||
internal JpegCompression(TwainSession 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
|
||||
|
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class Palette8 : OpBase
|
||||
{
|
||||
internal Palette8(TwainSession session) : base(session) { }
|
||||
internal Palette8(ITwainSessionInternal session) : base(session) { }
|
||||
|
||||
/// <summary>
|
||||
/// This operation causes the Source to report its current palette information.
|
||||
|
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class RgbResponse : OpBase
|
||||
{
|
||||
internal RgbResponse(TwainSession 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
|
||||
|
@@ -6,8 +6,8 @@ namespace NTwain.Triplets
|
||||
/// </summary>
|
||||
public sealed class DGImage
|
||||
{
|
||||
TwainSession _session;
|
||||
internal DGImage(TwainSession session)
|
||||
ITwainSessionInternal _session;
|
||||
internal DGImage(ITwainSessionInternal session)
|
||||
{
|
||||
if (session == null) { throw new ArgumentNullException("session"); }
|
||||
_session = session;
|
||||
|
@@ -11,16 +11,15 @@ namespace NTwain.Triplets
|
||||
/// </summary>
|
||||
public abstract class OpBase
|
||||
{
|
||||
TwainSession _session;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="OpBase" /> class.
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
protected OpBase(TwainSession session)
|
||||
internal OpBase(ITwainSessionInternal session)
|
||||
{
|
||||
if (session == null) { throw new ArgumentNullException("session"); }
|
||||
_session = session;
|
||||
Session = session;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -29,6 +28,6 @@ namespace NTwain.Triplets
|
||||
/// <value>
|
||||
/// The session.
|
||||
/// </value>
|
||||
protected TwainSession Session { get { return _session; } }
|
||||
internal ITwainSessionInternal Session { get; private set; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user