Skip to content
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
90f3347
Target .NET Standard 2.0, .NET Standard 2.1 and .NET 6.0
Shane32 Oct 18, 2025
cee10c3
Remove master branch restriction from PR workflow
Shane32 Oct 18, 2025
733f3c1
Add develop branch to CI workflow triggers
Shane32 Oct 18, 2025
d20feaf
Update workflow to remove master branch restriction
Shane32 Oct 18, 2025
429f8e8
Update VersionPrefix to 2.0.0-preview
Shane32 Oct 18, 2025
d5b1a92
Don't test .NET Core 2.1
Shane32 Oct 18, 2025
07894bb
Remove .NET Core 2.1 and .NET 5.0 from CI workflows
Shane32 Oct 18, 2025
232723b
Add QRCoder library classes and methods for QR code generation and pa…
Shane32 Oct 18, 2025
8eced06
Update
Shane32 Oct 18, 2025
3f8a9f7
Fix usings
Shane32 Oct 18, 2025
38ef897
update
Shane32 Oct 18, 2025
d6b1ca5
update
Shane32 Oct 18, 2025
3b3ceb2
Split project to QRCoder.SystemDrawing
Shane32 Oct 19, 2025
3dab082
update
Shane32 Oct 19, 2025
2db52d0
Add additional color names with alternative spellings to ColorTranslator
Shane32 Oct 19, 2025
7070bcc
Add documentation for known HTML color names in ColorTranslator
Shane32 Oct 19, 2025
1f7fcb4
Refactor GetGraphic method to simplify color handling logic
Shane32 Oct 19, 2025
40d3e4f
Refactor GetGraphic method overloads to improve color handling and ma…
Shane32 Oct 19, 2025
2336548
Refactor GetGraphic method to enhance functionality and remove redund…
Shane32 Oct 19, 2025
6f82b7c
Refactor GetGraphic method to improve clarity and maintain consistenc…
Shane32 Oct 19, 2025
593c44c
Refactor GetGraphic method to restore and enhance overload with color…
Shane32 Oct 19, 2025
62f6ddd
Refactor GetGraphic method to add overload for enhanced color customi…
Shane32 Oct 19, 2025
ec94c43
Update
Shane32 Oct 19, 2025
252d8dd
Update cross-platform support information in README.md
Shane32 Oct 19, 2025
2703bcf
Merge branch 'tfm' into systemdrawing
Shane32 Oct 19, 2025
68880f5
Add migration guide for QRCoder v2 with new features and breaking cha…
Shane32 Oct 19, 2025
564826a
Add migration guide for QRCoder v2 and update README.md
Shane32 Oct 19, 2025
31734e1
Merge branch 'tfm' into systemdrawing
Shane32 Oct 19, 2025
695ab8b
Update project references and enhance migration documentation for QRC…
Shane32 Oct 19, 2025
18c2f77
fix usings
Shane32 Oct 19, 2025
5cf388d
update
Shane32 Oct 19, 2025
f6d19cd
Update QRCoder/Base64QRCode.cs
Shane32 Oct 25, 2025
d8b1b58
Use ReadOnlySpan
Shane32 Oct 25, 2025
7e70143
Merge branch 'tfm' into systemdrawing
Shane32 Oct 25, 2025
e1cbf15
Add newlines
Shane32 Oct 25, 2025
b59a83d
Merge from develop
Shane32 Oct 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/wf-build-release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -22,9 +23,7 @@ jobs:
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x
8.0.x

Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/wf-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Build, test (Pull Request)

on:
pull_request:
branches:
- master

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

steps:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/wf-verify-formatting.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Format (Pull Request)
on:
pull_request:
branches:
- master
workflow_dispatch:

jobs:
format:
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<PropertyGroup>
<!-- Set version and default properties -->
<VersionPrefix>1.6.1-preview</VersionPrefix>
<VersionPrefix>2.0.0-preview</VersionPrefix>
<LangVersion>12</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down Expand Up @@ -39,7 +39,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);IDE0005;CA1510</NoWarn>
<NoWarn>$(NoWarn);IDE0005;CA1510;CA1708</NoWarn>
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<AnalysisLevel>8-recommended</AnalysisLevel>
</PropertyGroup>
Expand Down
11 changes: 0 additions & 11 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<Project>

<!-- Define SYSTEM_DRAWING and HAS_SPAN -->
<PropertyGroup>
<DefineConstants Condition="'$(TargetFramework)' != 'netstandard1.3'">$(DefineConstants);SYSTEM_DRAWING</DefineConstants>
<DefineConstants Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp2.1')) OR '$(TargetFramework)' == 'netstandard2.1'">$(DefineConstants);HAS_SPAN</DefineConstants>
</PropertyGroup>

<!-- Strong name signing for Release builds of packable projects -->
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<SignAssembly>true</SignAssembly>
Expand All @@ -22,9 +16,4 @@
<ContinuousIntegrationBuild Condition="'$(Configuration)' == 'Release' AND '$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>

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

</Project>
8 changes: 0 additions & 8 deletions QRCoder/ArtQRCode.cs → QRCoder.SystemDrawing/ArtQRCode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#if SYSTEM_DRAWING

using System.Drawing;
using System.Drawing.Drawing2D;
using static QRCoder.ArtQRCode;
Expand All @@ -11,9 +9,7 @@ namespace QRCoder;
/// <summary>
/// Represents an art-style QR code generator that provides functionality to render QR codes with dots as modules.
/// </summary>
#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
#endif
public class ArtQRCode : AbstractQRCode, IDisposable
{
/// <summary>
Expand Down Expand Up @@ -266,9 +262,7 @@ public enum BackgroundImageStyle
/// <summary>
/// Provides static methods for creating art-style QR codes.
/// </summary>
#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
#endif
public static class ArtQRCodeHelper
{
/// <summary>
Expand Down Expand Up @@ -302,5 +296,3 @@ public static Bitmap GetQRCode(string plainText, int pixelsPerModule, Color dark
return qrCode.GetGraphic(pixelsPerModule, darkColor, lightColor, backgroundColor, backgroundImage, pixelSizeFactor, drawQuietZones, quietZoneRenderingStyle, backgroundImageStyle, finderPatternImage);
}
}

#endif
7 changes: 0 additions & 7 deletions QRCoder/QRCode.cs → QRCoder.SystemDrawing/QRCode.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if SYSTEM_DRAWING
using System.Drawing;
using System.Drawing.Drawing2D;
using static QRCoder.QRCodeGenerator;
Expand All @@ -8,9 +7,7 @@ namespace QRCoder;
/// <summary>
/// Represents a QR code generator that outputs QR codes as bitmap images.
/// </summary>
#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
#endif
public class QRCode : AbstractQRCode, IDisposable
{
/// <summary>
Expand Down Expand Up @@ -193,9 +190,7 @@ internal static GraphicsPath CreateRoundedRectanglePath(RectangleF rect, int cor
/// <summary>
/// Provides static methods for creating bitmap QR codes.
/// </summary>
#if NET6_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
#endif
public static class QRCodeHelper
{
/// <summary>
Expand Down Expand Up @@ -223,5 +218,3 @@ public static Bitmap GetQRCode(string plainText, int pixelsPerModule, Color dark
return qrCode.GetGraphic(pixelsPerModule, darkColor, lightColor, icon, iconSizePercent, iconBorderWidth, drawQuietZones);
}
}

#endif
26 changes: 26 additions & 0 deletions QRCoder.SystemDrawing/QRCoder.SystemDrawing.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- Set essential properties -->
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<IsTrimmable Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">true</IsTrimmable>
<IsPackable>true</IsPackable>

<!-- Set NuGet package properties -->
<PackageTags>c# csharp qr qrcoder qrcode qr-generator qr-code-generator</PackageTags>
<Description>QRCoder is a simple library, written in C#.NET, which enables you to create QR codes.</Description>

<!-- Set strong name -->
<AssemblyOriginatorKeyFile>../QRCoder/QRCoderStrongName.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="4.7.3" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" Condition="'$(TargetFramework)' == 'net6.0'" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\QRCoder\QRCoder.csproj" />
</ItemGroup>

</Project>
39 changes: 39 additions & 0 deletions QRCoder.SystemDrawing/SupportedOSPlatformAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#if !NET6_0_OR_GREATER
#pragma warning disable IDE0060 // Remove unused parameter

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace System.Runtime.Versioning;

/// <summary>
/// Records the operating system (and minimum version) that supports an API. Multiple attributes can be
/// applied to indicate support on multiple operating systems.
/// </summary>
/// <remarks>
/// Callers can apply a <see cref="SupportedOSPlatformAttribute " />
/// or use guards to prevent calls to APIs on unsupported operating systems.
///
/// A given platform should only be specified once.
/// </remarks>
[AttributeUsage(
AttributeTargets.Assembly |
AttributeTargets.Class |
AttributeTargets.Constructor |
AttributeTargets.Enum |
AttributeTargets.Event |
AttributeTargets.Field |
AttributeTargets.Interface |
AttributeTargets.Method |
AttributeTargets.Module |
AttributeTargets.Property |
AttributeTargets.Struct,
AllowMultiple = true, Inherited = false)]
internal sealed class SupportedOSPlatformAttribute : Attribute
{
public SupportedOSPlatformAttribute(string platformName)
{
}
}

#endif
6 changes: 3 additions & 3 deletions QRCoder.Xaml/QRCoder.Xaml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

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

<!-- Set NuGet package properties -->
Expand All @@ -16,7 +16,7 @@
<Guid>f9ec6466-b807-40ae-bc05-db9f88967c0c</Guid>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net35' OR '$(TargetFramework)' == 'net40' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsBase" />
Expand Down
18 changes: 18 additions & 0 deletions QRCoder.sln
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRCoderSamples", "QRCoderSamples\QRCoderSamples.csproj", "{61ED615B-C22C-5E3E-DAAD-A77A820E16DF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRCoder.SystemDrawing", "QRCoder.SystemDrawing\QRCoder.SystemDrawing.csproj", "{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -201,6 +203,22 @@ Global
{61ED615B-C22C-5E3E-DAAD-A77A820E16DF}.Release|x64.Build.0 = Release|Any CPU
{61ED615B-C22C-5E3E-DAAD-A77A820E16DF}.Release|x86.ActiveCfg = Release|Any CPU
{61ED615B-C22C-5E3E-DAAD-A77A820E16DF}.Release|x86.Build.0 = Release|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Debug|ARM.ActiveCfg = Debug|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Debug|ARM.Build.0 = Debug|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Debug|x64.ActiveCfg = Debug|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Debug|x64.Build.0 = Debug|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Debug|x86.ActiveCfg = Debug|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Debug|x86.Build.0 = Debug|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Release|Any CPU.Build.0 = Release|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Release|ARM.ActiveCfg = Release|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Release|ARM.Build.0 = Release|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Release|x64.ActiveCfg = Release|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Release|x64.Build.0 = Release|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Release|x86.ActiveCfg = Release|Any CPU
{FEE6DC1D-BE5A-4498-A70D-35C516AD13F3}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 0 additions & 2 deletions QRCoder/ASCIIQRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public string[] GetLineByLineGraphic(int repeatPerModule, string darkColorString
var sideLength = (QrCodeData.ModuleMatrix.Count - quietZonesModifier) * verticalNumberOfRepeats;
var qrCode = new string[sideLength];
var lineCapacity = (QrCodeData.ModuleMatrix.Count - quietZonesModifier) * repeatPerModule * darkColorString.Length;
#if HAS_SPAN
if (darkColorString.Length == whiteSpaceString.Length && lineCapacity < 510)
{
Span<char> row = stackalloc char[512].Slice(0, lineCapacity);
Expand All @@ -78,7 +77,6 @@ public string[] GetLineByLineGraphic(int repeatPerModule, string darkColorString
}
return qrCode;
}
#endif
var lineBuilder = new StringBuilder(lineCapacity);
for (var y = 0; y < sideLength; y++)
{
Expand Down
2 changes: 1 addition & 1 deletion QRCoder/Attributes/NotNullWhenAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETCOREAPP && !NETSTANDARD2_1
#if NETSTANDARD2_0
namespace System.Diagnostics.CodeAnalysis;

/// <summary>
Expand Down
21 changes: 21 additions & 0 deletions QRCoder/Attributes/StackTraceHiddenAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#if !NET6_0_OR_GREATER

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace System.Diagnostics;

/// <summary>
/// Types and Methods attributed with StackTraceHidden will be omitted from the stack trace text shown in StackTrace.ToString()
/// and Exception.StackTrace
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Struct, Inherited = false)]
public sealed class StackTraceHiddenAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="StackTraceHiddenAttribute"/> class.
/// </summary>
public StackTraceHiddenAttribute() { }
}

#endif
Loading