Added a few more structs.

This commit is contained in:
Eugene Wang
2018-11-13 06:14:43 -05:00
parent fa177c4193
commit cad3e5d37f
2 changed files with 172 additions and 154 deletions

View File

@@ -97,19 +97,19 @@ namespace NTwain.Data
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TW_CALLBACK partial struct TW_CALLBACK
{ {
[MarshalAs(UnmanagedType.FunctionPtr)] [MarshalAs(UnmanagedType.FunctionPtr)]
CallbackDelegate _callBackProc; public CallbackDelegate _callBackProc;
TW_UINT32 _refCon; TW_UINT32 _refCon;
TW_INT16 _message; TW_INT16 _message;
} }
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TW_CALLBACK2 partial struct TW_CALLBACK2
{ {
[MarshalAs(UnmanagedType.FunctionPtr)] [MarshalAs(UnmanagedType.FunctionPtr)]
CallbackDelegate _callBackProc; public CallbackDelegate _callBackProc;
TW_UINTPTR _refCon; TW_UINTPTR _refCon;
TW_INT16 _message; TW_INT16 _message;
} }
@@ -131,7 +131,7 @@ namespace NTwain.Data
} }
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TW_CIECOLOR partial struct TW_CIECOLOR
{ {
TW_UINT16 _colorSpace; TW_UINT16 _colorSpace;
TW_INT16 _lowEndian; TW_INT16 _lowEndian;
@@ -227,7 +227,7 @@ namespace NTwain.Data
[StructLayout(LayoutKind.Explicit, Pack = 2), [StructLayout(LayoutKind.Explicit, Pack = 2),
BestFitMapping(false, ThrowOnUnmappableChar = true)] BestFitMapping(false, ThrowOnUnmappableChar = true)]
partial class TW_FILESYSTEM partial struct TW_FILESYSTEM
{ {
[FieldOffset(0)] [FieldOffset(0)]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String255)] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String255)]

View File

@@ -570,68 +570,7 @@ namespace NTwain.Data
public string Name { get { return _name; } } public string Name { get { return _name; } }
} }
/// <summary>
/// Used in Callback mechanism for sending messages from the Source to the Application.
/// Applications version 2.2 or higher must use <see cref="TW_CALLBACK2"/>.
/// </summary>
partial class TW_CALLBACK
{
/// <summary>
/// Initializes a new instance of the <see cref="TW_CALLBACK"/> class.
/// </summary>
/// <param name="callback">The callback functions entry point.</param>
public TW_CALLBACK(CallbackDelegate callback)
{
_callBackProc = callback;
}
///// <summary>
///// An application defined reference constant.
///// </summary>
///// <value>
///// The reference constant.
///// </value>
//public uint RefCon { get { return _refCon; } set { _refCon = value; } }
///// <summary>
///// Initialized to any valid DG_CONTROL / DAT_NULL message.
///// </summary>
///// <value>
///// The message.
///// </value>
//public short Message { get { return _message; } set { _message = value; } }
}
/// <summary>
/// Used in the Callback mechanism for sending messages from the Source to the Application.
/// </summary>
partial class TW_CALLBACK2
{
/// <summary>
/// Initializes a new instance of the <see cref="TW_CALLBACK2"/> class.
/// </summary>
/// <param name="callback">The callback functions entry point.</param>
public TW_CALLBACK2(CallbackDelegate callback)
{
_callBackProc = callback;
}
///// <summary>
///// An application defined reference constant. It has a different size on different
///// platforms.
///// </summary>
///// <value>
///// The reference constant.
///// </value>
//public UIntPtr RefCon { get { return _refCon; } set { _refCon = value; } }
///// <summary>
///// Initialized to any valid DG_CONTROL / DAT_NULL message.
///// </summary>
///// <value>
///// The message.
///// </value>
//public short Message { get { return _message; } set { _message = value; } }
}
// /// <summary> // /// <summary>
// /// Used by an application either to get information about, or control the setting of a capability. // /// Used by an application either to get information about, or control the setting of a capability.
@@ -978,7 +917,7 @@ namespace NTwain.Data
// /// <summary> // /// <summary>
// /// Defines the mapping from an RGB color space device into CIE 1931 (XYZ) color space. // /// Defines the mapping from an RGB color space device into CIE 1931 (XYZ) color space.
// /// </summary> // /// </summary>
// public partial class TW_CIECOLOR // public partial struct TW_CIECOLOR
// { // {
// internal TW_CIECOLOR() { } // internal TW_CIECOLOR() { }
@@ -1442,89 +1381,137 @@ namespace NTwain.Data
public TW_INFO[] Info { get { return _info; } } public TW_INFO[] Info { get { return _info; } }
} }
// /// <summary> /// <summary>
// /// Provides information about the currently selected device. /// Provides information about the currently selected device.
// /// </summary> /// </summary>
// public partial class TW_FILESYSTEM public partial struct TW_FILESYSTEM
// { {
// /// <summary> /// <summary>
// /// The name of the input or source file. /// The name of the input or source file.
// /// </summary> /// </summary>
// public string InputName { get { return _inputName; } set { _inputName = value; } } public string InputName
// /// <summary> {
// /// The result of an operation or the name of a destination file. get { return _inputName; }
// /// </summary> set { _inputName = value; }
// public string OutputName { get { return _outputName; } set { _outputName = value; } } }
// /// <summary> /// <summary>
// /// A pointer to Source specific data used to remember state /// The result of an operation or the name of a destination file.
// /// information, such as the current directory. /// </summary>
// /// </summary> public string OutputName
// public IntPtr Context { get { return _context; } set { _context = value; } } {
get { return _outputName; }
set { _outputName = value; }
}
/// <summary>
/// A pointer to Source specific data used to remember state
/// information, such as the current directory.
/// </summary>
public IntPtr Context
{
get { return _context; }
set { _context = value; }
}
// /// <summary> /// <summary>
// /// When set to TRUE recursively apply the operation. (ex: deletes /// When set to TRUE recursively apply the operation. (ex: deletes
// /// all subdirectories in the directory being deleted; or copies all /// all subdirectories in the directory being deleted; or copies all
// /// sub-directories in the directory being copied. /// sub-directories in the directory being copied.
// /// </summary> /// </summary>
// public bool Recursive { get { return _subdirectories == TwainConst.True; } set { _subdirectories = value ? TwainConst.True : TwainConst.False; } } public bool Recursive
{
get { return _subdirectories == TwainConst.True; }
set { _subdirectories = value ? TwainConst.True : TwainConst.False; }
}
// /// <summary> /// <summary>
// /// Gets the type of the file. /// Gets the type of the file.
// /// </summary> /// </summary>
// /// <value> /// <value>
// /// The type of the file. /// The type of the file.
// /// </value> /// </value>
// public FileType FileType { get { return (FileType)_fileType; } set { _fileType = (int)value; } } public FileType FileType
{
get { return (FileType)_fileType; }
set { _fileType = (int)value; }
}
// /// <summary> /// <summary>
// /// If <see cref="NTwain.Data.FileType.Directory"/>, total size of media in bytes. /// If <see cref="NTwain.Data.FileType.Directory"/>, total size of media in bytes.
// /// If <see cref="NTwain.Data.FileType.Image"/>, size of image in bytes. /// If <see cref="NTwain.Data.FileType.Image"/>, size of image in bytes.
// /// </summary> /// </summary>
// /// <value> /// <value>
// /// The size. /// The size.
// /// </value> /// </value>
// public uint Size { get { return _size; } set { _size = value; } } public uint Size { get { return _size; } set { _size = value; } }
// /// <summary> /// <summary>
// /// The create date of the file, in the form "YYYY/MM/DD /// The create date of the file, in the form "YYYY/MM/DD
// /// HH:mm:SS:sss" where YYYY is the year, MM is the numerical /// HH:mm:SS:sss" where YYYY is the year, MM is the numerical
// /// month, DD is the numerical day, HH is the hour, mm is the /// month, DD is the numerical day, HH is the hour, mm is the
// /// minute, SS is the second, and sss is the millisecond. /// minute, SS is the second, and sss is the millisecond.
// /// </summary> /// </summary>
// public string CreateTimeDate { get { return _createTimeDate; } set { _createTimeDate = value; } } public string CreateTimeDate
// /// <summary> {
// /// Last date the file was modified. Same format as <see cref="CreateTimeDate"/>. get { return _createTimeDate; }
// /// </summary> set { _createTimeDate = value; }
// public string ModifiedTimeDate { get { return _modifiedTimeDate; } set { _modifiedTimeDate = value; } } }
// /// <summary> /// <summary>
// /// The bytes of free space left on the current device. /// Last date the file was modified. Same format as <see cref="CreateTimeDate"/>.
// /// </summary> /// </summary>
// public uint FreeSpace { get { return _freeSpace; } set { _freeSpace = value; } } public string ModifiedTimeDate
// /// <summary> {
// /// An estimate of the amount of space a new image would take get { return _modifiedTimeDate; }
// /// up, based on image layout, resolution and compression. set { _modifiedTimeDate = value; }
// /// Dividing this value into the FreeSpace will yield the }
// /// approximate number of images that the Device has room for. /// <summary>
// /// </summary> /// The bytes of free space left on the current device.
// public int NewImageSize { get { return _newImageSize; } set { _newImageSize = value; } } /// </summary>
// /// <summary> public uint FreeSpace
// /// If applicable, return the number of <see cref="NTwain.Data.FileType.Image"/> files on the file system including those in all sub-directories. {
// /// </summary> get { return _freeSpace; }
// /// <value> set { _freeSpace = value; }
// /// The number of files. }
// /// </value> /// <summary>
// public uint NumberOfFiles { get { return _numberOfFiles; } set { _numberOfFiles = value; } } /// An estimate of the amount of space a new image would take
// /// <summary> /// up, based on image layout, resolution and compression.
// /// The number of audio snippets associated with a file of type <see cref="NTwain.Data.FileType.Image"/>. /// Dividing this value into the FreeSpace will yield the
// /// </summary> /// approximate number of images that the Device has room for.
// /// <value> /// </summary>
// /// The number of snippets. public int NewImageSize
// /// </value> {
// public uint NumberOfSnippets { get { return _numberOfSnippets; } set { _numberOfSnippets = value; } } get { return _newImageSize; }
// /// <summary> set { _newImageSize = value; }
// /// Used to group cameras (ex: front/rear bitonal, front/rear grayscale...). }
// /// </summary> /// <summary>
// public uint DeviceGroupMask { get { return _deviceGroupMask; } set { _deviceGroupMask = value; } } /// If applicable, return the number of <see cref="NTwain.Data.FileType.Image"/> files on the file system including those in all sub-directories.
// } /// </summary>
/// <value>
/// The number of files.
/// </value>
public uint NumberOfFiles
{
get { return _numberOfFiles; }
set { _numberOfFiles = value; }
}
/// <summary>
/// The number of audio snippets associated with a file of type <see cref="NTwain.Data.FileType.Image"/>.
/// </summary>
/// <value>
/// The number of snippets.
/// </value>
public uint NumberOfSnippets
{
get { return _numberOfSnippets; }
set { _numberOfSnippets = value; }
}
/// <summary>
/// Used to group cameras (ex: front/rear bitonal, front/rear grayscale...).
/// </summary>
public uint DeviceGroupMask
{
get { return _deviceGroupMask; }
set { _deviceGroupMask = value; }
}
}
// ///// <summary> // ///// <summary>
// ///// This structure is used by the application to specify a set of mapping values to be applied to // ///// This structure is used by the application to specify a set of mapping values to be applied to
@@ -2216,7 +2203,7 @@ namespace NTwain.Data
// /// Translates the contents of Status into a localized UTF8string, with the total number of bytes // /// Translates the contents of Status into a localized UTF8string, with the total number of bytes
// /// in the string. // /// in the string.
// /// </summary> // /// </summary>
// public sealed partial class TW_STATUSUTF8 : IDisposable // public sealed partial struct TW_STATUSUTF8 : IDisposable
// { // {
// /// <summary> // /// <summary>
// /// <see cref="TW_STATUS"/> data received from a previous call. // /// <see cref="TW_STATUS"/> data received from a previous call.
@@ -2295,18 +2282,49 @@ namespace NTwain.Data
// #endregion // #endregion
// } // }
/// <summary>
/// Provides identification information about a TWAIN entity. Used to maintain consistent
/// communication between entities.
/// </summary>
public partial struct TW_TWAINDIRECT public partial struct TW_TWAINDIRECT
{ {
//public TW_TWAINDIRECT() public TW_TWAINDIRECT(ushort manager, IntPtr send, uint sendSize)
//{ {
// _SizeOf = (uint)Marshal.SizeOf(this); _SizeOf = (uint)Marshal.SizeOf(typeof(TW_TWAINDIRECT));
//} _CommunicationManager = manager;
_Send = send;
_SendSize = sendSize;
_Receive = IntPtr.Zero;
_ReceiveSize = 0;
}
/// <summary>
/// The interpretation of the Send data may be influenced by the communication
/// manager that is helping the application connect to the scanner.
/// For instance, a task action to “scan” may need to be ignored under some
/// circumstances.
/// </summary>
public ushort CommunicationManager { get => _CommunicationManager; } public ushort CommunicationManager { get => _CommunicationManager; }
/// <summary>
/// A handle to data to be sent from the application to the driver. The application
/// owns this handle.If there is no data, this field is set to NULL.
/// </summary>
public IntPtr Send { get => _Send; set => _Send = value; } public IntPtr Send { get => _Send; set => _Send = value; }
/// <summary>
/// The number of bytes in the Send buffer.
/// If there is no data this field is set to 0.
/// </summary>
public uint SendSize { get => _SendSize; set => _SendSize = value; } public uint SendSize { get => _SendSize; set => _SendSize = value; }
/// <summary>
/// A handle to data sent from the driver to the application.
/// The driver creates this handle, the application must free it.
/// If there is no data this field is set to NULL.
/// </summary>
public IntPtr Receive { get => _Receive; } public IntPtr Receive { get => _Receive; }
/// <summary>
/// The number of bytes in the Receive buffer, set by the driver.
/// If there is no data this field is set to 0.
/// </summary>
public uint ReceiveSize { get => _ReceiveSize; } public uint ReceiveSize { get => _ReceiveSize; }
} }