Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed framework dependent code from the test project #121

Merged
merged 1 commit into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions Google.Authenticator.Tests/Google.Authenticator.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ZXing.Net" Version="0.16.8" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net452'">
<PackageReference Include="ZXing.Net.Bindings.Magick" Version="0.16.9" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Google.Authenticator\Google.Authenticator.csproj" />
</ItemGroup>
Expand Down
17 changes: 0 additions & 17 deletions Google.Authenticator.Tests/QRCodeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,13 @@ private static string ExtractUrlFromQRImage(string qrCodeSetupImageUrl)
var rawImageData = qrCodeSetupImageUrl.Substring(headerLength, qrCodeSetupImageUrl.Length - headerLength);
var imageData = Convert.FromBase64String(rawImageData);

//var reader = new BarcodeReaderGeneric();
//reader.Options.PossibleFormats = new List<BarcodeFormat> {
// BarcodeFormat.QR_CODE
//};

#if NETFRAMEWORK
var reader = new BarcodeReader();
reader.Options.PossibleFormats = new List<BarcodeFormat> {
BarcodeFormat.QR_CODE
};
using (var ms = new MemoryStream(imageData))
{
var image = new System.Drawing.Bitmap(ms);
return reader.Decode(image).Text;
}
#else
var reader = new BarcodeReaderGeneric();
reader.Options.PossibleFormats = new List<BarcodeFormat> {
BarcodeFormat.QR_CODE
};
var image = new ImageMagick.MagickImage(imageData);
var wrappedImage = new ZXing.Magick.MagickImageLuminanceSource(image);
return reader.Decode(wrappedImage).Text;
#endif
}
}
}