mirror of
https://github.com/cyanfish/naps2.git
synced 2024-09-11 15:26:55 +03:00
Clean up NAPS2.ImportExport namespace for SDK
This commit is contained in:
parent
585cf9bec1
commit
09ee0dea3d
@ -19,7 +19,7 @@ public class AutomatedScanning
|
||||
private readonly IEmailProviderFactory _emailProviderFactory;
|
||||
private readonly IScanPerformer _scanPerformer;
|
||||
private readonly ErrorOutput _errorOutput;
|
||||
private readonly IScannedImageImporter _scannedImageImporter;
|
||||
private readonly IFileImporter _fileImporter;
|
||||
private readonly IOperationFactory _operationFactory;
|
||||
private readonly TesseractLanguageManager _tesseractLanguageManager;
|
||||
private readonly IFormFactory _formFactory;
|
||||
@ -40,7 +40,7 @@ public class AutomatedScanning
|
||||
|
||||
public AutomatedScanning(ConsoleOutput output, AutomatedScanningOptions options, ImageContext imageContext,
|
||||
IScanPerformer scanPerformer, ErrorOutput errorOutput, IEmailProviderFactory emailProviderFactory,
|
||||
IScannedImageImporter scannedImageImporter, IOperationFactory operationFactory,
|
||||
IFileImporter fileImporter, IOperationFactory operationFactory,
|
||||
TesseractLanguageManager tesseractLanguageManager, IFormFactory formFactory, Naps2Config config,
|
||||
IProfileManager profileManager, RecoveryStorageManager recoveryStorageManager, ScanningContext scanningContext)
|
||||
{
|
||||
@ -50,7 +50,7 @@ public class AutomatedScanning
|
||||
_scanPerformer = scanPerformer;
|
||||
_errorOutput = errorOutput;
|
||||
_emailProviderFactory = emailProviderFactory;
|
||||
_scannedImageImporter = scannedImageImporter;
|
||||
_fileImporter = fileImporter;
|
||||
_operationFactory = operationFactory;
|
||||
_tesseractLanguageManager = tesseractLanguageManager;
|
||||
_formFactory = formFactory;
|
||||
@ -284,7 +284,7 @@ public class AutomatedScanning
|
||||
PatchTOnly = true
|
||||
}
|
||||
};
|
||||
await foreach (var image in _scannedImageImporter.Import(actualPath, importParams))
|
||||
await foreach (var image in _fileImporter.Import(actualPath, importParams))
|
||||
{
|
||||
scan.Add(image);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace NAPS2.ImportExport.Images;
|
||||
|
||||
public class SaveImagesOperation : OperationBase
|
||||
internal class SaveImagesOperation : OperationBase
|
||||
{
|
||||
private readonly IOverwritePrompt _overwritePrompt;
|
||||
private readonly ImageContext _imageContext;
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
public class ImportOperation : OperationBase
|
||||
{
|
||||
private readonly IScannedImageImporter _scannedImageImporter;
|
||||
private readonly IFileImporter _fileImporter;
|
||||
|
||||
public ImportOperation(IScannedImageImporter scannedImageImporter)
|
||||
public ImportOperation(IFileImporter fileImporter)
|
||||
{
|
||||
_scannedImageImporter = scannedImageImporter;
|
||||
_fileImporter = fileImporter;
|
||||
|
||||
ProgressTitle = MiscResources.ImportProgress;
|
||||
AllowCancel = true;
|
||||
@ -31,7 +31,7 @@ public class ImportOperation : OperationBase
|
||||
{
|
||||
Status.StatusText = string.Format(MiscResources.ImportingFormat, Path.GetFileName(fileName));
|
||||
InvokeStatusChanged();
|
||||
var images = _scannedImageImporter.Import(fileName, importParams, oneFile ? ProgressHandler : CancelToken);
|
||||
var images = _fileImporter.Import(fileName, importParams, oneFile ? ProgressHandler : CancelToken);
|
||||
await foreach (var image in images)
|
||||
{
|
||||
imageCallback(image);
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace NAPS2.ImportExport;
|
||||
|
||||
public static class SaveSeparatorHelper
|
||||
internal static class SaveSeparatorHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Given a list of scans (each of which is a list of 1 or more images),
|
@ -21,7 +21,7 @@ public class CommonModule : Module
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
// Import
|
||||
builder.RegisterType<ScannedImageImporter>().As<IScannedImageImporter>();
|
||||
builder.RegisterType<FileImporter>().As<IFileImporter>();
|
||||
builder.RegisterType<PdfImporter>().As<IPdfImporter>();
|
||||
builder.RegisterType<ImageImporter>().As<IImageImporter>();
|
||||
builder.RegisterType<RecoveryManager>().AsSelf();
|
||||
|
@ -4,7 +4,7 @@ using NAPS2.Ocr;
|
||||
|
||||
namespace NAPS2.Pdf;
|
||||
|
||||
public class SavePdfOperation : OperationBase
|
||||
internal class SavePdfOperation : OperationBase
|
||||
{
|
||||
private readonly IPdfExporter _pdfExporter;
|
||||
private readonly IOverwritePrompt _overwritePrompt;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Collections.Immutable;
|
||||
using NAPS2.ImportExport;
|
||||
using NAPS2.ImportExport.Images;
|
||||
using NAPS2.Scan;
|
||||
using NAPS2.Serialization;
|
||||
@ -8,14 +9,12 @@ namespace NAPS2.Recovery;
|
||||
public class RecoverableFolder : IDisposable
|
||||
{
|
||||
private readonly ScanningContext _scanningContext;
|
||||
private readonly ImportPostProcessor _importPostProcessor;
|
||||
private readonly DirectoryInfo _directory;
|
||||
private readonly FileStream _lockFile;
|
||||
private readonly RecoveryIndex _recoveryIndex;
|
||||
private bool _disposed;
|
||||
|
||||
public static RecoverableFolder? TryCreate(ScanningContext scanningContext, ImportPostProcessor importPostProcessor,
|
||||
DirectoryInfo directory)
|
||||
public static RecoverableFolder? TryCreate(ScanningContext scanningContext, DirectoryInfo directory)
|
||||
{
|
||||
string indexFilePath = Path.Combine(directory.FullName, "index.xml");
|
||||
string lockFilePath = Path.Combine(directory.FullName, RecoveryStorageManager.LOCK_FILE_NAME);
|
||||
@ -33,7 +32,7 @@ public class RecoverableFolder : IDisposable
|
||||
// TODO: Consider auto-delete in this case
|
||||
// TODO: Also in the case where you have a lock file but no index is written (especially if no images are present)
|
||||
if (imageCount == 0) return null;
|
||||
return new RecoverableFolder(scanningContext, importPostProcessor, directory, lockFile, recoveryIndex,
|
||||
return new RecoverableFolder(scanningContext, directory, lockFile, recoveryIndex,
|
||||
imageCount, scannedDateTime);
|
||||
}
|
||||
catch (Exception)
|
||||
@ -43,12 +42,10 @@ public class RecoverableFolder : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
public RecoverableFolder(ScanningContext scanningContext, ImportPostProcessor importPostProcessor,
|
||||
DirectoryInfo directory, FileStream lockFile, RecoveryIndex recoveryIndex, int imageCount,
|
||||
DateTime scannedDateTime)
|
||||
public RecoverableFolder(ScanningContext scanningContext, DirectoryInfo directory, FileStream lockFile,
|
||||
RecoveryIndex recoveryIndex, int imageCount, DateTime scannedDateTime)
|
||||
{
|
||||
_scanningContext = scanningContext;
|
||||
_importPostProcessor = importPostProcessor;
|
||||
_directory = directory;
|
||||
_lockFile = lockFile;
|
||||
_recoveryIndex = recoveryIndex;
|
||||
@ -133,7 +130,7 @@ public class RecoverableFolder : IDisposable
|
||||
indexImage.TransformList!.ToImmutableList());
|
||||
|
||||
// TODO: Make this take a lazy rendered image or something
|
||||
processedImage = _importPostProcessor.AddPostProcessingData(processedImage,
|
||||
processedImage = ImportPostProcessor.AddPostProcessingData(processedImage,
|
||||
null,
|
||||
recoveryParams.ThumbnailSize,
|
||||
new BarcodeDetectionOptions(),
|
||||
|
@ -6,17 +6,10 @@ namespace NAPS2.Recovery;
|
||||
public class RecoveryManager
|
||||
{
|
||||
private readonly ScanningContext _scanningContext;
|
||||
private readonly ImportPostProcessor _importPostProcessor;
|
||||
|
||||
public RecoveryManager(ScanningContext scanningContext)
|
||||
: this(scanningContext, new ImportPostProcessor())
|
||||
{
|
||||
}
|
||||
|
||||
public RecoveryManager(ScanningContext scanningContext, ImportPostProcessor importPostProcessor)
|
||||
{
|
||||
_scanningContext = scanningContext;
|
||||
_importPostProcessor = importPostProcessor;
|
||||
}
|
||||
|
||||
public RecoverableFolder? GetLatestRecoverableFolder()
|
||||
@ -43,7 +36,7 @@ public class RecoveryManager
|
||||
{
|
||||
try
|
||||
{
|
||||
return RecoverableFolder.TryCreate(_scanningContext, _importPostProcessor, directory);
|
||||
return RecoverableFolder.TryCreate(_scanningContext, directory);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ public class ImageImporterTests : ContextualTests
|
||||
|
||||
public ImageImporterTests()
|
||||
{
|
||||
_imageImporter = new ImageImporter(ScanningContext, ImageContext, new ImportPostProcessor());
|
||||
_imageImporter = new ImageImporter(ScanningContext);
|
||||
ScanningContext.FileStorageManager = FileStorageManager.CreateFolder(Path.Combine(FolderPath, "recovery"));
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
using NAPS2.ImportExport;
|
||||
using NAPS2.ImportExport.Images;
|
||||
using NAPS2.Scan;
|
||||
using NAPS2.Sdk.Tests.Asserts;
|
||||
@ -7,19 +8,12 @@ namespace NAPS2.Sdk.Tests.ImportExport;
|
||||
|
||||
public class ImportPostProcessorTests : ContextualTests
|
||||
{
|
||||
private readonly ImportPostProcessor _importPostProcessor;
|
||||
|
||||
public ImportPostProcessorTests()
|
||||
{
|
||||
_importPostProcessor = new ImportPostProcessor();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NoPostProcessing()
|
||||
{
|
||||
using var image = ScanningContext.CreateProcessedImage(LoadImage(ImageResources.dog));
|
||||
using var image2 =
|
||||
_importPostProcessor.AddPostProcessingData(image, null, null, new BarcodeDetectionOptions(), false);
|
||||
ImportPostProcessor.AddPostProcessingData(image, null, null, new BarcodeDetectionOptions(), false);
|
||||
|
||||
Assert.Null(image2.PostProcessingData.Thumbnail);
|
||||
Assert.Null(image2.PostProcessingData.ThumbnailTransformState);
|
||||
@ -34,7 +28,7 @@ public class ImportPostProcessorTests : ContextualTests
|
||||
{
|
||||
using var image = ScanningContext.CreateProcessedImage(LoadImage(ImageResources.dog));
|
||||
using var image2 =
|
||||
_importPostProcessor.AddPostProcessingData(image, null, null, new BarcodeDetectionOptions(), true);
|
||||
ImportPostProcessor.AddPostProcessingData(image, null, null, new BarcodeDetectionOptions(), true);
|
||||
|
||||
Assert.False(IsDisposed(image2));
|
||||
image2.Dispose();
|
||||
@ -46,7 +40,7 @@ public class ImportPostProcessorTests : ContextualTests
|
||||
{
|
||||
using var image = ScanningContext.CreateProcessedImage(LoadImage(ImageResources.dog));
|
||||
using var image2 =
|
||||
_importPostProcessor.AddPostProcessingData(image, null, 256, new BarcodeDetectionOptions(), false);
|
||||
ImportPostProcessor.AddPostProcessingData(image, null, 256, new BarcodeDetectionOptions(), false);
|
||||
|
||||
var actual = image2.PostProcessingData.Thumbnail;
|
||||
|
||||
@ -63,7 +57,7 @@ public class ImportPostProcessorTests : ContextualTests
|
||||
using var image = ScanningContext.CreateProcessedImage(LoadImage(ImageResources.dog));
|
||||
using var image2 = image.WithTransform(new BrightnessTransform(300));
|
||||
using var image3 =
|
||||
_importPostProcessor.AddPostProcessingData(image2, null, 256, new BarcodeDetectionOptions(), false);
|
||||
ImportPostProcessor.AddPostProcessingData(image2, null, 256, new BarcodeDetectionOptions(), false);
|
||||
|
||||
var actual = image3.PostProcessingData.Thumbnail;
|
||||
|
||||
@ -83,7 +77,7 @@ public class ImportPostProcessorTests : ContextualTests
|
||||
using var rendered = LoadImage(ImageResources.dog);
|
||||
using var image = ScanningContext.CreateProcessedImage(rendered);
|
||||
using var image2 =
|
||||
_importPostProcessor.AddPostProcessingData(image, rendered, 256, new BarcodeDetectionOptions(), true);
|
||||
ImportPostProcessor.AddPostProcessingData(image, rendered, 256, new BarcodeDetectionOptions(), true);
|
||||
|
||||
var actual = image2.PostProcessingData.Thumbnail;
|
||||
|
||||
@ -103,7 +97,7 @@ public class ImportPostProcessorTests : ContextualTests
|
||||
{
|
||||
using var image = ScanningContext.CreateProcessedImage(LoadImage(ImageResources.patcht));
|
||||
var barcodeOptions = new BarcodeDetectionOptions { DetectBarcodes = true };
|
||||
using var image2 = _importPostProcessor.AddPostProcessingData(image, null, null, barcodeOptions, false);
|
||||
using var image2 = ImportPostProcessor.AddPostProcessingData(image, null, null, barcodeOptions, false);
|
||||
|
||||
Assert.True(image2.PostProcessingData.Barcode.IsPatchT);
|
||||
}
|
||||
@ -114,7 +108,7 @@ public class ImportPostProcessorTests : ContextualTests
|
||||
using var rendered = LoadImage(ImageResources.patcht);
|
||||
using var image = ScanningContext.CreateProcessedImage(rendered);
|
||||
var barcodeOptions = new BarcodeDetectionOptions { DetectBarcodes = true };
|
||||
using var image2 = _importPostProcessor.AddPostProcessingData(image, rendered, null, barcodeOptions, false);
|
||||
using var image2 = ImportPostProcessor.AddPostProcessingData(image, rendered, null, barcodeOptions, false);
|
||||
|
||||
Assert.True(image2.PostProcessingData.Barcode.IsPatchT);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class WorkerChannelTests : ContextualTests
|
||||
NamedPipeServer server = new NamedPipeServer(pipeName);
|
||||
WorkerService.BindService(server.ServiceBinder,
|
||||
new WorkerServiceImpl(ScanningContext, remoteScanController, thumbnailRenderer, mapiWrapper,
|
||||
twainSessionController, new ImportPostProcessor()));
|
||||
twainSessionController));
|
||||
server.Start();
|
||||
var client = new WorkerServiceAdapter(new NamedPipeChannel(".", pipeName));
|
||||
return new Channel
|
||||
|
@ -3,12 +3,12 @@ using NAPS2.Pdf;
|
||||
|
||||
namespace NAPS2.ImportExport;
|
||||
|
||||
public class ScannedImageImporter : IScannedImageImporter
|
||||
public class FileImporter : IFileImporter
|
||||
{
|
||||
private readonly IScannedImageImporter _pdfImporter;
|
||||
private readonly IScannedImageImporter _imageImporter;
|
||||
private readonly IFileImporter _pdfImporter;
|
||||
private readonly IFileImporter _imageImporter;
|
||||
|
||||
public ScannedImageImporter(IPdfImporter pdfImporter, IImageImporter imageImporter)
|
||||
public FileImporter(IPdfImporter pdfImporter, IImageImporter imageImporter)
|
||||
{
|
||||
_pdfImporter = pdfImporter;
|
||||
_imageImporter = imageImporter;
|
@ -1,6 +1,6 @@
|
||||
namespace NAPS2.ImportExport;
|
||||
|
||||
public interface IScannedImageImporter
|
||||
public interface IFileImporter
|
||||
{
|
||||
IAsyncEnumerable<ProcessedImage> Import(string filePath, ImportParams importParams, ProgressHandler progress = default);
|
||||
}
|
5
NAPS2.Sdk/ImportExport/IImageImporter.cs
Normal file
5
NAPS2.Sdk/ImportExport/IImageImporter.cs
Normal file
@ -0,0 +1,5 @@
|
||||
namespace NAPS2.ImportExport;
|
||||
|
||||
public interface IImageImporter : IFileImporter
|
||||
{
|
||||
}
|
@ -1,20 +1,15 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NAPS2.Scan;
|
||||
|
||||
namespace NAPS2.ImportExport.Images;
|
||||
namespace NAPS2.ImportExport;
|
||||
|
||||
public class ImageImporter : IImageImporter
|
||||
{
|
||||
private readonly ScanningContext _scanningContext;
|
||||
private readonly ImageContext _imageContext;
|
||||
private readonly ImportPostProcessor _importPostProcessor;
|
||||
|
||||
public ImageImporter(ScanningContext scanningContext, ImageContext imageContext,
|
||||
ImportPostProcessor importPostProcessor)
|
||||
public ImageImporter(ScanningContext scanningContext)
|
||||
{
|
||||
_scanningContext = scanningContext;
|
||||
_imageContext = imageContext;
|
||||
_importPostProcessor = importPostProcessor;
|
||||
}
|
||||
|
||||
public IAsyncEnumerable<ProcessedImage> Import(string filePath, ImportParams importParams,
|
||||
@ -28,7 +23,7 @@ public class ImageImporter : IImageImporter
|
||||
try
|
||||
{
|
||||
var toImport =
|
||||
_imageContext.LoadFrames(filePath, new ProgressCallback((current, max) =>
|
||||
_scanningContext.ImageContext.LoadFrames(filePath, new ProgressCallback((current, max) =>
|
||||
{
|
||||
frameCount = max;
|
||||
if (current == 0)
|
||||
@ -53,7 +48,7 @@ public class ImageImporter : IImageImporter
|
||||
lossless,
|
||||
-1,
|
||||
null);
|
||||
image = _importPostProcessor.AddPostProcessingData(
|
||||
image = ImportPostProcessor.AddPostProcessingData(
|
||||
image,
|
||||
frame,
|
||||
importParams.ThumbnailSize,
|
@ -1,5 +0,0 @@
|
||||
namespace NAPS2.ImportExport.Images;
|
||||
|
||||
public interface IImageImporter : IScannedImageImporter
|
||||
{
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
using NAPS2.Scan;
|
||||
|
||||
namespace NAPS2.ImportExport.Images;
|
||||
namespace NAPS2.ImportExport;
|
||||
|
||||
// TODO: Maybe make this static (and ImportExportHelper, ImageClipboard, etc.) now that ImageContext is on the image
|
||||
public class ImportPostProcessor
|
||||
internal static class ImportPostProcessor
|
||||
{
|
||||
public ProcessedImage AddPostProcessingData(ProcessedImage image, IMemoryImage? rendered, int? thumbnailSize,
|
||||
public static ProcessedImage AddPostProcessingData(ProcessedImage image, IMemoryImage? rendered, int? thumbnailSize,
|
||||
BarcodeDetectionOptions barcodeDetectionOptions, bool disposeOriginalImage)
|
||||
{
|
||||
if (!thumbnailSize.HasValue && !barcodeDetectionOptions.DetectBarcodes)
|
@ -7,7 +7,7 @@ namespace NAPS2.ImportExport;
|
||||
/// Class for handling substitution of special values in file paths. For example, "$(YYYY)" can be substituted with the current year.
|
||||
/// Use Placeholders.All for recommended substitutions. Alternatively, you can use Placeholders.Env or Placeholders.None if you prefer.
|
||||
/// </summary>
|
||||
public abstract class Placeholders
|
||||
internal abstract class Placeholders
|
||||
{
|
||||
public const string YEAR_4_DIGITS = "$(YYYY)";
|
||||
public const string YEAR_2_DIGITS = "$(YY)";
|
||||
|
@ -2,6 +2,6 @@
|
||||
|
||||
namespace NAPS2.Pdf;
|
||||
|
||||
public interface IPdfImporter : IScannedImageImporter
|
||||
public interface IPdfImporter : IFileImporter
|
||||
{
|
||||
}
|
@ -11,24 +11,11 @@ public class PdfImporter : IPdfImporter
|
||||
|
||||
private readonly ScanningContext _scanningContext;
|
||||
private readonly IPdfPasswordProvider? _pdfPasswordProvider;
|
||||
private readonly ImportPostProcessor _importPostProcessor;
|
||||
|
||||
public PdfImporter(ScanningContext scanningContext)
|
||||
: this(scanningContext, null)
|
||||
{
|
||||
}
|
||||
|
||||
public PdfImporter(ScanningContext scanningContext, IPdfPasswordProvider? pdfPasswordProvider)
|
||||
: this(scanningContext, pdfPasswordProvider, new ImportPostProcessor())
|
||||
{
|
||||
}
|
||||
|
||||
internal PdfImporter(ScanningContext scanningContext, IPdfPasswordProvider? pdfPasswordProvider,
|
||||
ImportPostProcessor importPostProcessor)
|
||||
public PdfImporter(ScanningContext scanningContext, IPdfPasswordProvider? pdfPasswordProvider = null)
|
||||
{
|
||||
_scanningContext = scanningContext;
|
||||
_pdfPasswordProvider = pdfPasswordProvider;
|
||||
_importPostProcessor = importPostProcessor;
|
||||
}
|
||||
|
||||
public IAsyncEnumerable<ProcessedImage> Import(string filePath, ImportParams? importParams = null,
|
||||
@ -113,7 +100,7 @@ public class PdfImporter : IPdfImporter
|
||||
{
|
||||
var pageSize = new PageSize((decimal) page.Width * 72, (decimal) page.Height * 72, PageSizeUnit.Inch);
|
||||
var image = _scanningContext.CreateProcessedImage(storage, BitDepth.Color, false, -1, pageSize);
|
||||
return _importPostProcessor.AddPostProcessingData(
|
||||
return ImportPostProcessor.AddPostProcessingData(
|
||||
image,
|
||||
storage,
|
||||
importParams.ThumbnailSize,
|
||||
@ -143,7 +130,7 @@ public class PdfImporter : IPdfImporter
|
||||
}
|
||||
|
||||
var image = _scanningContext.CreateProcessedImage(storage);
|
||||
return _importPostProcessor.AddPostProcessingData(
|
||||
return ImportPostProcessor.AddPostProcessingData(
|
||||
image,
|
||||
null,
|
||||
importParams.ThumbnailSize,
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Threading;
|
||||
using Google.Protobuf;
|
||||
using Grpc.Core;
|
||||
using NAPS2.ImportExport;
|
||||
using NAPS2.ImportExport.Email;
|
||||
using NAPS2.ImportExport.Email.Mapi;
|
||||
using NAPS2.ImportExport.Images;
|
||||
@ -23,7 +24,6 @@ internal class WorkerServiceImpl : WorkerService.WorkerServiceBase
|
||||
private readonly ThumbnailRenderer _thumbnailRenderer;
|
||||
private readonly IMapiWrapper _mapiWrapper;
|
||||
private readonly ITwainSessionController _twainSessionController;
|
||||
private readonly ImportPostProcessor _importPostProcessor;
|
||||
|
||||
private readonly AutoResetEvent _ongoingCallFinished = new(false);
|
||||
private int _ongoingCallCount;
|
||||
@ -31,22 +31,19 @@ internal class WorkerServiceImpl : WorkerService.WorkerServiceBase
|
||||
public WorkerServiceImpl(ScanningContext scanningContext, ThumbnailRenderer thumbnailRenderer,
|
||||
IMapiWrapper mapiWrapper, ITwainSessionController twainSessionController)
|
||||
: this(scanningContext, new RemoteScanController(scanningContext),
|
||||
thumbnailRenderer, mapiWrapper, twainSessionController,
|
||||
new ImportPostProcessor())
|
||||
thumbnailRenderer, mapiWrapper, twainSessionController)
|
||||
{
|
||||
}
|
||||
|
||||
internal WorkerServiceImpl(ScanningContext scanningContext, IRemoteScanController remoteScanController,
|
||||
ThumbnailRenderer thumbnailRenderer,
|
||||
IMapiWrapper mapiWrapper, ITwainSessionController twainSessionController,
|
||||
ImportPostProcessor importPostProcessor)
|
||||
IMapiWrapper mapiWrapper, ITwainSessionController twainSessionController)
|
||||
{
|
||||
_scanningContext = scanningContext;
|
||||
_remoteScanController = remoteScanController;
|
||||
_thumbnailRenderer = thumbnailRenderer;
|
||||
_mapiWrapper = mapiWrapper;
|
||||
_twainSessionController = twainSessionController;
|
||||
_importPostProcessor = importPostProcessor;
|
||||
}
|
||||
|
||||
public override Task<InitResponse> Init(InitRequest request, ServerCallContext context)
|
||||
@ -268,7 +265,7 @@ internal class WorkerServiceImpl : WorkerService.WorkerServiceBase
|
||||
int? thumbnailSize = request.ThumbnailSize == 0 ? null : request.ThumbnailSize;
|
||||
var barcodeOptions = request.BarcodeDetectionOptionsXml.FromXml<BarcodeDetectionOptions>();
|
||||
using var newImage =
|
||||
_importPostProcessor.AddPostProcessingData(image, null, thumbnailSize, barcodeOptions, true);
|
||||
ImportPostProcessor.AddPostProcessingData(image, null, thumbnailSize, barcodeOptions, true);
|
||||
return Task.FromResult(new ImportPostProcessResponse
|
||||
{
|
||||
Image = ImageSerializer.Serialize(newImage,
|
||||
|
Loading…
Reference in New Issue
Block a user