ntwain/src/NTwain/Triplets/BaseTriplet.cs

48 lines
1.5 KiB
C#
Raw Normal View History

2018-11-14 10:02:29 +08:00
using System;
namespace NTwain.Triplets
2018-11-14 08:30:58 +08:00
{
2018-11-14 10:02:29 +08:00
/// <summary>
/// Base class for grouping triplet operations.
/// </summary>
2018-11-14 08:30:58 +08:00
public abstract class BaseTriplet
{
2018-11-14 10:02:29 +08:00
/// <summary>
/// Gets the associated <see cref="TwainSession"/>.
/// </summary>
protected readonly TwainSession Session;
2018-11-14 08:30:58 +08:00
2018-11-14 10:02:29 +08:00
/// <summary>
/// Initializes a new instance of the <see cref="BaseTriplet" /> class.
/// </summary>
/// <param name="session">The session.</param>
/// <exception cref="System.ArgumentNullException"></exception>
protected BaseTriplet(TwainSession session)
2018-11-14 08:30:58 +08:00
{
2018-11-14 10:02:29 +08:00
this.Session = session ?? throw new ArgumentNullException(nameof(session));
Is32Bit = session.Config.Is32Bit;
IsWin = session.Config.Platform == System.PlatformID.Win32NT;
IsLinux = session.Config.Platform == System.PlatformID.Unix;
IsMac = session.Config.Platform == System.PlatformID.MacOSX;
2018-11-14 08:30:58 +08:00
}
/// <summary>
/// Whether to use 32bit data structures.
/// </summary>
protected readonly bool Is32Bit;
/// <summary>
/// Whether platform is Windows.
/// </summary>
protected readonly bool IsWin;
/// <summary>
/// Whether platform is Linux.
/// </summary>
protected readonly bool IsLinux;
2018-12-01 11:17:16 +08:00
/// <summary>
/// Whether platform is MacOS.
2018-12-01 11:17:16 +08:00
/// </summary>
protected readonly bool IsMac;
2018-11-14 08:30:58 +08:00
}
}