diff --git a/NAPS2.App.Tests/IsExternalInit.cs b/NAPS2.App.Tests/IsExternalInit.cs
deleted file mode 100644
index 0993ddec1..000000000
--- a/NAPS2.App.Tests/IsExternalInit.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
-// ReSharper disable once CheckNamespace
-namespace System.Runtime.CompilerServices;
-
-internal static class IsExternalInit {}
\ No newline at end of file
diff --git a/NAPS2.Escl.Server/CompilerAttributes.cs b/NAPS2.Escl.Server/CompilerAttributes.cs
deleted file mode 100644
index 8230a289b..000000000
--- a/NAPS2.Escl.Server/CompilerAttributes.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
-// ReSharper disable once CheckNamespace
-
-namespace System.Runtime.CompilerServices
-{
- internal static class IsExternalInit
- {
- }
-
- /// Specifies that a type has required members or that a member is required.
- [AttributeUsage(
- AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property,
- AllowMultiple = false, Inherited = false)]
- internal sealed class RequiredMemberAttribute : Attribute
- {
- }
-
- ///
- /// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
- ///
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- internal sealed class CompilerFeatureRequiredAttribute : Attribute
- {
- public CompilerFeatureRequiredAttribute(string featureName)
- {
- FeatureName = featureName;
- }
-
- ///
- /// The name of the compiler feature.
- ///
- public string FeatureName { get; }
-
- ///
- /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand .
- ///
- public bool IsOptional { get; init; }
-
- ///
- /// The used for the ref structs C# feature.
- ///
- public const string RefStructs = nameof(RefStructs);
-
- ///
- /// The used for the required members C# feature.
- ///
- public const string RequiredMembers = nameof(RequiredMembers);
- }
-}
-
-namespace System.Diagnostics.CodeAnalysis
-{
- ///
- /// Specifies that this constructor sets all required members for the current type, and callers
- /// do not need to set any required members themselves.
- ///
- [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
- internal sealed class SetsRequiredMembersAttribute : Attribute
- {
- }
-}
\ No newline at end of file
diff --git a/NAPS2.Escl.Server/NAPS2.Escl.Server.csproj b/NAPS2.Escl.Server/NAPS2.Escl.Server.csproj
index 422fedd73..b6a6b4354 100644
--- a/NAPS2.Escl.Server/NAPS2.Escl.Server.csproj
+++ b/NAPS2.Escl.Server/NAPS2.Escl.Server.csproj
@@ -16,7 +16,6 @@
-
diff --git a/NAPS2.Escl.Usb/CompilerAttributes.cs b/NAPS2.Escl.Usb/CompilerAttributes.cs
deleted file mode 100644
index 8230a289b..000000000
--- a/NAPS2.Escl.Usb/CompilerAttributes.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
-// ReSharper disable once CheckNamespace
-
-namespace System.Runtime.CompilerServices
-{
- internal static class IsExternalInit
- {
- }
-
- /// Specifies that a type has required members or that a member is required.
- [AttributeUsage(
- AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property,
- AllowMultiple = false, Inherited = false)]
- internal sealed class RequiredMemberAttribute : Attribute
- {
- }
-
- ///
- /// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
- ///
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- internal sealed class CompilerFeatureRequiredAttribute : Attribute
- {
- public CompilerFeatureRequiredAttribute(string featureName)
- {
- FeatureName = featureName;
- }
-
- ///
- /// The name of the compiler feature.
- ///
- public string FeatureName { get; }
-
- ///
- /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand .
- ///
- public bool IsOptional { get; init; }
-
- ///
- /// The used for the ref structs C# feature.
- ///
- public const string RefStructs = nameof(RefStructs);
-
- ///
- /// The used for the required members C# feature.
- ///
- public const string RequiredMembers = nameof(RequiredMembers);
- }
-}
-
-namespace System.Diagnostics.CodeAnalysis
-{
- ///
- /// Specifies that this constructor sets all required members for the current type, and callers
- /// do not need to set any required members themselves.
- ///
- [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
- internal sealed class SetsRequiredMembersAttribute : Attribute
- {
- }
-}
\ No newline at end of file
diff --git a/NAPS2.Escl.Usb/NAPS2.Escl.Usb.csproj b/NAPS2.Escl.Usb/NAPS2.Escl.Usb.csproj
index 7d05cc63f..f0e07d4fa 100644
--- a/NAPS2.Escl.Usb/NAPS2.Escl.Usb.csproj
+++ b/NAPS2.Escl.Usb/NAPS2.Escl.Usb.csproj
@@ -11,6 +11,7 @@
+
\ No newline at end of file
diff --git a/NAPS2.Escl/CompilerAttributes.cs b/NAPS2.Escl/CompilerAttributes.cs
deleted file mode 100644
index 8230a289b..000000000
--- a/NAPS2.Escl/CompilerAttributes.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
-// ReSharper disable once CheckNamespace
-
-namespace System.Runtime.CompilerServices
-{
- internal static class IsExternalInit
- {
- }
-
- /// Specifies that a type has required members or that a member is required.
- [AttributeUsage(
- AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property,
- AllowMultiple = false, Inherited = false)]
- internal sealed class RequiredMemberAttribute : Attribute
- {
- }
-
- ///
- /// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
- ///
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- internal sealed class CompilerFeatureRequiredAttribute : Attribute
- {
- public CompilerFeatureRequiredAttribute(string featureName)
- {
- FeatureName = featureName;
- }
-
- ///
- /// The name of the compiler feature.
- ///
- public string FeatureName { get; }
-
- ///
- /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand .
- ///
- public bool IsOptional { get; init; }
-
- ///
- /// The used for the ref structs C# feature.
- ///
- public const string RefStructs = nameof(RefStructs);
-
- ///
- /// The used for the required members C# feature.
- ///
- public const string RequiredMembers = nameof(RequiredMembers);
- }
-}
-
-namespace System.Diagnostics.CodeAnalysis
-{
- ///
- /// Specifies that this constructor sets all required members for the current type, and callers
- /// do not need to set any required members themselves.
- ///
- [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
- internal sealed class SetsRequiredMembersAttribute : Attribute
- {
- }
-}
\ No newline at end of file
diff --git a/NAPS2.Escl/NAPS2.Escl.csproj b/NAPS2.Escl/NAPS2.Escl.csproj
index acf44886a..9899c4934 100644
--- a/NAPS2.Escl/NAPS2.Escl.csproj
+++ b/NAPS2.Escl/NAPS2.Escl.csproj
@@ -18,8 +18,10 @@
+
+
diff --git a/NAPS2.Images.Gdi/GdiExtensions.cs b/NAPS2.Images.Gdi/GdiExtensions.cs
index 4c9742b8b..7049817c5 100644
--- a/NAPS2.Images.Gdi/GdiExtensions.cs
+++ b/NAPS2.Images.Gdi/GdiExtensions.cs
@@ -3,9 +3,7 @@ using System.Drawing.Imaging;
namespace NAPS2.Images.Gdi;
-#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
-#endif
public static class GdiExtensions
{
public static Bitmap RenderToBitmap(this IRenderableImage image)
diff --git a/NAPS2.Images.Gdi/GdiImage.cs b/NAPS2.Images.Gdi/GdiImage.cs
index 114bd2155..b0d500c1d 100644
--- a/NAPS2.Images.Gdi/GdiImage.cs
+++ b/NAPS2.Images.Gdi/GdiImage.cs
@@ -7,9 +7,7 @@ namespace NAPS2.Images.Gdi;
///
/// An implementation of IMemoryImage that wraps a GDI+ image (System.Drawing.Bitmap).
///
-#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
-#endif
public class GdiImage : IMemoryImage
{
public GdiImage(Bitmap bitmap)
diff --git a/NAPS2.Images.Gdi/GdiImageContext.cs b/NAPS2.Images.Gdi/GdiImageContext.cs
index 4c7b14c50..d2d25ce92 100644
--- a/NAPS2.Images.Gdi/GdiImageContext.cs
+++ b/NAPS2.Images.Gdi/GdiImageContext.cs
@@ -4,9 +4,7 @@ using NAPS2.Util;
namespace NAPS2.Images.Gdi;
-#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
-#endif
public class GdiImageContext : ImageContext
{
private readonly GdiImageTransformer _imageTransformer;
diff --git a/NAPS2.Images.Gdi/GdiImageLockState.cs b/NAPS2.Images.Gdi/GdiImageLockState.cs
index 3ee9f78b0..4ad27435d 100644
--- a/NAPS2.Images.Gdi/GdiImageLockState.cs
+++ b/NAPS2.Images.Gdi/GdiImageLockState.cs
@@ -4,9 +4,7 @@ using NAPS2.Images.Bitwise;
namespace NAPS2.Images.Gdi;
-#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
-#endif
public class GdiImageLockState : ImageLockState
{
public static GdiImageLockState Create(Bitmap bitmap, LockMode lockMode, out BitwiseImageData imageData)
diff --git a/NAPS2.Images.Gdi/GdiImageTransformer.cs b/NAPS2.Images.Gdi/GdiImageTransformer.cs
index e678398d6..de9c9a2fa 100644
--- a/NAPS2.Images.Gdi/GdiImageTransformer.cs
+++ b/NAPS2.Images.Gdi/GdiImageTransformer.cs
@@ -4,9 +4,7 @@ using System.Drawing.Imaging;
namespace NAPS2.Images.Gdi;
-#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
-#endif
public class GdiImageTransformer : AbstractImageTransformer
{
public GdiImageTransformer(ImageContext imageContext) : base(imageContext)
diff --git a/NAPS2.Images.Gdi/GdiPixelFormatFixer.cs b/NAPS2.Images.Gdi/GdiPixelFormatFixer.cs
index 75bbd84a4..190f9e3e9 100644
--- a/NAPS2.Images.Gdi/GdiPixelFormatFixer.cs
+++ b/NAPS2.Images.Gdi/GdiPixelFormatFixer.cs
@@ -7,9 +7,7 @@ namespace NAPS2.Images.Gdi;
///
/// Ensures that bitmaps use a standard pixel format/palette.
///
-#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
-#endif
internal static class GdiPixelFormatFixer
{
public static bool MaybeFixPixelFormat(ref Bitmap bitmap)
diff --git a/NAPS2.Images.Gdi/GdiTiffWriter.cs b/NAPS2.Images.Gdi/GdiTiffWriter.cs
index 96bc1be0d..34846a5c6 100644
--- a/NAPS2.Images.Gdi/GdiTiffWriter.cs
+++ b/NAPS2.Images.Gdi/GdiTiffWriter.cs
@@ -4,9 +4,7 @@ using NAPS2.Util;
namespace NAPS2.Images.Gdi;
-#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
-#endif
internal class GdiTiffWriter : ITiffWriter
{
public bool SaveTiff(IList images, string path,
diff --git a/NAPS2.Images.Gdi/IsExternalInit.cs b/NAPS2.Images.Gdi/IsExternalInit.cs
deleted file mode 100644
index ba0435b8b..000000000
--- a/NAPS2.Images.Gdi/IsExternalInit.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
-// ReSharper disable once CheckNamespace
-namespace System.Runtime.CompilerServices;
-
-public static class IsExternalInit {}
\ No newline at end of file
diff --git a/NAPS2.Images/ImageContext.cs b/NAPS2.Images/ImageContext.cs
index 5b4be277a..5ff2bc054 100644
--- a/NAPS2.Images/ImageContext.cs
+++ b/NAPS2.Images/ImageContext.cs
@@ -1,4 +1,5 @@
using System.Collections.Immutable;
+using System.Diagnostics.CodeAnalysis;
using NAPS2.Util;
namespace NAPS2.Images;
@@ -46,8 +47,8 @@ public abstract class ImageContext
ImageType = imageType;
}
- // TODO: Add NotNullWhen attribute?
- private bool MaybeRenderPdf(ImageFileStorage fileStorage, IPdfRenderer? pdfRenderer, out IMemoryImage? renderedPdf)
+ private bool MaybeRenderPdf(ImageFileStorage fileStorage, IPdfRenderer? pdfRenderer,
+ [NotNullWhen(true)] out IMemoryImage? renderedPdf)
{
if (Path.GetExtension(fileStorage.FullPath).ToLowerInvariant() == ".pdf")
{
@@ -63,7 +64,8 @@ public abstract class ImageContext
return false;
}
- private bool MaybeRenderPdf(ImageMemoryStorage memoryStorage, IPdfRenderer? pdfRenderer, out IMemoryImage? renderedPdf)
+ private bool MaybeRenderPdf(ImageMemoryStorage memoryStorage, IPdfRenderer? pdfRenderer,
+ [NotNullWhen(true)] out IMemoryImage? renderedPdf)
{
if (memoryStorage.TypeHint == ".pdf")
{
@@ -250,13 +252,13 @@ public abstract class ImageContext
case ImageFileStorage fileStorage:
if (MaybeRenderPdf(fileStorage, pdfRenderer, out var renderedPdf))
{
- return renderedPdf!;
+ return renderedPdf;
}
return Load(fileStorage.FullPath);
case ImageMemoryStorage memoryStorage:
if (MaybeRenderPdf(memoryStorage, pdfRenderer, out var renderedMemoryPdf))
{
- return renderedMemoryPdf!;
+ return renderedMemoryPdf;
}
return Load(memoryStorage.Stream);
case IMemoryImage image:
diff --git a/NAPS2.Images/IsExternalInit.cs b/NAPS2.Images/IsExternalInit.cs
deleted file mode 100644
index ba0435b8b..000000000
--- a/NAPS2.Images/IsExternalInit.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
-// ReSharper disable once CheckNamespace
-namespace System.Runtime.CompilerServices;
-
-public static class IsExternalInit {}
\ No newline at end of file
diff --git a/NAPS2.Images/NAPS2.Images.csproj b/NAPS2.Images/NAPS2.Images.csproj
index 9cc3f1d34..a5cc0910b 100644
--- a/NAPS2.Images/NAPS2.Images.csproj
+++ b/NAPS2.Images/NAPS2.Images.csproj
@@ -18,8 +18,8 @@
+
-
diff --git a/NAPS2.Internals/NAPS2.Internals.csproj b/NAPS2.Internals/NAPS2.Internals.csproj
index a220783fc..8581c2ad6 100644
--- a/NAPS2.Internals/NAPS2.Internals.csproj
+++ b/NAPS2.Internals/NAPS2.Internals.csproj
@@ -15,7 +15,9 @@
+
+
diff --git a/NAPS2.Internals/Util/CompilerAttributes.cs b/NAPS2.Internals/Util/CompilerAttributes.cs
deleted file mode 100644
index 8230a289b..000000000
--- a/NAPS2.Internals/Util/CompilerAttributes.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
-// ReSharper disable once CheckNamespace
-
-namespace System.Runtime.CompilerServices
-{
- internal static class IsExternalInit
- {
- }
-
- /// Specifies that a type has required members or that a member is required.
- [AttributeUsage(
- AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property,
- AllowMultiple = false, Inherited = false)]
- internal sealed class RequiredMemberAttribute : Attribute
- {
- }
-
- ///
- /// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
- ///
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- internal sealed class CompilerFeatureRequiredAttribute : Attribute
- {
- public CompilerFeatureRequiredAttribute(string featureName)
- {
- FeatureName = featureName;
- }
-
- ///
- /// The name of the compiler feature.
- ///
- public string FeatureName { get; }
-
- ///
- /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand .
- ///
- public bool IsOptional { get; init; }
-
- ///
- /// The used for the ref structs C# feature.
- ///
- public const string RefStructs = nameof(RefStructs);
-
- ///
- /// The used for the required members C# feature.
- ///
- public const string RequiredMembers = nameof(RequiredMembers);
- }
-}
-
-namespace System.Diagnostics.CodeAnalysis
-{
- ///
- /// Specifies that this constructor sets all required members for the current type, and callers
- /// do not need to set any required members themselves.
- ///
- [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
- internal sealed class SetsRequiredMembersAttribute : Attribute
- {
- }
-}
\ No newline at end of file
diff --git a/NAPS2.Internals/Util/CompilerTypes.cs b/NAPS2.Internals/Util/CompilerTypes.cs
deleted file mode 100644
index e1e2e66ea..000000000
--- a/NAPS2.Internals/Util/CompilerTypes.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-// ReSharper disable once CheckNamespace
-
-#if !NET6_0_OR_GREATER
-namespace System
-{
- using System.Runtime.CompilerServices;
-
- public readonly struct Index : IEquatable
- {
- private readonly int _value;
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public Index(int value, bool fromEnd = false)
- {
- if (value < 0)
- {
- throw new ArgumentOutOfRangeException();
- }
-
- if (fromEnd)
- _value = ~value;
- else
- _value = value;
- }
-
- private Index(int value)
- {
- _value = value;
- }
-
- public static Index Start => new Index(0);
-
- public static Index End => new Index(~0);
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Index FromStart(int value)
- {
- if (value < 0)
- {
- throw new ArgumentOutOfRangeException();
- }
-
- return new Index(value);
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Index FromEnd(int value)
- {
- if (value < 0)
- {
- throw new ArgumentOutOfRangeException();
- }
-
- return new Index(~value);
- }
-
- public int Value
- {
- get
- {
- if (_value < 0)
- return ~_value;
- else
- return _value;
- }
- }
-
- public bool IsFromEnd => _value < 0;
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public int GetOffset(int length)
- {
- int offset = _value;
- if (IsFromEnd)
- {
- offset += length + 1;
- }
- return offset;
- }
-
- public override bool Equals(object? value) => value is Index && _value == ((Index)value)._value;
- public bool Equals(Index other) => _value == other._value;
- public override int GetHashCode() => _value;
- public static implicit operator Index(int value) => FromStart(value);
- }
-}
-#endif
\ No newline at end of file
diff --git a/NAPS2.Lib.Gtk/Util/CompilerAttributes.cs b/NAPS2.Lib.Gtk/Util/CompilerAttributes.cs
deleted file mode 100644
index 8230a289b..000000000
--- a/NAPS2.Lib.Gtk/Util/CompilerAttributes.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
-// ReSharper disable once CheckNamespace
-
-namespace System.Runtime.CompilerServices
-{
- internal static class IsExternalInit
- {
- }
-
- /// Specifies that a type has required members or that a member is required.
- [AttributeUsage(
- AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property,
- AllowMultiple = false, Inherited = false)]
- internal sealed class RequiredMemberAttribute : Attribute
- {
- }
-
- ///
- /// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
- ///
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- internal sealed class CompilerFeatureRequiredAttribute : Attribute
- {
- public CompilerFeatureRequiredAttribute(string featureName)
- {
- FeatureName = featureName;
- }
-
- ///
- /// The name of the compiler feature.
- ///
- public string FeatureName { get; }
-
- ///
- /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand .
- ///
- public bool IsOptional { get; init; }
-
- ///
- /// The used for the ref structs C# feature.
- ///
- public const string RefStructs = nameof(RefStructs);
-
- ///
- /// The used for the required members C# feature.
- ///
- public const string RequiredMembers = nameof(RequiredMembers);
- }
-}
-
-namespace System.Diagnostics.CodeAnalysis
-{
- ///
- /// Specifies that this constructor sets all required members for the current type, and callers
- /// do not need to set any required members themselves.
- ///
- [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
- internal sealed class SetsRequiredMembersAttribute : Attribute
- {
- }
-}
\ No newline at end of file
diff --git a/NAPS2.Lib.Tests/IsExternalInit.cs b/NAPS2.Lib.Tests/IsExternalInit.cs
deleted file mode 100644
index 0993ddec1..000000000
--- a/NAPS2.Lib.Tests/IsExternalInit.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
-// ReSharper disable once CheckNamespace
-namespace System.Runtime.CompilerServices;
-
-internal static class IsExternalInit {}
\ No newline at end of file
diff --git a/NAPS2.Lib.Tests/NAPS2.Lib.Tests.csproj b/NAPS2.Lib.Tests/NAPS2.Lib.Tests.csproj
index 6c30bde25..b5f04fda5 100644
--- a/NAPS2.Lib.Tests/NAPS2.Lib.Tests.csproj
+++ b/NAPS2.Lib.Tests/NAPS2.Lib.Tests.csproj
@@ -16,6 +16,7 @@
+
diff --git a/NAPS2.Lib.WinForms/Util/CompilerAttributes.cs b/NAPS2.Lib.WinForms/Util/CompilerAttributes.cs
deleted file mode 100644
index 8230a289b..000000000
--- a/NAPS2.Lib.WinForms/Util/CompilerAttributes.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
-// ReSharper disable once CheckNamespace
-
-namespace System.Runtime.CompilerServices
-{
- internal static class IsExternalInit
- {
- }
-
- /// Specifies that a type has required members or that a member is required.
- [AttributeUsage(
- AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property,
- AllowMultiple = false, Inherited = false)]
- internal sealed class RequiredMemberAttribute : Attribute
- {
- }
-
- ///
- /// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
- ///
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- internal sealed class CompilerFeatureRequiredAttribute : Attribute
- {
- public CompilerFeatureRequiredAttribute(string featureName)
- {
- FeatureName = featureName;
- }
-
- ///
- /// The name of the compiler feature.
- ///
- public string FeatureName { get; }
-
- ///
- /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand .
- ///
- public bool IsOptional { get; init; }
-
- ///
- /// The used for the ref structs C# feature.
- ///
- public const string RefStructs = nameof(RefStructs);
-
- ///
- /// The used for the required members C# feature.
- ///
- public const string RequiredMembers = nameof(RequiredMembers);
- }
-}
-
-namespace System.Diagnostics.CodeAnalysis
-{
- ///
- /// Specifies that this constructor sets all required members for the current type, and callers
- /// do not need to set any required members themselves.
- ///
- [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
- internal sealed class SetsRequiredMembersAttribute : Attribute
- {
- }
-}
\ No newline at end of file
diff --git a/NAPS2.Lib/NAPS2.Lib.csproj b/NAPS2.Lib/NAPS2.Lib.csproj
index ba7f416e1..518c54db6 100644
--- a/NAPS2.Lib/NAPS2.Lib.csproj
+++ b/NAPS2.Lib/NAPS2.Lib.csproj
@@ -34,12 +34,13 @@
+
-
+
diff --git a/NAPS2.Lib/Platform/Windows/StillImage.cs b/NAPS2.Lib/Platform/Windows/StillImage.cs
index 78b77e103..d80c97dd2 100644
--- a/NAPS2.Lib/Platform/Windows/StillImage.cs
+++ b/NAPS2.Lib/Platform/Windows/StillImage.cs
@@ -43,9 +43,7 @@ public class StillImage
// TODO: Does it make sense to add IStillImage::(Un)RegisterLaunchApplication to NAPS2.Wia.Native?
// https://docs.microsoft.com/en-us/previous-versions/windows/hardware/drivers/ff543798(v=vs.85)
// Instead of modifying the registry directly.
-#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
-#endif
public void Register()
{
var exe = AssemblyHelper.EntryFile;
@@ -71,9 +69,7 @@ public class StillImage
key3.SetValue("Name", "NAPS2");
}
-#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
-#endif
public void Unregister()
{
Registry.LocalMachine.DeleteSubKey(REGKEY_AUTOPLAY_HANDLER_NAPS2, false);
diff --git a/NAPS2.Lib/Util/CompilerAttributes.cs b/NAPS2.Lib/Util/CompilerAttributes.cs
deleted file mode 100644
index 8230a289b..000000000
--- a/NAPS2.Lib/Util/CompilerAttributes.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
-// ReSharper disable once CheckNamespace
-
-namespace System.Runtime.CompilerServices
-{
- internal static class IsExternalInit
- {
- }
-
- /// Specifies that a type has required members or that a member is required.
- [AttributeUsage(
- AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property,
- AllowMultiple = false, Inherited = false)]
- internal sealed class RequiredMemberAttribute : Attribute
- {
- }
-
- ///
- /// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
- ///
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- internal sealed class CompilerFeatureRequiredAttribute : Attribute
- {
- public CompilerFeatureRequiredAttribute(string featureName)
- {
- FeatureName = featureName;
- }
-
- ///
- /// The name of the compiler feature.
- ///
- public string FeatureName { get; }
-
- ///
- /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand .
- ///
- public bool IsOptional { get; init; }
-
- ///
- /// The used for the ref structs C# feature.
- ///
- public const string RefStructs = nameof(RefStructs);
-
- ///
- /// The used for the required members C# feature.
- ///
- public const string RequiredMembers = nameof(RequiredMembers);
- }
-}
-
-namespace System.Diagnostics.CodeAnalysis
-{
- ///
- /// Specifies that this constructor sets all required members for the current type, and callers
- /// do not need to set any required members themselves.
- ///
- [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
- internal sealed class SetsRequiredMembersAttribute : Attribute
- {
- }
-}
\ No newline at end of file
diff --git a/NAPS2.Sdk.Tests/Images/GdiImageTests.cs b/NAPS2.Sdk.Tests/Images/GdiImageTests.cs
index d928163b9..e09b99b4e 100644
--- a/NAPS2.Sdk.Tests/Images/GdiImageTests.cs
+++ b/NAPS2.Sdk.Tests/Images/GdiImageTests.cs
@@ -7,9 +7,7 @@ using Xunit;
namespace NAPS2.Sdk.Tests.Images;
-#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
-#endif
public class GdiImageTests
{
[Fact]
diff --git a/NAPS2.Sdk.Tests/NAPS2.Sdk.Tests.csproj b/NAPS2.Sdk.Tests/NAPS2.Sdk.Tests.csproj
index 6f0146817..0acccfb30 100644
--- a/NAPS2.Sdk.Tests/NAPS2.Sdk.Tests.csproj
+++ b/NAPS2.Sdk.Tests/NAPS2.Sdk.Tests.csproj
@@ -28,11 +28,12 @@
+
-
+
<_Parameter1>NAPS2.Lib.Tests
diff --git a/NAPS2.Sdk.Tests/Util/IsExternalInit.cs b/NAPS2.Sdk.Tests/Util/IsExternalInit.cs
deleted file mode 100644
index 0993ddec1..000000000
--- a/NAPS2.Sdk.Tests/Util/IsExternalInit.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
-// ReSharper disable once CheckNamespace
-namespace System.Runtime.CompilerServices;
-
-internal static class IsExternalInit {}
\ No newline at end of file
diff --git a/NAPS2.Sdk/ImportExport/Email/Mapi/MapiWrapper.cs b/NAPS2.Sdk/ImportExport/Email/Mapi/MapiWrapper.cs
index 65809f1a2..222036a05 100644
--- a/NAPS2.Sdk/ImportExport/Email/Mapi/MapiWrapper.cs
+++ b/NAPS2.Sdk/ImportExport/Email/Mapi/MapiWrapper.cs
@@ -2,9 +2,7 @@
namespace NAPS2.ImportExport.Email.Mapi;
-#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
-#endif
internal class MapiWrapper : IMapiWrapper
{
private readonly SystemEmailClients _systemEmailClients;
diff --git a/NAPS2.Sdk/ImportExport/Email/Mapi/SystemEmailClients.cs b/NAPS2.Sdk/ImportExport/Email/Mapi/SystemEmailClients.cs
index b8bb1509b..4febdd34f 100644
--- a/NAPS2.Sdk/ImportExport/Email/Mapi/SystemEmailClients.cs
+++ b/NAPS2.Sdk/ImportExport/Email/Mapi/SystemEmailClients.cs
@@ -6,9 +6,7 @@ using NAPS2.Scan;
namespace NAPS2.ImportExport.Email.Mapi;
-#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows7.0")]
-#endif
internal class SystemEmailClients
{
private const string DEFAULT_MAPI_DLL = "mapi32.dll";
diff --git a/NAPS2.Sdk/NAPS2.Sdk.csproj b/NAPS2.Sdk/NAPS2.Sdk.csproj
index 17284f03a..1027e136a 100644
--- a/NAPS2.Sdk/NAPS2.Sdk.csproj
+++ b/NAPS2.Sdk/NAPS2.Sdk.csproj
@@ -37,7 +37,6 @@
-
diff --git a/NAPS2.Sdk/Scan/Internal/Twain/Win32MessageLoopHook.cs b/NAPS2.Sdk/Scan/Internal/Twain/Win32MessageLoopHook.cs
index 252317d16..7ceb40de9 100644
--- a/NAPS2.Sdk/Scan/Internal/Twain/Win32MessageLoopHook.cs
+++ b/NAPS2.Sdk/Scan/Internal/Twain/Win32MessageLoopHook.cs
@@ -10,9 +10,7 @@ namespace NAPS2.Scan.Internal.Twain;
///
/// A MessageLoopHook implementation that uses Win32 methods directly, with no dependencies on WinForms or WPF.
///
-#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
-#endif
internal class Win32MessageLoopHook : MessageLoopHook
{
private readonly ILogger _logger;
diff --git a/NAPS2.Sdk/Scan/Internal/Wia/WiaScanDriver.cs b/NAPS2.Sdk/Scan/Internal/Wia/WiaScanDriver.cs
index b7b45a794..ac3b017c5 100644
--- a/NAPS2.Sdk/Scan/Internal/Wia/WiaScanDriver.cs
+++ b/NAPS2.Sdk/Scan/Internal/Wia/WiaScanDriver.cs
@@ -7,9 +7,7 @@ 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;
diff --git a/NAPS2.Sdk/Util/CompilerAttributes.cs b/NAPS2.Sdk/Util/CompilerAttributes.cs
deleted file mode 100644
index 8230a289b..000000000
--- a/NAPS2.Sdk/Util/CompilerAttributes.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
-// ReSharper disable once CheckNamespace
-
-namespace System.Runtime.CompilerServices
-{
- internal static class IsExternalInit
- {
- }
-
- /// Specifies that a type has required members or that a member is required.
- [AttributeUsage(
- AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property,
- AllowMultiple = false, Inherited = false)]
- internal sealed class RequiredMemberAttribute : Attribute
- {
- }
-
- ///
- /// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
- ///
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- internal sealed class CompilerFeatureRequiredAttribute : Attribute
- {
- public CompilerFeatureRequiredAttribute(string featureName)
- {
- FeatureName = featureName;
- }
-
- ///
- /// The name of the compiler feature.
- ///
- public string FeatureName { get; }
-
- ///
- /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand .
- ///
- public bool IsOptional { get; init; }
-
- ///
- /// The used for the ref structs C# feature.
- ///
- public const string RefStructs = nameof(RefStructs);
-
- ///
- /// The used for the required members C# feature.
- ///
- public const string RequiredMembers = nameof(RequiredMembers);
- }
-}
-
-namespace System.Diagnostics.CodeAnalysis
-{
- ///
- /// Specifies that this constructor sets all required members for the current type, and callers
- /// do not need to set any required members themselves.
- ///
- [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
- internal sealed class SetsRequiredMembersAttribute : Attribute
- {
- }
-}
\ No newline at end of file