-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
85 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
using IronBarCode; | ||
using QRCoder; | ||
|
||
namespace OsanWebsite.Core.Infrastructure.Tools; | ||
|
||
public static class CodeGenerator | ||
{ | ||
public static MemoryStream CreateQrCodePngStream(string code) | ||
{ | ||
return QRCodeWriter.CreateQrCode(code, 500, QRCodeWriter.QrErrorCorrectionLevel.Medium) | ||
.SetMargins(30) | ||
.ToPngStream(); | ||
var generator = new QRCoder.QRCodeGenerator(); | ||
var data = generator.CreateQrCode(code, QRCoder.QRCodeGenerator.ECCLevel.L); | ||
var png = new PngByteQRCode(data); | ||
var dataBytes = png.GetGraphic(20); | ||
return new MemoryStream(dataBytes); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/OsanWebsite.Core/Infrastructure/Tools/FileDownloader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace OsanWebsite.Core.Infrastructure.Tools; | ||
|
||
public static class FileDownloader | ||
{ | ||
public static async Task<byte[]> DownloadAsBytes(string url) | ||
{ | ||
using (HttpClient http = new HttpClient()) | ||
{ | ||
var myBytes = await http.GetByteArrayAsync(url); | ||
return myBytes; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters