Skip to content

Commit

Permalink
Merge pull request #438 from HolyOne/master
Browse files Browse the repository at this point in the history
Performance update on GenerateQrCode function
  • Loading branch information
codebude authored Apr 19, 2024
2 parents 295730d + 62e32a9 commit ee3a6e7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions QRCoder/QRCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,15 @@ public static QRCodeData GenerateQrCode(byte[] binaryData, ECCLevel eccLevel)
string modeIndicator = DecToBin((int)EncodingMode.Byte, 4);
string countIndicator = DecToBin(binaryData.Length, GetCountIndicatorLength(version, EncodingMode.Byte));

string bitString = modeIndicator + countIndicator;
StringBuilder sb = new StringBuilder();
sb.Append(modeIndicator).Append(countIndicator);
foreach (byte b in binaryData)
{
bitString += DecToBin(b, 8);
sb.Append(DecToBin(b, 8));

}
string bitString = sb.ToString();


return GenerateQrCode(bitString, eccLevel, version);
}
Expand Down

0 comments on commit ee3a6e7

Please sign in to comment.