diff --git a/NTwain.Net35/NTwain.Net35.csproj b/NTwain.Net35/NTwain.Net35.csproj
index b8d898b..5ebe768 100644
--- a/NTwain.Net35/NTwain.Net35.csproj
+++ b/NTwain.Net35/NTwain.Net35.csproj
@@ -46,15 +46,15 @@
+
+ Capabilities.cs
+
CapabilityReader.cs
CapWrapper.cs
-
- DataSource.Caps.cs
-
DataSource.cs
@@ -79,9 +79,6 @@
DeviceEventArgs.cs
-
- ICapControl.cs
-
ICapWrapper.cs
diff --git a/NTwain/CapWrapper.cs b/NTwain/CapWrapper.cs
index 11496a1..0f0ad73 100644
--- a/NTwain/CapWrapper.cs
+++ b/NTwain/CapWrapper.cs
@@ -114,7 +114,7 @@ namespace NTwain
var srcVersion = _source.ProtocolVersion;
if (srcVersion >= ProtocolVersions.GetMinimumVersion(Capability))
{
- _supports = _source.CapQuerySupport(Capability);
+ _supports = _source.Capabilities.QuerySupport(Capability);
if (!_supports.HasValue)
{
@@ -275,7 +275,7 @@ namespace NTwain
{
if (CanGetDefault)
{
- return _getConvertRoutine(_source.CapGetDefault(Capability));
+ return _getConvertRoutine(_source.Capabilities.GetDefault(Capability));
}
return default(TValue);
}
@@ -288,7 +288,7 @@ namespace NTwain
{
if (CanGetCurrent)
{
- return _getConvertRoutine(_source.CapGetCurrent(Capability));
+ return _getConvertRoutine(_source.Capabilities.GetCurrent(Capability));
}
return default(TValue);
}
@@ -299,7 +299,7 @@ namespace NTwain
///
public IList GetValues()
{
- return _source.CapGet(Capability).Select(o => _getConvertRoutine(o)).ToList();
+ return _source.Capabilities.GetValues(Capability).Select(o => _getConvertRoutine(o)).ToList();
}
///
@@ -384,7 +384,7 @@ namespace NTwain
///
public ReturnCode Reset()
{
- return _source.CapReset(Capability);
+ return _source.Capabilities.Reset(Capability);
}
///
diff --git a/NTwain/DataSource.Caps.cs b/NTwain/Capabilities.cs
similarity index 86%
rename from NTwain/DataSource.Caps.cs
rename to NTwain/Capabilities.cs
index 7ea8dd6..648e063 100644
--- a/NTwain/DataSource.Caps.cs
+++ b/NTwain/Capabilities.cs
@@ -6,27 +6,37 @@ using System.Text;
namespace NTwain
{
- // This contains all cap-related methods prefixed with Cap.
- // It will attempt to have all known cap abilities defined
- // with a wrapper unless it can only exist as part of another cap
- // or it's lame & nobody uses it.
-
-
- partial class DataSource : ICapControl
+ ///
+ /// Exposes capabilities of a data source as properties.
+ ///
+ public class Capabilities
{
- #region low-level cap stuff
+ IDataSource _source;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The source.
+ public Capabilities(IDataSource source)
+ {
+ if (source == null) { throw new ArgumentNullException("source"); }
+ _source = source;
+ }
+
+
+ #region non-wrapped cap calls
///
/// Gets the actual supported operations for a capability. This is not supported by all sources.
///
/// The capability id.
///
- public QuerySupports? CapQuerySupport(CapabilityId capabilityId)
+ public QuerySupports? QuerySupport(CapabilityId capabilityId)
{
QuerySupports? retVal = null;
using (TWCapability cap = new TWCapability(capabilityId))
{
- var rc = _session.DGControl.Capability.QuerySupport(cap);
+ var rc = _source.DGControl.Capability.QuerySupport(cap);
if (rc == ReturnCode.Success)
{
var read = CapabilityReader.ReadValue(cap);
@@ -45,11 +55,11 @@ namespace NTwain
///
/// The capability id.
///
- public object CapGetCurrent(CapabilityId capabilityId)
+ public object GetCurrent(CapabilityId capabilityId)
{
using (TWCapability cap = new TWCapability(capabilityId))
{
- var rc = _session.DGControl.Capability.GetCurrent(cap);
+ var rc = _source.DGControl.Capability.GetCurrent(cap);
if (rc == ReturnCode.Success)
{
var read = CapabilityReader.ReadValue(cap);
@@ -84,11 +94,11 @@ namespace NTwain
///
/// The capability id.
///
- public object CapGetDefault(CapabilityId capabilityId)
+ public object GetDefault(CapabilityId capabilityId)
{
using (TWCapability cap = new TWCapability(capabilityId))
{
- var rc = _session.DGControl.Capability.GetDefault(cap);
+ var rc = _source.DGControl.Capability.GetDefault(cap);
if (rc == ReturnCode.Success)
{
var read = CapabilityReader.ReadValue(cap);
@@ -123,12 +133,12 @@ namespace NTwain
///
/// The capability id.
///
- public IList