Merge pull request #4 from soukoku/v4-dev

Readme & exception throws
This commit is contained in:
Eugene Wang 2018-11-24 13:53:39 -05:00 committed by GitHub
commit c6ec249e05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -1,18 +1,18 @@
# TWAIN dotnet library # TWAIN dotnet library
NOTE: THIS IS V4 DEV AND DOESN'T WORK YET. NOTE: This is V4 DEV and doesn't fully work yet.
USE V3 BRANCH FOR WORKING VERSION. Use V3 branch for working version.
## Info ## Info
This is a library created to make working with This is a dotnet library created to make working with
[TWAIN](http://twain.org/) easier in dotnet. [TWAIN](http://twain.org/) easier.
V4 of this lib has these goals: V4 of this lib has these goals:
* Targets latest TWAIN version (2.4 as of this writing) * Targets latest TWAIN version (2.4 as of this writing).
* Supports all the TWAIN functions in the spec (directly or through dotnet wrapper) * Supports all the TWAIN functions in the spec (directly or through dotnet wrapper).
* Works with both 32 or 64 bit data sources, from 32 or 64 bit apps. * Works with both 32 or 64 bit data sources, under 32 or 64 bit apps.
* Works on non-Windows platforms using dotnet core * Supports dotnet 4+ and netcore 2+ apps.
## Using the lib ## Using the lib

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Runtime.ExceptionServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -18,9 +19,13 @@ namespace NTwain.Internals
{ {
if (ex != null) if (ex != null)
{ {
#if NET40
typeof(Exception).GetMethod("PrepForRemoting", typeof(Exception).GetMethod("PrepForRemoting",
BindingFlags.NonPublic | BindingFlags.Instance)?.Invoke(ex, new object[0]); BindingFlags.NonPublic | BindingFlags.Instance)?.Invoke(ex, new object[0]);
throw ex; throw ex;
#else
ExceptionDispatchInfo.Capture(ex).Throw();
#endif
} }
} }