ntwain/NTwain/Triplets/DGControl/DGControl.SetupFileXfer.cs

67 lines
2.7 KiB
C#
Raw Normal View History

2014-04-03 07:13:15 +08:00
using NTwain.Data;
2014-04-03 07:01:21 +08:00
using NTwain.Values;
using System;
namespace NTwain.Triplets
{
2014-04-05 10:19:16 +08:00
/// <summary>
/// Represents <see cref="DataArgumentType.SetupFileXfer"/>.
/// </summary>
2014-04-03 07:01:21 +08:00
public sealed class SetupFileXfer : OpBase
{
2014-04-06 04:48:28 +08:00
internal SetupFileXfer(ITwainStateInternal session) : base(session) { }
2014-04-03 07:01:21 +08:00
/// <summary>
/// Returns information about the file into which the Source has or will put the acquired image
/// or audio data.
/// </summary>
/// <param name="setupFileXfer">The setup file xfer.</param>
/// <returns></returns>
public ReturnCode Get(out TWSetupFileXfer setupFileXfer)
{
Session.VerifyState(4, 6, DataGroups.Control, DataArgumentType.SetupFileXfer, Message.Get);
setupFileXfer = new TWSetupFileXfer();
2014-04-06 06:33:21 +08:00
return PInvoke.DsmEntry(Session.GetAppId(), Session.SourceId, Message.Get, setupFileXfer);
2014-04-03 07:01:21 +08:00
}
/// <summary>
/// Returns information for the default image or audio file.
/// </summary>
/// <param name="setupFileXfer">The setup file xfer.</param>
/// <returns></returns>
public ReturnCode GetDefault(out TWSetupFileXfer setupFileXfer)
{
Session.VerifyState(4, 6, DataGroups.Control, DataArgumentType.SetupFileXfer, Message.GetDefault);
setupFileXfer = new TWSetupFileXfer();
2014-04-06 06:33:21 +08:00
return PInvoke.DsmEntry(Session.GetAppId(), Session.SourceId, Message.GetDefault, setupFileXfer);
2014-04-03 07:01:21 +08:00
}
/// <summary>
/// Resets the current file information to the image or audio default file information and
/// returns that default information.
/// </summary>
/// <param name="setupFileXfer">The setup file xfer.</param>
/// <returns></returns>
public ReturnCode Reset(out TWSetupFileXfer setupFileXfer)
{
Session.VerifyState(4, 4, DataGroups.Control, DataArgumentType.SetupFileXfer, Message.Reset);
setupFileXfer = new TWSetupFileXfer();
2014-04-06 06:33:21 +08:00
return PInvoke.DsmEntry(Session.GetAppId(), Session.SourceId, Message.Reset, setupFileXfer);
2014-04-03 07:01:21 +08:00
}
/// <summary>
/// Sets the file transfer information for the next file transfer. The application is responsible for
/// verifying that the specified file name is valid and that the file either does not currently exist (in
/// which case, the Source is to create the file), or that the existing file is available for opening and
/// read/write operations. The application should also assure that the file format it is requesting
/// can be provided by the Source
/// </summary>
/// <param name="setupFileXfer">The setup file xfer.</param>
/// <returns></returns>
public ReturnCode Set(TWSetupFileXfer setupFileXfer)
{
Session.VerifyState(4, 6, DataGroups.Control, DataArgumentType.SetupFileXfer, Message.Set);
2014-04-06 06:33:21 +08:00
return PInvoke.DsmEntry(Session.GetAppId(), Session.SourceId, Message.Set, setupFileXfer);
2014-04-03 07:01:21 +08:00
}
}
}