Skip to content

Commit

Permalink
Merge branch 'codebude:master' into allow_svg
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane32 authored Apr 2, 2024
2 parents 39660be + dfa5209 commit 95202ee
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 74 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/wf-build-release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
name: Checkout Code

- name: Install additional .NET SDKs
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
1.0.x
Expand All @@ -26,7 +26,7 @@ jobs:
uses: microsoft/setup-msbuild@v1

- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.2
uses: NuGet/setup-nuget@v2

- name: Restore NuGet Packages
run: nuget restore QRCoder.sln
Expand All @@ -35,7 +35,7 @@ jobs:
run: msbuild QRCoder.sln /p:Configuration=Release /p:NoWarn="1182" /p:NoWarn="1701" /nr:false /t:Rebuild

- name: Upload artifacts
uses: actions/upload-artifact@v1.0.0
uses: actions/upload-artifact@v4
with:
name: Compiled project
path: D:\a\qrcoder\qrcoder
Expand All @@ -45,13 +45,13 @@ jobs:
runs-on: windows-2019
steps:
- name: Download artifacts
uses: actions/download-artifact@v1.0.0
uses: actions/download-artifact@v4
with:
name: Compiled project
path: D:\a\qrcoder\qrcoder

- name: Install additional .NET SDKs
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
1.0.x
Expand Down Expand Up @@ -126,13 +126,13 @@ jobs:
GH_PKG_SEC: ${{ secrets.GH_PKG_REPO }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v1.0.0
uses: actions/download-artifact@v4
with:
name: Compiled project
path: D:\a\qrcoder\qrcoder

- name: Install additional .NET SDKs
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
1.0.x
Expand Down Expand Up @@ -177,6 +177,6 @@ jobs:
runs-on: windows-2019
steps:
- name: Delete artifacts
uses: GeekyEggo/delete-artifact@v1.0.0
uses: GeekyEggo/delete-artifact@v5
with:
name: Compiled project
16 changes: 8 additions & 8 deletions .github/workflows/wf-build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
name: Checkout Code

- name: Install additional .NET SDKs
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
1.0.x
Expand All @@ -27,7 +27,7 @@ jobs:
uses: microsoft/setup-msbuild@v1

- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.2
uses: NuGet/setup-nuget@v2

- name: Restore NuGet Packages
run: nuget restore QRCoder.sln
Expand All @@ -36,7 +36,7 @@ jobs:
run: msbuild QRCoder.sln /p:Configuration=Release /p:NoWarn="1182" /p:NoWarn="1701" /nr:false /t:Rebuild

- name: Upload artifacts
uses: actions/upload-artifact@v1.0.0
uses: actions/upload-artifact@v4
with:
name: Compiled project
path: D:\a\qrcoder\qrcoder
Expand All @@ -46,7 +46,7 @@ jobs:
runs-on: windows-2019
steps:
- name: Download artifacts
uses: actions/download-artifact@v1.0.0
uses: actions/download-artifact@v4
with:
name: Compiled project
path: D:\a\qrcoder\qrcoder
Expand Down Expand Up @@ -126,13 +126,13 @@ jobs:
GH_PKG_SEC: ${{ secrets.GH_PKG_REPO }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v1.0.0
uses: actions/download-artifact@v4
with:
name: Compiled project
path: D:\a\qrcoder\qrcoder

- name: Install additional .NET SDKs
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
1.0.x
Expand Down Expand Up @@ -171,6 +171,6 @@ jobs:
runs-on: windows-2019
steps:
- name: Delete artifacts
uses: GeekyEggo/delete-artifact@v1.0.0
uses: GeekyEggo/delete-artifact@v5
with:
name: Compiled project
14 changes: 7 additions & 7 deletions .github/workflows/wf-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
name: Checkout Code

- name: Install additional .NET SDKs
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
1.0.x
Expand All @@ -26,7 +26,7 @@ jobs:
uses: microsoft/setup-msbuild@v1

- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.2
uses: NuGet/setup-nuget@v2

- name: Restore NuGet Packages
run: nuget restore QRCoder.sln
Expand All @@ -35,7 +35,7 @@ jobs:
run: msbuild QRCoder.sln /p:Configuration=Release /p:NoWarn="1182" /p:NoWarn="1701" /nr:false /t:Rebuild

- name: Upload artifacts
uses: actions/upload-artifact@v1.0.0
uses: actions/upload-artifact@v4
with:
name: Compiled project
path: D:\a\qrcoder\qrcoder
Expand All @@ -45,13 +45,13 @@ jobs:
runs-on: windows-2019
steps:
- name: Download artifacts
uses: actions/download-artifact@v1.0.0
uses: actions/download-artifact@v4
with:
name: Compiled project
path: D:\a\qrcoder\qrcoder

- name: Install additional .NET SDKs
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
1.0.x
Expand Down Expand Up @@ -89,6 +89,6 @@ jobs:
runs-on: windows-2019
steps:
- name: Delete artifacts
uses: GeekyEggo/delete-artifact@v1.0.0
uses: GeekyEggo/delete-artifact@v5
with:
name: Compiled project
20 changes: 0 additions & 20 deletions QRCoderTests/ArtQRCodeRendererTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ public void can_create_standard_qrcode_graphic()
var bmp = new ArtQRCode(data).GetGraphic(10);

var result = HelperFunctions.BitmapToHash(bmp);
#if NET35_OR_GREATER || NET40_OR_GREATER
result.ShouldBe("11ebdda91b9632d016798cb6de2f5339");
#else
result.ShouldBe("cb38c3156eaf13cdfba699bdafc3a84c");
#endif
}

[Fact]
Expand All @@ -40,11 +36,7 @@ public void can_create_standard_qrcode_graphic_with_custom_finder()
var bmp = new ArtQRCode(data).GetGraphic(10, Color.Black, Color.White, Color.Transparent, finderPatternImage: finder);

var result = HelperFunctions.BitmapToHash(bmp);
#if NET35_OR_GREATER || NET40_OR_GREATER
result.ShouldBe("c54a7389ae995abc838f0d228acc3bad");
#else
result.ShouldBe("1102c0c6f235eaf4c3ac639f82f17bfa");
#endif
}

[Fact]
Expand All @@ -56,11 +48,7 @@ public void can_create_standard_qrcode_graphic_without_quietzone()
var bmp = new ArtQRCode(data).GetGraphic(10, Color.Black, Color.White, Color.Transparent, drawQuietZones: false);

var result = HelperFunctions.BitmapToHash(bmp);
#if NET35_OR_GREATER || NET40_OR_GREATER
result.ShouldBe("550f31b988ff12d5f8429ef19d9d5a0c");
#else
result.ShouldBe("632315c8695416fc82fe06a202688433");
#endif
}

[Fact]
Expand All @@ -74,11 +62,7 @@ public void can_create_standard_qrcode_graphic_with_background()

var result = HelperFunctions.BitmapToHash(bmp);

#if NET35_OR_GREATER || NET40_OR_GREATER
result.ShouldBe("2caa9c0ee8fcb4a93841debb58cf41bc");
#else
result.ShouldBe("bbea08507282773175cfe7b52f0ddae4");
#endif
}

[Fact]
Expand Down Expand Up @@ -112,11 +96,7 @@ public void can_render_artqrcode_from_helper()
var bmp = ArtQRCodeHelper.GetQRCode("A", 10, Color.Black, Color.White, Color.Transparent, QRCodeGenerator.ECCLevel.L);

var result = HelperFunctions.BitmapToHash(bmp);
#if NET35_OR_GREATER || NET40_OR_GREATER
result.ShouldBe("fea51114bc4ff893542a1c0574c82a07");
#else
result.ShouldBe("57ecaa9bdeadcdcbeac8a19d734907ff");
#endif
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions QRCoderTests/PngByteQRCodeRendererTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,7 @@ public void can_render_pngbyte_qrcode_color_without_quietzones()
var bmp = (Bitmap)Image.FromStream(mStream);
bmp.MakeTransparent(Color.Transparent);
var result = HelperFunctions.BitmapToHash(bmp);
#if NET35_OR_GREATER || NET40_OR_GREATER
result.ShouldBe("75be11d582575617d2490c54b69e844e");
#else
result.ShouldBe("fbbc8255ebf3e4f4a1d21f0dd15f76f8");
#endif
}
#endif
}
Expand Down
24 changes: 0 additions & 24 deletions QRCoderTests/QRCodeRendererTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ public void can_create_qrcode_standard_graphic_without_quietzones()
var bmp = new QRCode(data).GetGraphic(5, Color.Black, Color.White, false);

var result = HelperFunctions.BitmapToHash(bmp);
#if NET35_OR_GREATER || NET40_OR_GREATER
result.ShouldBe("329e1664f57cbe7332d8d4db04c1d480");
#else
result.ShouldBe("d703e54a0ba541c6ea69e3d316e394e7");
#endif
}


Expand All @@ -65,11 +61,7 @@ public void can_create_qrcode_with_transparent_logo_graphic()
var bmp = new QRCode(data).GetGraphic(10, Color.Black, Color.Transparent, icon: (Bitmap)Image.FromFile(HelperFunctions.GetAssemblyPath() + "\\assets\\noun_software engineer_2909346.png"));
//Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909346
var result = HelperFunctions.BitmapToHash(bmp);
#if NET35_OR_GREATER || NET40_OR_GREATER
result.ShouldBe("ee65d96c3013f6032b561cc768251eef");
#else
result.ShouldBe("150f8fc7dae4487ba2887d2b2bea1c25");
#endif
}

[Fact]
Expand All @@ -83,11 +75,7 @@ public void can_create_qrcode_with_non_transparent_logo_graphic()
//Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909346

var result = HelperFunctions.BitmapToHash(bmp);
#if NET35_OR_GREATER || NET40_OR_GREATER
result.ShouldBe("1d718f06f904af4a46748f02af2d4eec");
#else
result.ShouldBe("c46a7ec51bf978d7a882059c322ca69d");
#endif
}

[Fact]
Expand All @@ -102,11 +90,7 @@ public void can_create_qrcode_with_logo_and_with_transparent_border()
var bmp = new QRCode(data).GetGraphic(10, Color.Black, Color.Transparent, icon: logo, iconBorderWidth: 6);
//Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909346
var result = HelperFunctions.BitmapToHash(bmp);
#if NET35_OR_GREATER || NET40_OR_GREATER
result.ShouldBe("ee65d96c3013f6032b561cc768251eef");
#else
result.ShouldBe("150f8fc7dae4487ba2887d2b2bea1c25");
#endif
}

[Fact]
Expand All @@ -121,11 +105,7 @@ public void can_create_qrcode_with_logo_and_with_standard_border()
var bmp = new QRCode(data).GetGraphic(10, Color.Black, Color.White, icon: logo, iconBorderWidth: 6);
//Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909346
var result = HelperFunctions.BitmapToHash(bmp);
#if NET35_OR_GREATER || NET40_OR_GREATER
result.ShouldBe("52207bd86ca5a532fb2095dbaa0ae04c");
#else
result.ShouldBe("1c926ea1d48f42fdf8e6f1438b774cdd");
#endif
}

[Fact]
Expand All @@ -140,11 +120,7 @@ public void can_create_qrcode_with_logo_and_with_custom_border()
var bmp = new QRCode(data).GetGraphic(10, Color.Black, Color.Transparent, icon: logo, iconBorderWidth: 6, iconBackgroundColor: Color.DarkGreen);
//Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909346
var result = HelperFunctions.BitmapToHash(bmp);
#if NET35_OR_GREATER || NET40_OR_GREATER
result.ShouldBe("d2f20d34a973d92b9c3e05db1393b331");
#else
result.ShouldBe("9a06bfbb72df999b6290b5af5c4037cb");
#endif
}


Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ You only need four lines of code, to generate and view your first QR code.
```csharp
QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode("The text which should be encoded.", QRCodeGenerator.ECCLevel.Q);
QRCode qrCode = new QRCode(qrCodeData);
Bitmap qrCodeImage = qrCode.GetGraphic(20);
QRCode qrCode = new PngByteQRCode(qrCodeData);
byte[] qrCodeImage = qrCode.GetGraphic(20);
```

### Optional parameters and overloads
Expand Down

0 comments on commit 95202ee

Please sign in to comment.