diff --git a/NAPS2.App.Tests/IsExternalInit.cs b/NAPS2.App.Tests/IsExternalInit.cs
deleted file mode 100644
index 0993ddec14..0000000000
--- 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 8230a289b1..0000000000
--- 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 422fedd73b..b6a6b43547 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 8230a289b1..0000000000
--- 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 7d05cc63f8..f0e07d4fad 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 8230a289b1..0000000000
--- 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 acf44886a5..9899c49346 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 4c9742b8b2..7049817c55 100644
--- a/NAPS2.Images.Gdi/GdiExtensions.cs
+++ b/NAPS2.Images.Gdi/GdiExtensions.cs
@@ -3,9 +3,7 @@
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 114bd2155c..b0d500c1d4 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 4c7b14c501..d2d25ce922 100644
--- a/NAPS2.Images.Gdi/GdiImageContext.cs
+++ b/NAPS2.Images.Gdi/GdiImageContext.cs
@@ -4,9 +4,7 @@
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 3ee9f78b03..4ad27435df 100644
--- a/NAPS2.Images.Gdi/GdiImageLockState.cs
+++ b/NAPS2.Images.Gdi/GdiImageLockState.cs
@@ -4,9 +4,7 @@
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 e678398d69..de9c9a2fa0 100644
--- a/NAPS2.Images.Gdi/GdiImageTransformer.cs
+++ b/NAPS2.Images.Gdi/GdiImageTransformer.cs
@@ -4,9 +4,7 @@
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 75bbd84a47..190f9e3e9d 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 96bc1be0d6..34846a5c67 100644
--- a/NAPS2.Images.Gdi/GdiTiffWriter.cs
+++ b/NAPS2.Images.Gdi/GdiTiffWriter.cs
@@ -4,9 +4,7 @@
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 ba0435b8b5..0000000000
--- 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 5b4be277ac..5ff2bc0547 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 @@ protected ImageContext(Type imageType)
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 @@ private bool MaybeRenderPdf(ImageFileStorage fileStorage, IPdfRenderer? pdfRende
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 @@ private IMemoryImage RenderFromStorage(IImageStorage storage, IPdfRenderer? pdfR
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 ba0435b8b5..0000000000
--- 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 9cc3f1d347..a5cc0910b6 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 a220783fce..8581c2ad63 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 8230a289b1..0000000000
--- 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 e1e2e66ea2..0000000000
--- 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 8230a289b1..0000000000
--- 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 0993ddec14..0000000000
--- 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 6c30bde25a..b5f04fda5d 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 8230a289b1..0000000000
--- 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 ba7f416e17..518c54db63 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 78b77e1036..d80c97dd27 100644
--- a/NAPS2.Lib/Platform/Windows/StillImage.cs
+++ b/NAPS2.Lib/Platform/Windows/StillImage.cs
@@ -43,9 +43,7 @@ public void ParseArgs(string[] args)
// 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 void Register()
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 8230a289b1..0000000000
--- 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 d928163b90..e09b99b4e7 100644
--- a/NAPS2.Sdk.Tests/Images/GdiImageTests.cs
+++ b/NAPS2.Sdk.Tests/Images/GdiImageTests.cs
@@ -7,9 +7,7 @@
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 6f01468173..0acccfb30b 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 0993ddec14..0000000000
--- 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 65809f1a27..222036a055 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 b8bb1509b9..4febdd34f5 100644
--- a/NAPS2.Sdk/ImportExport/Email/Mapi/SystemEmailClients.cs
+++ b/NAPS2.Sdk/ImportExport/Email/Mapi/SystemEmailClients.cs
@@ -6,9 +6,7 @@
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 17284f03a6..1027e136a4 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 252317d161..7ceb40de94 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 b7b45a7940..ac3b017c57 100644
--- a/NAPS2.Sdk/Scan/Internal/Wia/WiaScanDriver.cs
+++ b/NAPS2.Sdk/Scan/Internal/Wia/WiaScanDriver.cs
@@ -7,9 +7,7 @@
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 8230a289b1..0000000000
--- 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