/// <summary> /// Every Source is required to have a single entry point called DS_Entry. DS_Entry is only called by the Source Manager. /// </summary> /// <param name="appId">This points to a TwIdentity structure, allocated by the application, that describes the /// application making the call. One of the fields in this structure, called Id, is an arbitrary and /// unique identifier assigned by the Source Manager to tag the application as a unique TWAIN /// entity. The Source Manager maintains a copy of the application’s identity structure, so the /// application must not modify that structure unless it first breaks its connection with the Source /// Manager,then reconnects to cause the Source Manager to store the new, modified identity.</param> /// <param name="dg">The Data Group of the operation triplet. Currently, only DG_CONTROL, DG_IMAGE, and DG_AUDIO are defined.</param> /// <param name="dat">The Data Argument Type of the operation triplet.</param> /// <param name="msg">The Message of the operation triplet.</param> /// <param name="data">The pData parameter is a pointer to the data (a variable or, more /// typically, a structure) that will be used according to the action specified by the operation /// triplet.</param> /// <returns>TWAIN Return Codes.</returns> public TwRC ProcessRequest(TwIdentity appId, TwDG dg, TwDAT dat, TwMSG msg, IntPtr data) { try { if (dg == TwDG.Control) { switch (dat) { case TwDAT.Identity: return(this._IdentityControlProcessRequest(appId, msg, data)); case TwDAT.Status: return(this._StatusControlProcessRequest(appId, msg, data)); case TwDAT.EntryPoint: return(this._EntryPointControlProcessRequest(appId, msg, Marshal.PtrToStructure(data, typeof(TwEntryPoint)) as TwEntryPoint)); } } this._SetConditionCode(appId, TwCC.Success); return(this._handlers[appId.Id].ProcessRequest(dg, dat, msg, data)); } catch (DataSourceException ex) { DataSourceServices._ToLog(ex); this._SetConditionCode(appId, ex.ConditionCode); return(ex.ReturnCode); } catch (Exception ex) { DataSourceServices._ToLog(ex); } this._SetConditionCode(appId, TwCC.OperationError); return(TwRC.Failure); }
private TwRC DSMparent(TwIdentity origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, ref IntPtr refptr) { if (IntPtr.Size == 8) { return(Twain64.DSMparent(origin, zeroptr, dg, dat, msg, ref refptr)); } else { return(Twain32.DSMparent(origin, zeroptr, dg, dat, msg, ref refptr)); } }
private TwRC DSuserif(TwIdentity origin, TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwUserInterface guif) { if (IntPtr.Size == 8) { return(Twain64.DSuserif(origin, dest, dg, dat, msg, guif)); } else { return(Twain32.DSuserif(origin, dest, dg, dat, msg, guif)); } }
private TwRC DSMident(TwIdentity origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, TwIdentity idds) { if (IntPtr.Size == 8) { return(Twain64.DSMident(origin, zeroptr, dg, dat, msg, idds)); } else { return(Twain32.DSMident(origin, zeroptr, dg, dat, msg, idds)); } }
private TwRC DSevent(TwIdentity origin, TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, ref TwEvent evt) { if (IntPtr.Size == 8) { return(Twain64.DSevent(origin, dest, dg, dat, msg, ref evt)); } else { return(Twain32.DSevent(origin, dest, dg, dat, msg, ref evt)); } }
private TwRC DSiinf(TwIdentity origin, TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwImageInfo imginf) { if (IntPtr.Size == 8) { return(Twain64.DSiinf(origin, dest, dg, dat, msg, imginf)); } else { return(Twain32.DSiinf(origin, dest, dg, dat, msg, imginf)); } }
private TwRC DSixfer(TwIdentity origin, TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, ref IntPtr hbitmap) { if (IntPtr.Size == 8) { return(Twain64.DSixfer(origin, dest, dg, dat, msg, ref hbitmap)); } else { return(Twain32.DSixfer(origin, dest, dg, dat, msg, ref hbitmap)); } }
private TwRC DSpxfer(TwIdentity origin, TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwPendingXfers pxfr) { if (IntPtr.Size == 8) { return(Twain64.DSpxfer(origin, dest, dg, dat, msg, pxfr)); } else { return(Twain32.DSpxfer(origin, dest, dg, dat, msg, pxfr)); } }
private TwRC DScap(TwIdentity origin, TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwCapability capa) { if (IntPtr.Size == 8) { return(Twain64.DScap(origin, dest, dg, dat, msg, capa)); } else { return(Twain32.DScap(origin, dest, dg, dat, msg, capa)); } }
/// <summary> /// Invoked to processing a TWAIN operations (Triplets). /// </summary> /// <param name="dg">The Data Group of the operation triplet. Currently, only DG_CONTROL, DG_IMAGE, and DG_AUDIO are defined.</param> /// <param name="dat">The Data Argument Type of the operation triplet.</param> /// <param name="msg">The Message of the operation triplet.</param> /// <param name="data">The pData parameter is a pointer to the data (a variable or, more /// typically, a structure) that will be used according to the action specified by the operation /// triplet.</param> /// <returns> /// TWAIN Return Codes. /// </returns> /// <exception cref="DataSourceException"> /// </exception> protected override TwRC OnProcessRequest(TwDG dg, TwDAT dat, TwMSG msg, IntPtr data) { if (dg == TwDG.Image) { switch (dat) { case TwDAT.ImageLayout: return(this._ImageLayoutProcessRequest(msg, data)); case TwDAT.ImageInfo: if ((this.State & DataSourceState.Ready) != 0) { return(this._ImageInfoProcessRequest(msg, data)); } throw new DataSourceException(TwRC.Failure, TwCC.SeqError); case TwDAT.ImageNativeXfer: if ((this.State & DataSourceState.Ready) != 0) { return(this._ImageNativeXferProcessRequest(msg, data)); } throw new DataSourceException(TwRC.Failure, TwCC.SeqError); case TwDAT.ImageMemXfer: if ((this.State & DataSourceState.Ready) != 0) { return(this._ImageMemXferProcessRequest(msg, data, false)); } throw new DataSourceException(TwRC.Failure, TwCC.SeqError); case TwDAT.ImageMemFileXfer: if ((this.State & DataSourceState.Ready) != 0) { return(this._ImageMemXferProcessRequest(msg, data, true)); } throw new DataSourceException(TwRC.Failure, TwCC.SeqError); case TwDAT.ImageFileXfer: if ((this.State & DataSourceState.Ready) != 0) { return(this._ImageFileXferProcessRequest(msg)); } throw new DataSourceException(TwRC.Failure, TwCC.SeqError); } } return(base.OnProcessRequest(dg, dat, msg, data)); }
/// <summary> /// Every Source is required to have a single entry point called DS_Entry. DS_Entry is only called by the Source Manager. /// </summary> /// <param name="appId"> /// This points to a TwIdentity structure, allocated by the application, that describes the /// application making the call. One of the fields in this structure, called Id, is an arbitrary and /// unique identifier assigned by the Source Manager to tag the application as a unique TWAIN /// entity. The Source Manager maintains a copy of the application’s identity structure, so the /// application must not modify that structure unless it first breaks its connection with the Source /// Manager,then reconnects to cause the Source Manager to store the new, modified identity. /// </param> /// <param name="dg">The Data Group of the operation triplet. Currently, only DG_CONTROL, DG_IMAGE, and DG_AUDIO are defined.</param> /// <param name="dat">The Data Argument Type of the operation triplet.</param> /// <param name="msg">The Message of the operation triplet.</param> /// <param name="data"> /// The pData parameter is a pointer to the data (a variable or, more /// typically, a structure) that will be used according to the action specified by the operation /// triplet. /// </param> /// <returns>TWAIN Return Codes.</returns> public TwRC ProcessRequest(TwIdentity appId, TwDG dg, TwDAT dat, TwMSG msg, IntPtr data) { if (this.AppIdentity == null) { this.AppIdentity = appId; } if (this.AppIdentity.Id != appId.Id) { throw new DataSourceException(TwRC.Failure, TwCC.OperationError); } if (!this.SupportedDataCodes.Contains(dat)) { throw new DataSourceException(TwRC.Failure, TwCC.OperationError); } if (dg == TwDG.Control) { switch (dat) { case TwDAT.Event: return(this._EventProcessRequest(msg, data)); case TwDAT.UserInterface: return(this._UserInterfaceProcessRequest(msg, data)); case TwDAT.XferGroup: return(this._XferGroupProcessRequest(msg, data)); case TwDAT.Capability: return(this._CapabilityProcessRequest(msg, data)); case TwDAT.PendingXfers: return(this._PendingXfersProcessRequest(msg, data)); case TwDAT.SetupMemXfer: return(this._SetupMemXferProcessRequest(msg, data)); case TwDAT.SetupFileXfer: return(this._SetupFileXferProcessRequest(msg, data)); } } return(this.OnProcessRequest(dg, dat, msg, data)); }
private static extern TwRC DScap([In, Out] TW_IDENTITY origin, [In] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwCapability capa);
private TwRC DsImageLayuot([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwImageLayout imageLayuot) { using (new MessageBoxHook()) { return _DsImageLayuot(origin, dest, dg, dat, msg, imageLayuot); } }
private TwRC DsPendingXfer([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwPendingXfers pxfr) { using (new MessageBoxHook()) { return _DsPendingXfer(origin, dest, dg, dat, msg, pxfr); } }
private TwRC DsImageXfer([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, ref IntPtr hbitmap) { using (new MessageBoxHook()) { return _DsImageXfer(origin, dest, dg, dat, msg, ref hbitmap); } }
private TwRC DsCap([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwCapability capa) { using (new MessageBoxHook()) { return _DsCap(origin, dest, dg, dat, msg, capa); } }
private static extern TwRC DSMparent([In, Out] TW_IDENTITY origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, ref IntPtr refptr);
private static extern TwRC DSixfer([In, Out] TW_IDENTITY origin, [In] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, ref IntPtr hbitmap);
private TwRC DsmIdent([In, Out] TwIdentity origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwIdentity idds) { using (new MessageBoxHook()) { return _DsmIdent(origin, zeroptr, dg, dat, msg, idds); } }
private TwRC DsmParent([In, Out] TwIdentity origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, ref IntPtr refptr) { using (new MessageBoxHook()) { return _DsmParent(origin, zeroptr, dg, dat, msg, ref refptr); } }
private static extern TwRC DSpxfer([In, Out] TW_IDENTITY origin, [In] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TW_PENDINGXFERS pxfr);
private static extern TwRC DSixfer([In, Out] TW_IDENTITY origin, [In] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, ref IntPtr hbitmap);
private static extern TwRC DSiinf([In, Out] TW_IDENTITY origin, [In] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TW_IMAGEINFO imginf);
private static extern TwRC DScap([In, Out] TW_IDENTITY origin, [In] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwCapability capa);
private static extern TwRC DSevent([In, Out] TW_IDENTITY origin, [In, Out] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, ref TW_EVENT evt);
private static extern TwRC DSiinf([In, Out] TW_IDENTITY origin, [In] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TW_IMAGEINFO imginf);
private TwRC DsStatus([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwStatus dsmstat) { using (new MessageBoxHook()) { return _DsStatus(origin, dest, dg, dat, msg, dsmstat); } }
private static extern TwRC DSMident([In, Out] TW_IDENTITY origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TW_IDENTITY idds);
public static extern TwRC DSMident([In, Out] TwIdentity origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwIdentity idds);
private static extern TwRC DSMstatus([In, Out] TW_IDENTITY origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TW_STATUS dsmstat);
private static extern TwRC DSpxfer([In, Out] TW_IDENTITY origin, [In] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TW_PENDINGXFERS pxfr);
private static extern TwRC DSpxfer([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwPendingXfers pxfr);
public TwRC ProcessRequest(TwDG dg, TwDAT dat, TwMSG msg, IntPtr data) { return(this.Handler.ProcessRequest(this.Application.Identity, dg, dat, msg, data)); }
private static extern TwRC DScap([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwCapability capa);
private static extern TwRC DSiinf([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwImageInfo imginf);
private static extern TwRC DSMstatus([In, Out] TwIdentity origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwStatus dsmstat);
private static extern TwRC DSevent([In, Out] TwIdentity origin, [In, Out] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, ref TwEvent evt);
public static extern TwRC DSuserif([In, Out] TwIdentity origin, [In, Out] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwUserInterface guif);
public static extern TwRC DSevent([In, Out] TwIdentity origin, [In, Out] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, ref TwEvent evt);
private static extern TwRC DSstatus([In, Out] TW_IDENTITY origin, [In] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TW_STATUS dsmstat);
public static extern TwRC DSMstatus([In, Out] TwIdentity origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwStatus dsmstat);
public static extern TwRC DSMparent([In, Out] TwIdentity origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, ref IntPtr refptr);
private static extern TwRC DSuserif([In, Out] TW_IDENTITY origin, [In, Out] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, TW_USERINTERFACE guif);
private static extern TwRC DSstatus([In, Out] TW_IDENTITY origin, [In] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TW_STATUS dsmstat);
private static extern TwRC DSMparent([In, Out] TwIdentity origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, ref IntPtr refptr);
public static extern TwRC DSstatus([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwStatus dsmstat);
private static extern TwRC DSMident([In, Out] TwIdentity origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwIdentity idds);
public static extern TwRC DScap([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwCapability capa);
private static extern TwRC DSuserif([In, Out] TwIdentity origin, [In, Out] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwUserInterface guif);
public static extern TwRC DSiinf([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwImageInfo imginf);
private static extern TwRC DSstatus([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwStatus dsmstat);
public static extern TwRC DSilayout([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwImageLayout value);
private static extern TwRC DScap([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwSetupFileXFfer setupFileXFfer);
public static extern TwRC DSixfer([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, ref IntPtr hbitmap);
private static extern TwRC DSixfer([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, ref IntPtr hbitmap);
public static extern TwRC DSpxfer([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwPendingXfers pxfr);
private static extern TwRC DSpxfer([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwSetupFileXfers sfxfr);
public static extern TwRC DScustomData([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwCustomDsData data);
private static extern TwRC DSevent([In, Out] TW_IDENTITY origin, [In, Out] TW_IDENTITY dest, TwDG dg, TwDAT dat, TwMSG msg, ref TW_EVENT evt);
private TwRC DsUI([In, Out] TwIdentity origin, [In, Out] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwUserInterface guif) { using (new MessageBoxHook()) { return _DsUI(origin, dest, dg, dat, msg, guif); } }