More API cleanup

This commit is contained in:
Ben Olden-Cooligan 2023-08-05 09:05:23 -07:00
parent 311e59aa64
commit ddb093394d
16 changed files with 17 additions and 35 deletions

View File

@ -194,12 +194,9 @@ internal class ScanPerformer : IScanPerformer
IncludeWiaDevices = false
// TODO: Consider adding a user option for TwainOptions.ShowProgress instead of our progress window
},
SaneOptions =
{
KeyValueOptions = scanProfile.KeyValueOptions != null
? new KeyValueScanOptions(scanProfile.KeyValueOptions)
: new KeyValueScanOptions()
},
KeyValueOptions = scanProfile.KeyValueOptions != null
? new KeyValueScanOptions(scanProfile.KeyValueOptions)
: new KeyValueScanOptions(),
BarcodeDetectionOptions =
{
DetectBarcodes = scanParams.DetectPatchT ||

View File

@ -1,6 +1,7 @@
using Xunit;
using NAPS2.ImportExport;
using Xunit;
namespace NAPS2.Sdk.Tests.Util;
namespace NAPS2.Sdk.Tests.ImportExport;
public class SliceTests
{

View File

@ -1,6 +1,6 @@
using System.Text.RegularExpressions;
namespace NAPS2.Util;
namespace NAPS2.ImportExport;
/// <summary>
/// A class that represents a Python-style slice of a collection.

View File

@ -9,7 +9,7 @@ namespace NAPS2.Ocr;
/// Allows OCR requests to be queued and prioritized. Results are cached so that requests with the same set of
/// parameters (image, engine, language code, etc.) don't do duplicate work.
/// </summary>
public class OcrRequestQueue
internal class OcrRequestQueue
{
private readonly Dictionary<OcrRequestParams, OcrRequest> _requestCache = new();
private Semaphore _queueWaitHandle = new(0, int.MaxValue);

View File

@ -3,7 +3,7 @@ using NAPS2.Scan;
namespace NAPS2.Ocr;
public class StubOcrEngine : IOcrEngine
internal class StubOcrEngine : IOcrEngine
{
public Task<OcrResult?> ProcessImage(ScanningContext scanningContext, string imagePath, OcrParams ocrParams,
CancellationToken cancelToken)

View File

@ -1,6 +1,6 @@
namespace NAPS2.Scan;
public static class DriverNames
internal static class DriverNames
{
// TODO: Ideally we just change everything to use the Driver enum
public const string WIA = "wia";

View File

@ -2,6 +2,4 @@
public class SaneOptions
{
// TODO: Probably move this to top-level ScanOptions (as e.g. twain might have extra options too)
public KeyValueScanOptions? KeyValueOptions { get; set; }
}

View File

@ -1,27 +1,11 @@
using System.Diagnostics.CodeAnalysis;
namespace NAPS2.Scan;
/// <summary>
/// The representation of a scanning device identified by a driver.
/// </summary>
public class ScanDevice
public record ScanDevice(string ID, string Name)
{
// Need an empty constructor for XML compatibility
public ScanDevice()
private ScanDevice() : this("", "")
{
}
[SetsRequiredMembers]
public ScanDevice(string id, string name)
{
ID = id;
Name = name;
}
// Keeping old naming scheme for XML compatibility
// ReSharper disable once InconsistentNaming
public required string ID { get; init; }
public required string Name { get; init; }
}

View File

@ -65,6 +65,8 @@ public class ScanOptions
public bool AutoDeskew { get; set; }
public bool FlipDuplexedPages { get; set; }
public KeyValueScanOptions? KeyValueOptions { get; set; }
}
public enum HorizontalAlign

View File

@ -1,6 +1,6 @@
namespace NAPS2.Serialization;
public class DeserializeImageOptions
internal class DeserializeImageOptions
{
/// <summary>
/// If true, the Deserialize caller guarantees that the file storage will not be used for longer than the duration of the RPC call.

View File

@ -3,7 +3,7 @@ using NAPS2.Scan;
namespace NAPS2.Serialization;
public static class ImageSerializer
internal static class ImageSerializer
{
public static SerializedImage Serialize(ProcessedImage image, SerializeImageOptions options)
{

View File

@ -1,6 +1,6 @@
namespace NAPS2.Serialization;
public class SerializeImageOptions
internal class SerializeImageOptions
{
/// <summary>
/// Indicates that, when the serialized image is transferred with file-based storage, the file should be considered