Added one direct triplet call for custom values.

This commit is contained in:
soukoku
2014-05-15 21:06:13 -04:00
parent 6d8ef7bdd9
commit f17692184f
5 changed files with 65 additions and 0 deletions

View File

@@ -202,6 +202,9 @@
<Compile Include="..\NTwain\Triplets\DGControl\DGControl.XferGroup.cs">
<Link>Triplets\DGControl\DGControl.XferGroup.cs</Link>
</Compile>
<Compile Include="..\NTwain\Triplets\DGCustom.cs">
<Link>Triplets\DGCustom.cs</Link>
</Compile>
<Compile Include="..\NTwain\Triplets\DGImage\DGImage.CieColor.cs">
<Link>Triplets\DGImage\DGImage.CieColor.cs</Link>
</Compile>

View File

@@ -24,6 +24,11 @@ namespace NTwain
/// </summary>
DGImage DGImage { get; }
/// <summary>
/// Gets the direct triplet operation entry for custom values.
/// </summary>
DGCustom DGCustom { get; }
/// <summary>
/// Opens the data source manager. This must be the first method used
/// before using other TWAIN functions. Calls to this must be followed by <see cref="CloseManager"/> when done with a TWAIN session.

View File

@@ -82,6 +82,7 @@
<Compile Include="Triplets\DGControl\DGControl.Callback2.cs" />
<Compile Include="Triplets\DGControl\DGControl.CapabilityCustom.cs" />
<Compile Include="Triplets\DGImage\DGImage.Filter.cs" />
<Compile Include="Triplets\DGCustom.cs" />
<Compile Include="Triplets\OpBase.cs" />
<Compile Include="Triplets\Dsm.Linux.cs" />
<Compile Include="Triplets\Dsm.WinOld.cs" />

View File

@@ -0,0 +1,43 @@
using NTwain.Data;
using NTwain.Internals;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NTwain.Triplets
{
/// <summary>
/// Provides direct access to the triplet call.
/// </summary>
public class DGCustom
{
ITwainSessionInternal _session;
internal DGCustom(ITwainSessionInternal session)
{
if (session == null) { throw new ArgumentNullException("session"); }
_session = session;
}
/// <summary>
/// Direct DSM_Entry call with full arguments for custom values.
/// </summary>
/// <param name="group">The group.</param>
/// <param name="dat">The dat.</param>
/// <param name="message">The message.</param>
/// <param name="data">The data.</param>
/// <returns></returns>
public ReturnCode DsmEntry(
DataGroups group,
DataArgumentType dat,
Message message,
ref IntPtr data)
{
_session.VerifyState(3, 7, group, dat, message);
return Dsm.DsmEntry(_session.AppId, _session.SourceId, group, dat, message, ref data);
}
// todo: add other data value types?
}
}

View File

@@ -204,6 +204,19 @@ namespace NTwain
}
}
DGCustom _dgCustom;
/// <summary>
/// Gets the direct triplet operation entry for custom values.
/// </summary>
public DGCustom DGCustom
{
get
{
if (_dgCustom == null) { _dgCustom = new DGCustom(this); }
return _dgCustom;
}
}
#endregion
#region INotifyPropertyChanged Members