Move Pdf namespace to the top level

This commit is contained in:
Ben Olden-Cooligan 2023-02-18 13:04:18 -08:00
parent 69f75149c5
commit 58a16d773f
63 changed files with 100 additions and 96 deletions

View File

@ -4,7 +4,7 @@ using NAPS2.EtoForms.Mac;
using NAPS2.EtoForms.Ui;
using NAPS2.Images.Mac;
using NAPS2.ImportExport;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Update;
namespace NAPS2.Modules;

View File

@ -1,6 +1,6 @@
using Autofac;
using NAPS2.Automation;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Sdk.Tests;
using NAPS2.Sdk.Tests.Asserts;
using NAPS2.Sdk.Tests.Mocks;

View File

@ -1,7 +1,7 @@
using System.Threading;
using NAPS2.Config.Model;
using NAPS2.ImportExport.Pdf;
using NAPS2.Ocr;
using NAPS2.Pdf;
using NAPS2.Sdk.Tests;
using Xunit;

View File

@ -1,7 +1,7 @@
using Moq;
using NAPS2.EtoForms;
using NAPS2.ImportExport;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Scan;
using NAPS2.Sdk.Tests;
using NAPS2.Sdk.Tests.Asserts;

View File

@ -4,9 +4,9 @@ using NAPS2.EtoForms;
using NAPS2.ImportExport;
using NAPS2.ImportExport.Email;
using NAPS2.ImportExport.Images;
using NAPS2.ImportExport.Pdf;
using NAPS2.Lang.ConsoleResources;
using NAPS2.Ocr;
using NAPS2.Pdf;
using NAPS2.Recovery;
using NAPS2.Scan;
using NAPS2.Serialization;

View File

@ -1,5 +1,5 @@
using NAPS2.ImportExport.Pdf;
using NAPS2.Lang.ConsoleResources;
using NAPS2.Lang.ConsoleResources;
using NAPS2.Pdf;
namespace NAPS2.Automation;

View File

@ -2,7 +2,7 @@
using NAPS2.Config.Model;
using NAPS2.ImportExport.Email;
using NAPS2.ImportExport.Images;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Ocr;
using NAPS2.Scan;
using NAPS2.Scan.Batch;

View File

@ -3,7 +3,7 @@ using System.Text;
using System.Xml;
using NAPS2.Config.Model;
using NAPS2.Config.ObsoleteTypes;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Serialization;
namespace NAPS2.Config;

View File

@ -3,8 +3,8 @@ using NAPS2.ImportExport;
using NAPS2.ImportExport.Email;
using NAPS2.ImportExport.Email.Oauth;
using NAPS2.ImportExport.Images;
using NAPS2.ImportExport.Pdf;
using NAPS2.Ocr;
using NAPS2.Pdf;
using NAPS2.Scan;
using NAPS2.Scan.Batch;

View File

@ -1,6 +1,6 @@
using System.Xml.Serialization;
using NAPS2.ImportExport.Pdf;
using NAPS2.Ocr;
using NAPS2.Pdf;
using NAPS2.Scan;
namespace NAPS2.Config.ObsoleteTypes;

View File

@ -1,7 +1,7 @@
using System.Xml.Serialization;
using NAPS2.ImportExport.Email;
using NAPS2.ImportExport.Images;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Ocr;
using NAPS2.Scan;
using NAPS2.Scan.Batch;

View File

@ -2,7 +2,7 @@ using Eto.Drawing;
using Eto.Forms;
using NAPS2.EtoForms.Layout;
using NAPS2.EtoForms.Widgets;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
namespace NAPS2.EtoForms.Ui;

View File

@ -1,6 +1,6 @@
using NAPS2.EtoForms;
using NAPS2.ImportExport.Images;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Scan;
namespace NAPS2.ImportExport;

View File

@ -2,7 +2,7 @@
using NAPS2.EtoForms.Ui;
using NAPS2.ImportExport.Email;
using NAPS2.ImportExport.Images;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
namespace NAPS2.ImportExport;

View File

@ -4,8 +4,8 @@ using NAPS2.ImportExport;
using NAPS2.ImportExport.Email;
using NAPS2.ImportExport.Email.Mapi;
using NAPS2.ImportExport.Images;
using NAPS2.ImportExport.Pdf;
using NAPS2.Ocr;
using NAPS2.Pdf;
using NAPS2.Platform.Windows;
using NAPS2.Recovery;
using NAPS2.Remoting.Worker;

View File

@ -1,7 +1,7 @@
using Autofac;
using NAPS2.Automation;
using NAPS2.EtoForms;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Scan;
namespace NAPS2.Modules;

View File

@ -2,7 +2,7 @@ using Autofac;
using NAPS2.EtoForms;
using NAPS2.EtoForms.Desktop;
using NAPS2.ImportExport;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Scan;
using NAPS2.Scan.Batch;
using NAPS2.Update;

View File

@ -1,7 +1,7 @@
using NAPS2.EtoForms;
using NAPS2.EtoForms.Ui;
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public class EtoPdfPasswordProvider : IPdfPasswordProvider
{

View File

@ -1,6 +1,6 @@
using NAPS2.Config.Model;
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public class PdfSettings
{

View File

@ -1,7 +1,8 @@
using NAPS2.ImportExport.Email;
using NAPS2.ImportExport;
using NAPS2.ImportExport.Email;
using NAPS2.Ocr;
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public class SavePdfOperation : OperationBase
{

View File

@ -4,8 +4,8 @@ using NAPS2.EtoForms;
using NAPS2.EtoForms.Ui;
using NAPS2.ImportExport;
using NAPS2.ImportExport.Images;
using NAPS2.ImportExport.Pdf;
using NAPS2.Ocr;
using NAPS2.Pdf;
namespace NAPS2.Scan.Batch;

View File

@ -1,6 +1,6 @@
using Codeuctivity;
using NAPS2.ImportExport.Pdf;
using NAPS2.ImportExport.Pdf.Pdfium;
using NAPS2.Pdf;
using NAPS2.Pdf.Pdfium;
using PdfSharpCore.Pdf.IO;
using PdfSharpCore.Pdf.Security;
using Xunit;

View File

@ -1,6 +1,6 @@
using System.Threading;
using NAPS2.ImportExport.Pdf;
using NAPS2.Ocr;
using NAPS2.Pdf;
using NAPS2.Scan;
using NAPS2.Unmanaged;
using Xunit.Abstractions;

View File

@ -1,4 +1,4 @@
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Scan;
using NAPS2.Sdk.Tests.Asserts;
using NAPS2.Serialization;

View File

@ -1,4 +1,4 @@
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Sdk.Tests.Asserts;
namespace NAPS2.Sdk.Tests.ImportExport.Pdf;

View File

@ -1,4 +1,4 @@
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using Xunit;
namespace NAPS2.Sdk.Tests.ImportExport.Pdf;

View File

@ -1,6 +1,6 @@
using System.Threading;
using Moq;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Sdk.Tests.Asserts;
using Xunit;

View File

@ -1,4 +1,4 @@
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Sdk.Tests.Asserts;
using Xunit;
using Xunit.Abstractions;

View File

@ -1,7 +1,7 @@
using Moq;
using NAPS2.ImportExport;
using NAPS2.ImportExport.Pdf;
using NAPS2.ImportExport.Pdf.Pdfium;
using NAPS2.Pdf;
using NAPS2.Pdf.Pdfium;
using NAPS2.Sdk.Tests.Asserts;
using Xunit;

View File

@ -1,4 +1,4 @@
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Sdk.Tests.Asserts;
using Xunit;

View File

@ -1,4 +1,4 @@
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Sdk.Tests.Asserts;
using Xunit;

View File

@ -1,5 +1,5 @@
using NAPS2.ImportExport.Images;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
namespace NAPS2.ImportExport;

View File

@ -1,8 +1,8 @@
using NAPS2.ImportExport.Pdf.Pdfium;
using NAPS2.Pdf.Pdfium;
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public static class CcittReader
internal static class CcittReader
{
private static readonly byte[] TiffBeforeDataLen = { 0x49, 0x49, 0x2A, 0x00 };
private static readonly byte[] TiffBeforeData = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

View File

@ -1,6 +1,6 @@
using NAPS2.Ocr;
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public interface IPdfExporter
{

View File

@ -1,4 +1,6 @@
namespace NAPS2.ImportExport.Pdf;
using NAPS2.ImportExport;
namespace NAPS2.Pdf;
public interface IPdfImporter : IScannedImageImporter
{

View File

@ -1,4 +1,4 @@
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public interface IPdfPasswordProvider
{

View File

@ -2,9 +2,9 @@
using PdfSharpCore.Pdf;
using PdfSharpCore.Pdf.Advanced;
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public static class PdfAHelper
internal static class PdfAHelper
{
public static void CreateXmpMetadata(PdfDocument document, PdfCompat compat)
{

View File

@ -1,4 +1,4 @@
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public enum PdfCompat
{

View File

@ -1,4 +1,4 @@
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public record PdfEncryption
{

View File

@ -1,4 +1,4 @@
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public record PdfExportParams
{

View File

@ -2,8 +2,8 @@
using System.Runtime.InteropServices;
using System.Threading;
using NAPS2.Images.Bitwise;
using NAPS2.ImportExport.Pdf.Pdfium;
using NAPS2.Ocr;
using NAPS2.Pdf.Pdfium;
using NAPS2.Scan;
using PdfSharpCore.Drawing;
using PdfSharpCore.Drawing.Layout;
@ -13,7 +13,7 @@ using PdfSharpCore.Pdf.Security;
using PdfDocument = PdfSharpCore.Pdf.PdfDocument;
using PdfPage = PdfSharpCore.Pdf.PdfPage;
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public class PdfExporter : IPdfExporter
{

View File

@ -1,4 +1,4 @@
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public class PdfImportException : Exception
{

View File

@ -1,8 +1,9 @@
using NAPS2.ImportExport.Images;
using NAPS2.ImportExport.Pdf.Pdfium;
using NAPS2.ImportExport;
using NAPS2.ImportExport.Images;
using NAPS2.Pdf.Pdfium;
using NAPS2.Scan;
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public class PdfImporter : IPdfImporter
{

View File

@ -1,4 +1,4 @@
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public record PdfMetadata
{

View File

@ -1,6 +1,6 @@
namespace NAPS2.ImportExport.Pdf.Pdfium;
namespace NAPS2.Pdf.Pdfium;
public enum Colorspace
internal enum Colorspace
{
Unknown = 0,
DeviceGray = 1,

View File

@ -1,9 +1,9 @@
using System.Runtime.InteropServices;
using System.Threading;
namespace NAPS2.ImportExport.Pdf.Pdfium;
namespace NAPS2.Pdf.Pdfium;
public abstract class NativePdfiumObject : IDisposable
internal abstract class NativePdfiumObject : IDisposable
{
private bool _disposed;
private IntPtr _handle;

View File

@ -1,6 +1,6 @@
namespace NAPS2.ImportExport.Pdf.Pdfium;
namespace NAPS2.Pdf.Pdfium;
public class PdfBitmap : NativePdfiumObject
internal class PdfBitmap : NativePdfiumObject
{
public const uint BLACK = 0;
public const uint WHITE = uint.MaxValue;

View File

@ -1,10 +1,10 @@
using System.Runtime.InteropServices;
using System.Text;
namespace NAPS2.ImportExport.Pdf.Pdfium;
namespace NAPS2.Pdf.Pdfium;
// TODO: Use PdfiumException (with a message, defaulting to unknown error code for the property) instead of other exception types
public class PdfDocument : NativePdfiumObject
internal class PdfDocument : NativePdfiumObject
{
public static PdfDocument Load(string path, string? password = null)
{

View File

@ -1,8 +1,8 @@
using System.Runtime.InteropServices;
namespace NAPS2.ImportExport.Pdf.Pdfium;
namespace NAPS2.Pdf.Pdfium;
public struct PdfImageMetadata
internal struct PdfImageMetadata
{
public int Width;
public int Height;

View File

@ -1,6 +1,6 @@
namespace NAPS2.ImportExport.Pdf.Pdfium;
namespace NAPS2.Pdf.Pdfium;
public record struct PdfMatrix(float a, float b, float c, float d, float e, float f)
internal record struct PdfMatrix(float a, float b, float c, float d, float e, float f)
{
public static PdfMatrix FillPage(float width, float height)
{

View File

@ -1,6 +1,6 @@
namespace NAPS2.ImportExport.Pdf.Pdfium;
namespace NAPS2.Pdf.Pdfium;
public class PdfPage : NativePdfiumObject
internal class PdfPage : NativePdfiumObject
{
internal PdfPage(IntPtr handle, PdfDocument document, int pageIndex) : base(handle)

View File

@ -1,9 +1,9 @@
using System.Runtime.InteropServices;
using System.Text;
namespace NAPS2.ImportExport.Pdf.Pdfium;
namespace NAPS2.Pdf.Pdfium;
public class PdfPageObject : NativePdfiumObject
internal class PdfPageObject : NativePdfiumObject
{
private readonly bool _owned;

View File

@ -1,8 +1,8 @@
using System.Text;
namespace NAPS2.ImportExport.Pdf.Pdfium;
namespace NAPS2.Pdf.Pdfium;
public class PdfText : NativePdfiumObject
internal class PdfText : NativePdfiumObject
{
internal PdfText(IntPtr handle) : base(handle)
{

View File

@ -1,6 +1,6 @@
namespace NAPS2.ImportExport.Pdf.Pdfium;
namespace NAPS2.Pdf.Pdfium;
public enum PdfiumErrorCode
internal enum PdfiumErrorCode
{
Success = 0,
Unknown = 1,

View File

@ -1,6 +1,6 @@
namespace NAPS2.ImportExport.Pdf.Pdfium;
namespace NAPS2.Pdf.Pdfium;
public class PdfiumException : Exception
internal class PdfiumException : Exception
{
public PdfiumException(PdfiumErrorCode errorCode)
: base($"Pdf error: {errorCode}")

View File

@ -2,9 +2,9 @@
// ReSharper disable InconsistentNaming
namespace NAPS2.ImportExport.Pdf.Pdfium;
namespace NAPS2.Pdf.Pdfium;
public class PdfiumNativeLibrary : Unmanaged.NativeLibrary
internal class PdfiumNativeLibrary : Unmanaged.NativeLibrary
{
private static readonly Lazy<PdfiumNativeLibrary> LazyInstance = new(() =>
{

View File

@ -1,6 +1,6 @@
namespace NAPS2.ImportExport.Pdf.Pdfium;
namespace NAPS2.Pdf.Pdfium;
public enum TextRenderMode
internal enum TextRenderMode
{
Unknown = -1,
Fill = 0,

View File

@ -1,9 +1,9 @@
using NAPS2.Images.Bitwise;
using NAPS2.ImportExport.Pdf.Pdfium;
using NAPS2.Pdf.Pdfium;
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public static class PdfiumImageExtractor
internal static class PdfiumImageExtractor
{
public static IMemoryImage? GetSingleImage(ImageContext imageContext, PdfPage page)
{

View File

@ -1,11 +1,11 @@
using NAPS2.ImportExport.Pdf.Pdfium;
using NAPS2.Ocr;
using NAPS2.Ocr;
using NAPS2.Pdf.Pdfium;
using NAPS2.Scan;
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
// TODO: Experimental. Also remember that this is failing with access violations on 32-bit (see tests).
public class PdfiumPdfExporter : IPdfExporter
internal class PdfiumPdfExporter : IPdfExporter
{
private readonly ScanningContext _scanningContext;

View File

@ -1,9 +1,9 @@
using System.Runtime.InteropServices;
using NAPS2.ImportExport.Pdf.Pdfium;
using NAPS2.Pdf.Pdfium;
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public class PdfiumPdfReader
internal class PdfiumPdfReader
{
public PdfMetadata ReadMetadata(string path, string? password = null)
{

View File

@ -1,10 +1,10 @@
using System.Runtime.InteropServices;
using NAPS2.Images.Bitwise;
using NAPS2.ImportExport.Pdf.Pdfium;
using NAPS2.Pdf.Pdfium;
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public class PdfiumPdfRenderer : IPdfRenderer
internal class PdfiumPdfRenderer : IPdfRenderer
{
public IEnumerable<IMemoryImage> Render(ImageContext imageContext, string path, PdfRenderSize renderSize,
string? password = null)

View File

@ -1,8 +1,8 @@
using NAPS2.Remoting.Worker;
namespace NAPS2.ImportExport.Pdf;
namespace NAPS2.Pdf;
public class PdfiumWorkerCoordinator : IPdfRenderer
internal class PdfiumWorkerCoordinator : IPdfRenderer
{
private readonly WorkerPool _workerPool;

View File

@ -4,7 +4,7 @@ using Grpc.Core;
using NAPS2.ImportExport.Email;
using NAPS2.ImportExport.Email.Mapi;
using NAPS2.ImportExport.Images;
using NAPS2.ImportExport.Pdf;
using NAPS2.Pdf;
using NAPS2.Scan;
using NAPS2.Scan.Internal;
using NAPS2.Scan.Internal.Twain;