mirror of
https://github.com/soukoku/ntwain.git
synced 2025-11-24 16:53:24 +08:00
Added FileSystem triplets and simplified other triplet classes.
This commit is contained in:
@@ -7,60 +7,42 @@ namespace NTwain.Triplets.Control
|
||||
{
|
||||
internal CustomDSData(TwainSession session) : base(session) { }
|
||||
|
||||
public ReturnCode Get(ref TW_CUSTOMDSDATA data)
|
||||
ReturnCode DoIt(Message msg, ref TW_CUSTOMDSDATA data)
|
||||
{
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, Message.Get, ref data);
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, msg, ref data);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, Message.Get, ref data);
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, msg, ref data);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, Message.Get, ref data);
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, msg, ref data);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, Message.Get, ref data);
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, msg, ref data);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, Message.Get, ref data);
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, msg, ref data);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, Message.Get, ref data);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
}
|
||||
|
||||
public ReturnCode Set(ref TW_CUSTOMDSDATA customData)
|
||||
{
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, Message.Set, ref data);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, Message.Set, ref data);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, Message.Set, ref data);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, Message.Set, ref data);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, Message.Set, ref data);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, Message.Set, ref data);
|
||||
DataGroups.Control, DataArgumentType.CustomDSData, msg, ref data);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
}
|
||||
|
||||
public ReturnCode Get(ref TW_CUSTOMDSDATA data)
|
||||
{
|
||||
return DoIt(Message.Get, ref data);
|
||||
}
|
||||
|
||||
public ReturnCode Set(ref TW_CUSTOMDSDATA data)
|
||||
{
|
||||
return DoIt(Message.Set, ref data);
|
||||
}
|
||||
}
|
||||
}
|
||||
179
src/NTwain/Triplets/Control/FileSystem.cs
Normal file
179
src/NTwain/Triplets/Control/FileSystem.cs
Normal file
@@ -0,0 +1,179 @@
|
||||
using NTwain.Data;
|
||||
using NTwain.Internals;
|
||||
|
||||
namespace NTwain.Triplets.Control
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents <see cref="DataArgumentType.FileSystem"/>.
|
||||
/// </summary>
|
||||
public sealed class FileSystem : BaseTriplet
|
||||
{
|
||||
internal FileSystem(TwainSession session) : base(session) { }
|
||||
|
||||
ReturnCode DoIt(Message msg, ref TW_FILESYSTEM fileSystem)
|
||||
{
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.FileSystem, msg, ref fileSystem);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.FileSystem, msg, ref fileSystem);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.FileSystem, msg, ref fileSystem);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.FileSystem, msg, ref fileSystem);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.FileSystem, msg, ref fileSystem);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.FileSystem, msg, ref fileSystem);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
}
|
||||
|
||||
/// <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
|
||||
/// the destination directory (a file of type Directory). The directory must exist and be
|
||||
/// accessible to the Source. The creation of images within the directory is at the discretion of the
|
||||
/// Source, and may result in the creation of additional sub-directories.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode AutomaticCaptureDirectory(ref TW_FILESYSTEM fileSystem)
|
||||
{
|
||||
return DoIt(Message.AutomaticCaptureDirectory, ref fileSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This operation selects the current device within the Source (camera, storage, etc). If the device is
|
||||
/// a <see cref="FileType.Domain"/>, then this command enters a directory that can contain <see cref="FileType.Host"/> files. If the
|
||||
/// device is a <see cref="FileType.Host"/>, then this command enters a directory that can contain
|
||||
/// <see cref="FileType.Directory"/> files. If the device is a <see cref="FileType.Directory"/>, then this command enters a
|
||||
/// directory that can contain <see cref="FileType.Directory"/> or <see cref="FileType.Image"/> files.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode ChangeDirectory(ref TW_FILESYSTEM fileSystem)
|
||||
{
|
||||
return DoIt(Message.ChangeDirectory, ref fileSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This operation copies a file or directory. Absolute and relative pathnames are supported. A file
|
||||
/// may not be overwritten with this command. If an Application wishes to do this, it must first
|
||||
/// delete the unwanted file and then reissue the Copy command.
|
||||
/// The Application specifies the path and name of the entry to be copied in InputName. The
|
||||
/// Application specifies the new patch and name in OutputName.
|
||||
/// It is not permitted to copy files into the root directory.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Copy(ref TW_FILESYSTEM fileSystem)
|
||||
{
|
||||
return DoIt(Message.Copy, ref fileSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This operation creates a new directory within the current directory. Pathnames are not allowed,
|
||||
/// only the name of the new directory can be specified.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode CreateDirectory(ref TW_FILESYSTEM fileSystem)
|
||||
{
|
||||
return DoIt(Message.CreateDirectory, ref fileSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This operation deletes a file or directory on the device. Pathnames are not allowed, only the
|
||||
/// name of the file or directory to be deleted can be specified. Recursive deletion can be specified
|
||||
/// by setting the Recursive to TRUE.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Delete(ref TW_FILESYSTEM fileSystem)
|
||||
{
|
||||
return DoIt(Message.Delete, ref fileSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This operation formats the specified storage. This operation destroys all images and subdirectories
|
||||
/// under the selected device. Use with caution.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode FormatMedia(ref TW_FILESYSTEM fileSystem)
|
||||
{
|
||||
return DoIt(Message.FormatMedia, ref fileSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The operation frees the Context field in fileSystem.
|
||||
/// Every call to GetFirstFile must be matched by
|
||||
/// a call to GetClose to release the Context field.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode GetClose(ref TW_FILESYSTEM fileSystem)
|
||||
{
|
||||
return DoIt(Message.GetClose, ref fileSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This operation gets the first filename in a directory, and returns information about that file (the
|
||||
/// same information that can be retrieved with GetInfo).
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode GetFirstFile(ref TW_FILESYSTEM fileSystem)
|
||||
{
|
||||
return DoIt(Message.GetFirstFile, ref fileSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This operation fills the information fields in fileSystem.
|
||||
/// InputName contains the absolute or relative path and filename of the requested file.
|
||||
/// OutputName returns the absolute path to the file.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode GetInfo(ref TW_FILESYSTEM fileSystem)
|
||||
{
|
||||
return DoIt(Message.GetInfo, ref fileSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This operation gets the next filename in a directory, and returns information about that file (the
|
||||
/// same information that can be retrieved with GetInfo).
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode GetNextFile(ref TW_FILESYSTEM fileSystem)
|
||||
{
|
||||
return DoIt(Message.GetNextFile, ref fileSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This operation renames (and optionally moves) a file or directory. Absolute and relative path
|
||||
/// names are supported. A file may not be overwritten with this command. If an Application
|
||||
/// wishes to do this it must first delete the unwanted file, then issue the rename command.
|
||||
/// The Application specifies the path and name of the entry to be renamed in InputName. The
|
||||
/// Application specifies the new path and name in OutputName.
|
||||
/// Filenames in the root directory cannot be moved or renamed.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Rename(ref TW_FILESYSTEM fileSystem)
|
||||
{
|
||||
return DoIt(Message.Rename, ref fileSystem);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,35 +8,40 @@ namespace NTwain.Triplets.Control
|
||||
{
|
||||
internal Identity(TwainSession session) : base(session) { }
|
||||
|
||||
public ReturnCode CloseDS(TW_IDENTITY source)
|
||||
ReturnCode DoIt(Message msg, TW_IDENTITY source)
|
||||
{
|
||||
var rc = ReturnCode.Failure;
|
||||
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
rc = NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, msg, source);
|
||||
else if (IsLinux)
|
||||
rc = NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, msg, source);
|
||||
else if (IsMac)
|
||||
rc = NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, msg, source);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsWin)
|
||||
rc = NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, msg, source);
|
||||
else if (IsLinux)
|
||||
rc = NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, msg, source);
|
||||
else if (IsMac)
|
||||
rc = NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.CloseDS, source);
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, msg, source);
|
||||
}
|
||||
|
||||
return ReturnCode.Failure;
|
||||
}
|
||||
|
||||
public ReturnCode CloseDS(TW_IDENTITY source)
|
||||
{
|
||||
var rc = DoIt(Message.CloseDS, source);
|
||||
|
||||
if (rc == ReturnCode.Success)
|
||||
{
|
||||
Session.State = TwainState.S3;
|
||||
@@ -48,33 +53,8 @@ namespace NTwain.Triplets.Control
|
||||
public ReturnCode OpenDS(TW_IDENTITY source)
|
||||
{
|
||||
Session.StepDown(TwainState.DsmOpened);
|
||||
var rc = ReturnCode.Failure;
|
||||
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
rc = NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
|
||||
else if (IsLinux)
|
||||
rc = NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
|
||||
else if (IsMac)
|
||||
rc = NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsWin)
|
||||
rc = NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
|
||||
else if (IsLinux)
|
||||
rc = NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
|
||||
else if (IsMac)
|
||||
rc = NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.OpenDS, source);
|
||||
}
|
||||
|
||||
var rc = DoIt(Message.OpenDS, source);
|
||||
|
||||
if (rc == ReturnCode.Success)
|
||||
{
|
||||
Session.CurrentSource = Session.GetSourceSingleton(source);
|
||||
@@ -87,145 +67,31 @@ namespace NTwain.Triplets.Control
|
||||
public ReturnCode GetDefault(out TW_IDENTITY source)
|
||||
{
|
||||
source = new TW_IDENTITY();
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetDefault, source);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
return DoIt(Message.GetDefault, source);
|
||||
}
|
||||
|
||||
public ReturnCode GetFirst(out TW_IDENTITY source)
|
||||
{
|
||||
source = new TW_IDENTITY();
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetFirst, source);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
return DoIt(Message.GetFirst, source);
|
||||
}
|
||||
|
||||
public ReturnCode GetNext(out TW_IDENTITY source)
|
||||
{
|
||||
source = new TW_IDENTITY();
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.GetNext, source);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
return DoIt(Message.GetNext, source);
|
||||
}
|
||||
|
||||
public ReturnCode Set(DataSource source)
|
||||
{
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.Set, source?.Identity32);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
// TODO: platform handling
|
||||
return DoIt(Message.Set, source?.Identity32);
|
||||
}
|
||||
|
||||
public ReturnCode UserSelect(out TW_IDENTITY source)
|
||||
{
|
||||
source = new TW_IDENTITY();
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, IntPtr.Zero,
|
||||
DataGroups.Control, DataArgumentType.Identity, Message.UserSelect, source);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
return DoIt(Message.UserSelect, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,42 +7,47 @@ namespace NTwain.Triplets
|
||||
{
|
||||
internal PendingXfers(TwainSession 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
|
||||
/// state 7, this triplet terminates the current transfer. If any data has not been transferred (this is
|
||||
/// only possible during a memory transfer) that data is discarded.
|
||||
/// </summary>
|
||||
/// <param name="pendingXfers">The pending xfers.</param>
|
||||
/// <returns></returns>
|
||||
internal ReturnCode EndXfer(TW_PENDINGXFERS pendingXfers)
|
||||
ReturnCode DoIt(Message msg, ref TW_PENDINGXFERS pendingXfers)
|
||||
{
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.EndXfer, ref pendingXfers);
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, msg, ref pendingXfers);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.EndXfer, ref pendingXfers);
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, msg, ref pendingXfers);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.EndXfer, ref pendingXfers);
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, msg, ref pendingXfers);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.EndXfer, ref pendingXfers);
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, msg, ref pendingXfers);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.EndXfer, ref pendingXfers);
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, msg, ref pendingXfers);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.EndXfer, ref pendingXfers);
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, msg, ref pendingXfers);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
}
|
||||
|
||||
/// <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
|
||||
/// state 7, this triplet terminates the current transfer. If any data has not been transferred (this is
|
||||
/// only possible during a memory transfer) that data is discarded.
|
||||
/// </summary>
|
||||
/// <param name="pendingXfers">The pending xfers.</param>
|
||||
/// <returns></returns>
|
||||
internal ReturnCode EndXfer(ref TW_PENDINGXFERS pendingXfers)
|
||||
{
|
||||
return DoIt(Message.EndXfer, ref pendingXfers);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of transfers the Source is ready to supply to the application, upon demand.
|
||||
/// If DAT_XFERGROUP is set to DG_Image, this is the number of images. If DAT_XFERGROUP is set
|
||||
@@ -51,32 +56,9 @@ namespace NTwain.Triplets
|
||||
/// </summary>
|
||||
/// <param name="pendingXfers">The pending xfers.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Get(TW_PENDINGXFERS pendingXfers)
|
||||
public ReturnCode Get(ref TW_PENDINGXFERS pendingXfers)
|
||||
{
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.Get, ref pendingXfers);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.Get, ref pendingXfers);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.Get, ref pendingXfers);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.Get, ref pendingXfers);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.Get, ref pendingXfers);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.Get, ref pendingXfers);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
return DoIt(Message.Get, ref pendingXfers);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -84,32 +66,9 @@ namespace NTwain.Triplets
|
||||
/// </summary>
|
||||
/// <param name="pendingXfers">The pending xfers.</param>
|
||||
/// <returns></returns>
|
||||
internal ReturnCode Reset(TW_PENDINGXFERS pendingXfers)
|
||||
internal ReturnCode Reset(ref TW_PENDINGXFERS pendingXfers)
|
||||
{
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.Reset, ref pendingXfers);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.Reset, ref pendingXfers);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.Reset, ref pendingXfers);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.Reset, ref pendingXfers);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.Reset, ref pendingXfers);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.Reset, ref pendingXfers);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
return DoIt(Message.Reset, ref pendingXfers);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -118,32 +77,9 @@ namespace NTwain.Triplets
|
||||
/// </summary>
|
||||
/// <param name="pendingXfers">The pending xfers.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode StopFeeder(TW_PENDINGXFERS pendingXfers)
|
||||
public ReturnCode StopFeeder(ref TW_PENDINGXFERS pendingXfers)
|
||||
{
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.StopFeeder, ref pendingXfers);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.StopFeeder, ref pendingXfers);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.StopFeeder, ref pendingXfers);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.StopFeeder, ref pendingXfers);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.StopFeeder, ref pendingXfers);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.PendingXfers, Message.StopFeeder, ref pendingXfers);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
return DoIt(Message.StopFeeder, ref pendingXfers);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,35 +10,40 @@ namespace NTwain.Triplets.Control
|
||||
{
|
||||
internal UserInterface(TwainSession session) : base(session) { }
|
||||
|
||||
public ReturnCode DisableDS(ref TW_USERINTERFACE ui, bool wasUIonly)
|
||||
ReturnCode DoIt(Message msg, ref TW_USERINTERFACE ui)
|
||||
{
|
||||
var rc = ReturnCode.Failure;
|
||||
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
rc = NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.DisableDS, ref ui);
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, msg, ref ui);
|
||||
else if (IsLinux)
|
||||
rc = NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.DisableDS, ref ui);
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, msg, ref ui);
|
||||
else if (IsMac)
|
||||
rc = NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.DisableDS, ref ui);
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, msg, ref ui);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsWin)
|
||||
rc = NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.DisableDS, ref ui);
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, msg, ref ui);
|
||||
else if (IsLinux)
|
||||
rc = NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.DisableDS, ref ui);
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, msg, ref ui);
|
||||
else if (IsMac)
|
||||
rc = NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.DisableDS, ref ui);
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, msg, ref ui);
|
||||
}
|
||||
|
||||
return ReturnCode.Failure;
|
||||
}
|
||||
|
||||
public ReturnCode DisableDS(ref TW_USERINTERFACE ui, bool wasUIonly)
|
||||
{
|
||||
var rc = DoIt(Message.DisableDS, ref ui);
|
||||
|
||||
if (rc == ReturnCode.Success)
|
||||
{
|
||||
Session.State = TwainState.S4;
|
||||
@@ -58,30 +63,7 @@ namespace NTwain.Triplets.Control
|
||||
{
|
||||
Session.State = TwainState.S5; //tentative
|
||||
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
rc = NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.EnableDS, ref ui);
|
||||
else if (IsLinux)
|
||||
rc = NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.EnableDS, ref ui);
|
||||
else if (IsMac)
|
||||
rc = NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.EnableDS, ref ui);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsWin)
|
||||
rc = NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.EnableDS, ref ui);
|
||||
else if (IsLinux)
|
||||
rc = NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.EnableDS, ref ui);
|
||||
else if (IsMac)
|
||||
rc = NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.DisableDS, ref ui);
|
||||
}
|
||||
rc = DoIt(Message.EnableDS, ref ui);
|
||||
|
||||
if (!(rc == ReturnCode.Success &&
|
||||
(ui.ShowUI == 0 && rc == ReturnCode.CheckStatus)))
|
||||
@@ -99,30 +81,7 @@ namespace NTwain.Triplets.Control
|
||||
{
|
||||
Session.State = TwainState.S5; //tentative
|
||||
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
rc = NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.EnableDSUIOnly, ref ui);
|
||||
else if (IsLinux)
|
||||
rc = NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.EnableDSUIOnly, ref ui);
|
||||
else if (IsMac)
|
||||
rc = NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.EnableDSUIOnly, ref ui);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsWin)
|
||||
rc = NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.EnableDSUIOnly, ref ui);
|
||||
else if (IsLinux)
|
||||
rc = NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.EnableDSUIOnly, ref ui);
|
||||
else if (IsMac)
|
||||
rc = NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.UserInterface, Message.EnableDSUIOnly, ref ui);
|
||||
}
|
||||
rc = DoIt(Message.EnableDSUIOnly, ref ui);
|
||||
|
||||
if (rc != ReturnCode.Success)
|
||||
{
|
||||
|
||||
@@ -10,38 +10,43 @@ namespace NTwain.Triplets.Control
|
||||
{
|
||||
internal XferGroup(TwainSession 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.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Get(ref DataGroups value)
|
||||
ReturnCode DoIt(Message msg, ref DataGroups value)
|
||||
{
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.XferGroup, Message.Get, ref value);
|
||||
DataGroups.Control, DataArgumentType.XferGroup, msg, ref value);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.XferGroup, Message.Get, ref value);
|
||||
DataGroups.Control, DataArgumentType.XferGroup, msg, ref value);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.XferGroup, Message.Get, ref value);
|
||||
DataGroups.Control, DataArgumentType.XferGroup, msg, ref value);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.XferGroup, Message.Get, ref value);
|
||||
DataGroups.Control, DataArgumentType.XferGroup, msg, ref value);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.XferGroup, Message.Get, ref value);
|
||||
DataGroups.Control, DataArgumentType.XferGroup, msg, ref value);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.XferGroup, Message.Get, ref value);
|
||||
DataGroups.Control, DataArgumentType.XferGroup, msg, ref value);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
}
|
||||
|
||||
/// <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.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Get(ref DataGroups value)
|
||||
{
|
||||
return DoIt(Message.Get, ref value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -53,30 +58,7 @@ namespace NTwain.Triplets.Control
|
||||
/// <returns></returns>
|
||||
public ReturnCode Set(DataGroups value)
|
||||
{
|
||||
if (Is32Bit)
|
||||
{
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.XferGroup, Message.Set, ref value);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.XferGroup, Message.Set, ref value);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.XferGroup, Message.Set, ref value);
|
||||
}
|
||||
|
||||
if (IsWin)
|
||||
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.XferGroup, Message.Set, ref value);
|
||||
if (IsLinux)
|
||||
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.XferGroup, Message.Set, ref value);
|
||||
if (IsMac)
|
||||
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||
DataGroups.Control, DataArgumentType.XferGroup, Message.Set, ref value);
|
||||
|
||||
return ReturnCode.Failure;
|
||||
return DoIt(Message.Set, ref value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,12 @@ namespace NTwain.Triplets
|
||||
/// </summary>
|
||||
public SetupMemXfer SetupMemXfer => _memXfer ?? (_memXfer = new SetupMemXfer(Session));
|
||||
|
||||
FileSystem _fs;
|
||||
/// <summary>
|
||||
/// Gets the operations defined for DAT_FILESYSTEM.
|
||||
/// </summary>
|
||||
public FileSystem FileSystem => _fs ?? (_fs = new FileSystem(Session));
|
||||
|
||||
XferGroup _xferGroup;
|
||||
/// <summary>
|
||||
/// Gets the operations defined for DAT_XFERGROUP.
|
||||
|
||||
Reference in New Issue
Block a user