diff --git a/KeeTrayTOTP/Libraries/QRCoder/QRCodeGenerator.cs b/KeeTrayTOTP/Libraries/QRCoder/QRCodeGenerator.cs index c5586fd..dd1c9a8 100644 --- a/KeeTrayTOTP/Libraries/QRCoder/QRCodeGenerator.cs +++ b/KeeTrayTOTP/Libraries/QRCoder/QRCodeGenerator.cs @@ -788,18 +788,13 @@ private Polynom ConvertToDecNotation(Polynom poly) private int GetVersion(int length, EncodingMode encMode, ECCLevel eccLevel) { - return this.capacityTable.Where( - x => x.Details.Count( - y => (y.ErrorCorrectionLevel == eccLevel - && y.CapacityDict[encMode] >= Convert.ToInt32(length) - ) - ) > 0 - ).Select(x => new - { - version = x.Version, - capacity = x.Details.Single(y => y.ErrorCorrectionLevel == eccLevel) - .CapacityDict[encMode] - }).Min(x => x.version); + return this.capacityTable + .Where(x => x.Details.Any(y => y.ErrorCorrectionLevel == eccLevel && y.CapacityDict[encMode] >= Convert.ToInt32(length))) + .Select(x => new + { + version = x.Version, + capacity = x.Details.Single(y => y.ErrorCorrectionLevel == eccLevel).CapacityDict[encMode] + }).Min(x => x.version); } private EncodingMode GetEncodingFromPlaintext(string plainText, bool forceUtf8) @@ -914,7 +909,7 @@ private int GetCountIndicatorLength(int version, EncodingMode encMode) return 11; case EncodingMode.Byte: return 16; - default: + default: return 10; } }