Upgrade NAPS2.Wia to 2.0.2, removing NAPS2.Wia.Native.dll

This commit is contained in:
Ben Olden-Cooligan 2023-04-08 11:37:04 -07:00
parent ca3eab84f6
commit 98c9c3f8cd
12 changed files with 17 additions and 10 deletions

View File

@ -23,8 +23,6 @@
<Import Project="..\NAPS2.Setup\targets\SdkUsers.targets" />
<ItemGroup>
<PackageReference Include="NAPS2.Wia" Version="1.0.2" />
<ProjectReference Include="..\NAPS2.App.WinForms\NAPS2.App.WinForms.csproj" />
<ProjectReference Include="..\NAPS2.App.Worker\NAPS2.App.Worker.csproj" />
<ProjectReference Include="..\NAPS2.Images.Gdi\NAPS2.Images.Gdi.csproj" />

View File

@ -15,7 +15,6 @@
<ItemGroup>
<PackageReference Include="NAPS2.Pdfium.Binaries" Version="1.0.0" />
<PackageReference Include="NAPS2.Tesseract.Binaries" Version="1.0.5" />
<PackageReference Include="NAPS2.Wia" Version="1.0.2" />
<ProjectReference Include="..\NAPS2.Lib.Tests\NAPS2.Lib.Tests.csproj" />

View File

@ -32,7 +32,6 @@
<ItemGroup>
<PackageReference Include="NAPS2.Pdfium.Binaries" Version="1.0.0" />
<PackageReference Include="NAPS2.Tesseract.Binaries" Version="1.0.5" />
<PackageReference Include="NAPS2.Wia" Version="1.0.2" />
<ProjectReference Include="..\NAPS2.App.Worker\NAPS2.App.Worker.csproj" />
<ProjectReference Include="..\NAPS2.Lib.WinForms\NAPS2.Lib.WinForms.csproj" />

View File

@ -18,7 +18,6 @@
<Import Project="..\NAPS2.Setup\targets\SdkUsers.targets" />
<ItemGroup>
<PackageReference Include="NAPS2.Wia" Version="1.0.2" />
<ProjectReference Include="..\NAPS2.Lib.WinForms\NAPS2.Lib.WinForms.csproj" />
<ProjectReference Include="..\NAPS2.Sdk\NAPS2.Sdk.csproj" />
<PackageReference Include="LargeAddressAware" Version="1.0.3" />

View File

@ -275,6 +275,9 @@ internal class ScanPerformer : IScanPerformer
// TODO: Not sure how best to handle this for console
if (options.Driver == Driver.Wia)
{
#if NET6_0_OR_GREATER
if (!OperatingSystem.IsWindows()) throw new NotSupportedException();
#endif
// WIA has a nice built-in device selection dialog, so use it
using var deviceManager = new WiaDeviceManager((WiaVersion) options.WiaOptions.WiaApiVersion);
try

View File

@ -14,7 +14,6 @@
<ProjectReference Include="..\NAPS2.Sdk.Tests\NAPS2.Sdk.Tests.csproj" />
<PackageReference Include="NAPS2.Sane.Binaries" Version="1.1.0" />
<PackageReference Include="NAPS2.Wia" Version="1.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Moq" Version="4.18.1" />
<PackageReference Include="xunit" Version="2.4.1" />

View File

@ -21,7 +21,6 @@
<Import Project="..\NAPS2.Setup\targets\CommonTargets.targets" />
<ItemGroup>
<PackageReference Include="NAPS2.Wia" Version="1.0.2" />
<ProjectReference Include="..\NAPS2.Images.Gdi\NAPS2.Images.Gdi.csproj" />
<ProjectReference Include="..\NAPS2.Sdk\NAPS2.Sdk.csproj" />
<PackageReference Include="LargeAddressAware" Version="1.0.3" />

View File

@ -37,7 +37,7 @@
<PackageReference Include="Grpc.Tools" Version="2.47.0" PrivateAssets="all" />
<PackageReference Include="GrpcDotNetNamedPipes" Version="2.0.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" Condition="'$(TargetFramework)' != 'net6-macos10.15'" />
<PackageReference Include="NAPS2.Wia" Version="1.0.2" Condition="'$(TargetFramework)' != 'net6-macos10.15'" />
<PackageReference Include="NAPS2.Wia" Version="2.0.2" Condition="'$(TargetFramework)' != 'net6-macos10.15'" />
<!-- Hide compatibility warnings for NTwain as it will only be actually used on Windows. -->
<!-- TODO: Does this actually work if we build a net6 framework-dependent app and try to use Twain? -->
<!-- <PackageReference Include="NTwain" Version="3.7.1" NoWarn="NU1701" Condition="'$(TargetFramework)' != 'net6-macos10.15'" />-->

View File

@ -73,6 +73,9 @@ public class WorkerServiceImpl : WorkerService.WorkerServiceBase
#if MAC
throw new NotSupportedException();
#else
#if NET6_0_OR_GREATER
if (!OperatingSystem.IsWindows()) throw new NotSupportedException();
#endif
using var callRef = StartCall();
try
{

View File

@ -18,8 +18,14 @@ internal class ScanDriverFactory : IScanDriverFactory
return new Apple.AppleScanDriver(_scanningContext);
#else
case Driver.Wia:
#if NET6_0_OR_GREATER
if (!OperatingSystem.IsWindows()) throw new NotSupportedException();
#endif
return new Wia.WiaScanDriver(_scanningContext);
case Driver.Twain:
#if NET6_0_OR_GREATER
if (!OperatingSystem.IsWindows()) throw new NotSupportedException();
#endif
return options.TwainOptions.Adapter == TwainAdapter.Legacy
? _scanningContext.LegacyTwainDriver ?? throw new NotSupportedException()
: new Twain.TwainScanDriver(_scanningContext);

View File

@ -7,6 +7,9 @@ using NAPS2.Wia;
namespace NAPS2.Scan.Internal.Wia;
#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
#endif
internal class WiaScanDriver : IScanDriver
{
private readonly ScanningContext _scanningContext;
@ -178,6 +181,7 @@ internal class WiaScanDriver : IScanDriver
transfer.Progress += (sender, args) => _scanEvents.PageProgress(args.Percent / 100.0);
using (_cancelToken.Register(transfer.Cancel))
{
// TODO: Need to call PageStart multiple times for feeder (and non-wia-1.0?)
_scanEvents.PageStart();
try
{

View File

@ -91,7 +91,6 @@ public class PackageCommand : ICommand<PackageOptions>
// too.
// TODO: Any better way to handle this? Run everything in the guaranteed 32-bit worker? Have a separate WinForms32 project?
// Or maybe we can deprecate the 32-bit MSI installer. Idk.
AddPlatformFile(pkgInfo, appBuildPath, "_win64", "NAPS2.Wia.Native.dll");
AddPlatformFile(pkgInfo, appBuildPath, "_win64", "twaindsm.dll");
AddPlatformFile(pkgInfo, appBuildPath, "_win64", "pdfium.dll");
}
@ -99,7 +98,6 @@ public class PackageCommand : ICommand<PackageOptions>
{
AddPlatformFiles(pkgInfo, appBuildPath, "_win64");
// Special case as we have a 64 bit main app and a 32 bit worker
AddPlatformFile(pkgInfo, appBuildPath, "_win32", "NAPS2.Wia.Native.dll");
AddPlatformFile(pkgInfo, appBuildPath, "_win32", "twaindsm.dll");
// TODO: We should run pdfium in a 64-bit worker
AddPlatformFile(pkgInfo, appBuildPath, "_win32", "pdfium.dll");