Skip to content

Commit 757ea5f

Browse files
authored
Prep for v2; target .NET Standard 2.0, .NET Standard 2.1 and .NET 6.0 (#685)
* Target .NET Standard 2.0, .NET Standard 2.1 and .NET 6.0 * Remove master branch restriction from PR workflow * Add develop branch to CI workflow triggers * Update workflow to remove master branch restriction Removed branch specification for pull request trigger. * Update VersionPrefix to 2.0.0-preview * Don't test .NET Core 2.1 * Remove .NET Core 2.1 and .NET 5.0 from CI workflows * Add QRCoder library classes and methods for QR code generation and payload handling - Implemented abstract class AbstractQRCode and derived classes: ArtQRCode, AsciiQRCode, Base64QRCode, BitmapByteQRCode, PdfByteQRCode, PngByteQRCode, PostscriptQRCode, SvgQRCode, and QRCode. - Added helper classes for each QR code type to facilitate QR code generation. - Introduced PayloadGenerator with various payload types including BezahlCode, BitcoinAddress, CalendarEvent, ContactData, Geolocation, Girocode, and more. - Defined enums for various configurations and options within the QR code generation process. - Included exception handling classes for managing errors related to data size and specific payload types. - Established a comprehensive structure for QR code data management with QRCodeData and QRCodeGenerator classes. * Update * Fix usings * update * update * Update cross-platform support information in README.md * Add migration guide for QRCoder v2 and update README.md * Use ReadOnlySpan
1 parent ac4aac0 commit 757ea5f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+267
-1481
lines changed

.github/workflows/wf-build-release-ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- master
7+
- develop
78

89
concurrency:
910
group: ${{ github.workflow }}-${{ github.ref }}
@@ -22,9 +23,7 @@ jobs:
2223
uses: actions/setup-dotnet@v5
2324
with:
2425
dotnet-version: |
25-
2.1.x
2626
3.1.x
27-
5.0.x
2827
6.0.x
2928
8.0.x
3029

.github/workflows/wf-build-test.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Build, test (Pull Request)
22

33
on:
44
pull_request:
5-
branches:
6-
- master
75

86
concurrency:
97
group: pr-${{ github.event.pull_request.number }}
@@ -18,9 +16,7 @@ jobs:
1816
matrix:
1917
dotnet-framework:
2018
- { name: ".NET Framework 4.6.2", framework: "net462", coverage: false, no-build: true, sdk: "" }
21-
- { name: ".NET Core 2.1", framework: "netcoreapp2.1", coverage: true, no-build: false, sdk: "2.1.x" }
2219
- { name: ".NET Core 3.1", framework: "netcoreapp3.1", coverage: true, no-build: true, sdk: "3.1.x" }
23-
- { name: ".NET 5.0 Windows", framework: "net5.0-windows", coverage: true, no-build: true, sdk: "5.0.x" }
2420
- { name: ".NET 6.0 Windows", framework: "net6.0-windows", coverage: true, no-build: true, sdk: "6.0.x" }
2521

2622
steps:

.github/workflows/wf-verify-formatting.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: Format (Pull Request)
22
on:
33
pull_request:
4-
branches:
5-
- master
6-
workflow_dispatch:
74

85
jobs:
96
format:

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<PropertyGroup>
1313
<!-- Set version and default properties -->
14-
<VersionPrefix>1.6.1-preview</VersionPrefix>
14+
<VersionPrefix>2.0.0-preview</VersionPrefix>
1515
<LangVersion>12</LangVersion>
1616
<Nullable>enable</Nullable>
1717
<IsPackable>false</IsPackable>
@@ -39,7 +39,7 @@
3939
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
4040
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
4141
<GenerateDocumentationFile>true</GenerateDocumentationFile>
42-
<NoWarn>$(NoWarn);IDE0005;CA1510</NoWarn>
42+
<NoWarn>$(NoWarn);IDE0005;CA1510;CA1708</NoWarn>
4343
<EnableNETAnalyzers>True</EnableNETAnalyzers>
4444
<AnalysisLevel>8-recommended</AnalysisLevel>
4545
</PropertyGroup>

Directory.Build.targets

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<Project>
22

3-
<!-- Define SYSTEM_DRAWING and HAS_SPAN -->
4-
<PropertyGroup>
5-
<DefineConstants Condition="'$(TargetFramework)' != 'netstandard1.3'">$(DefineConstants);SYSTEM_DRAWING</DefineConstants>
6-
<DefineConstants Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp2.1')) OR '$(TargetFramework)' == 'netstandard2.1'">$(DefineConstants);HAS_SPAN</DefineConstants>
7-
</PropertyGroup>
8-
93
<!-- Strong name signing for Release builds of packable projects -->
104
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
115
<SignAssembly>true</SignAssembly>
@@ -22,9 +16,4 @@
2216
<ContinuousIntegrationBuild Condition="'$(Configuration)' == 'Release' AND '$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
2317
</PropertyGroup>
2418

25-
<!-- Remove System.Threading.Tasks as implicit using since it does not exist in .NET Framework 3.5 -->
26-
<ItemGroup Condition="'$(TargetFramework)' == 'net35'">
27-
<Using Remove="System.Threading.Tasks" />
28-
</ItemGroup>
29-
3019
</Project>

QRCoder.Xaml/QRCoder.Xaml.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<PropertyGroup>
44
<!-- Set essential properties -->
5-
<TargetFrameworks>net35;net40;net5.0-windows;net6.0-windows</TargetFrameworks>
6-
<UseWPF Condition="'$(TargetFramework)' == 'net5.0-windows' OR '$(TargetFramework)' == 'net6.0-windows'">true</UseWPF>
5+
<TargetFrameworks>net462;net6.0-windows</TargetFrameworks>
6+
<UseWPF Condition="'$(TargetFramework)' == 'net6.0-windows'">true</UseWPF>
77
<IsPackable>true</IsPackable>
88

99
<!-- Set NuGet package properties -->
@@ -16,7 +16,7 @@
1616
<Guid>f9ec6466-b807-40ae-bc05-db9f88967c0c</Guid>
1717
</PropertyGroup>
1818

19-
<ItemGroup Condition=" '$(TargetFramework)' == 'net35' OR '$(TargetFramework)' == 'net40' ">
19+
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
2020
<Reference Include="PresentationCore" />
2121
<Reference Include="PresentationFramework" />
2222
<Reference Include="WindowsBase" />

QRCoder/ASCIIQRCode.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public string[] GetLineByLineGraphic(int repeatPerModule, string darkColorString
5656
var sideLength = (QrCodeData.ModuleMatrix.Count - quietZonesModifier) * verticalNumberOfRepeats;
5757
var qrCode = new string[sideLength];
5858
var lineCapacity = (QrCodeData.ModuleMatrix.Count - quietZonesModifier) * repeatPerModule * darkColorString.Length;
59-
#if HAS_SPAN
6059
if (darkColorString.Length == whiteSpaceString.Length && lineCapacity < 510)
6160
{
6261
Span<char> row = stackalloc char[512].Slice(0, lineCapacity);
@@ -78,7 +77,6 @@ public string[] GetLineByLineGraphic(int repeatPerModule, string darkColorString
7877
}
7978
return qrCode;
8079
}
81-
#endif
8280
var lineBuilder = new StringBuilder(lineCapacity);
8381
for (var y = 0; y < sideLength; y++)
8482
{

QRCoder/ArtQRCode.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#if SYSTEM_DRAWING
2-
31
using System.Drawing;
42
using System.Drawing.Drawing2D;
53
using static QRCoder.ArtQRCode;
@@ -11,9 +9,7 @@ namespace QRCoder;
119
/// <summary>
1210
/// Represents an art-style QR code generator that provides functionality to render QR codes with dots as modules.
1311
/// </summary>
14-
#if NET6_0_OR_GREATER
1512
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
16-
#endif
1713
public class ArtQRCode : AbstractQRCode, IDisposable
1814
{
1915
/// <summary>
@@ -266,9 +262,7 @@ public enum BackgroundImageStyle
266262
/// <summary>
267263
/// Provides static methods for creating art-style QR codes.
268264
/// </summary>
269-
#if NET6_0_OR_GREATER
270265
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
271-
#endif
272266
public static class ArtQRCodeHelper
273267
{
274268
/// <summary>
@@ -302,5 +296,3 @@ public static Bitmap GetQRCode(string plainText, int pixelsPerModule, Color dark
302296
return qrCode.GetGraphic(pixelsPerModule, darkColor, lightColor, backgroundColor, backgroundImage, pixelSizeFactor, drawQuietZones, quietZoneRenderingStyle, backgroundImageStyle, finderPatternImage);
303297
}
304298
}
305-
306-
#endif

QRCoder/Attributes/NotNullWhenAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if !NETCOREAPP && !NETSTANDARD2_1
1+
#if NETSTANDARD2_0
22
namespace System.Diagnostics.CodeAnalysis;
33

44
/// <summary>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#if !NET6_0_OR_GREATER
2+
3+
// Licensed to the .NET Foundation under one or more agreements.
4+
// The .NET Foundation licenses this file to you under the MIT license.
5+
6+
namespace System.Diagnostics;
7+
8+
/// <summary>
9+
/// Types and Methods attributed with StackTraceHidden will be omitted from the stack trace text shown in StackTrace.ToString()
10+
/// and Exception.StackTrace
11+
/// </summary>
12+
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Struct, Inherited = false)]
13+
public sealed class StackTraceHiddenAttribute : Attribute
14+
{
15+
/// <summary>
16+
/// Initializes a new instance of the <see cref="StackTraceHiddenAttribute"/> class.
17+
/// </summary>
18+
public StackTraceHiddenAttribute() { }
19+
}
20+
21+
#endif

0 commit comments

Comments
 (0)