diff --git a/Google.Authenticator/Google.Authenticator.csproj b/Google.Authenticator/Google.Authenticator.csproj index 3327d9b..520aecc 100644 --- a/Google.Authenticator/Google.Authenticator.csproj +++ b/Google.Authenticator/Google.Authenticator.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net45;net5.0;net6.0 + netstandard2.0;net462 Google Authenticator Two-Factor Google Authenticator Two-Factor Authentication Library Google Authenticator Two-Factor Authentication Library (Not officially affiliated with Google.) @@ -23,21 +23,6 @@ - - - NETCORE;NETSTANDARD;NETSTANDARD2_0 - - - - NET45;NETFULL - - - - NET5_0;NETCOREAPP - - - NET6_0; - diff --git a/Google.Authenticator/TwoFactorAuthenticator.cs b/Google.Authenticator/TwoFactorAuthenticator.cs index ebf96d8..0a1d963 100644 --- a/Google.Authenticator/TwoFactorAuthenticator.cs +++ b/Google.Authenticator/TwoFactorAuthenticator.cs @@ -89,21 +89,12 @@ private static string GenerateQrCodeUrl(int qrPixelsPerModule, string provisionU { using (var qrGenerator = new QRCodeGenerator()) using (var qrCodeData = qrGenerator.CreateQrCode(provisionUrl, QRCodeGenerator.ECCLevel.Q)) - #if NET6_0 - using (var qrCode = new PngByteQRCode(qrCodeData)) - { - var qrCodeImage = qrCode.GetGraphic(qrPixelsPerModule); - qrCodeUrl = $"data:image/png;base64,{Convert.ToBase64String(qrCodeImage)}"; - } - #else - using (var qrCode = new QRCode(qrCodeData)) - using (var qrCodeImage = qrCode.GetGraphic(qrPixelsPerModule)) - using (var ms = new MemoryStream()) - { - qrCodeImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png); - qrCodeUrl = $"data:image/png;base64,{Convert.ToBase64String(ms.ToArray())}"; - } - #endif + using (var qrCode = new PngByteQRCode(qrCodeData)) + { + var qrCodeImage = qrCode.GetGraphic(qrPixelsPerModule); + qrCodeUrl = $"data:image/png;base64,{Convert.ToBase64String(qrCodeImage)}"; + } + } catch (TypeInitializationException e) { diff --git a/README.md b/README.md index 0d7c980..ad05b7d 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,10 @@ bool result = tfa.ValidateTwoFactorPIN(key, txtCode.Text) ## Updates +### 3.0.0-beta1 +Removed support for legacy .Net Framework. Lowest supported versions are now netstandard2.0 and .Net 4.6.2. +All use of System.Drawing has been removed. In 2.5, only Net 6.0 avoided System.Drawing. + ### 2.5.0 Now runs on .Net 6.0. Technically the QR Coder library we rely on still does not fully support .Net 6.0 so it is possible there will be other niggling issues, but for now all tests pass for .Net 6.0 on both Windows and Linux.