public static VersionTableTestProperties GetVersionInfo(int versionNum, ErrorCorrectionLevel level) { Version version = VersionTable.GetVersionByNum(versionNum); int totalNumCodewords = version.TotalCodewords; ErrorCorrectionBlocks ecBlocks = version.GetECBlocksByLevel(level); int numECCodewords = ecBlocks.NumErrorCorrectionCodewards; string ecBlockString = ErrorCorrectionBlocksToString(ecBlocks); return(new VersionTableTestProperties(versionNum, totalNumCodewords, level, numECCodewords, ecBlockString)); }
private static VersionControlStruct FillVCStruct(int versionNum, ErrorCorrectionLevel level, string encodingName) { if (versionNum < 1 || versionNum > 40) { throw new InvalidOperationException(string.Format("Unexpected version number: {0}", versionNum)); } VersionControlStruct vcStruct = new VersionControlStruct(); int version = versionNum; QRCodeVersion versionData = VersionTable.GetVersionByNum(versionNum); int numTotalBytes = versionData.TotalCodewords; ErrorCorrectionBlocks ecBlocks = versionData.GetECBlocksByLevel(level); int numDataBytes = numTotalBytes - ecBlocks.NumErrorCorrectionCodewards; int numECBlocks = ecBlocks.NumBlocks; VersionDetail vcDetail = new VersionDetail(version, numTotalBytes, numDataBytes, numECBlocks); vcStruct.VersionDetail = vcDetail; return(vcStruct); }
private static VersionControlStruct FillVCStruct(int versionNum, ErrorCorrectionLevel level) { if (versionNum is < 1 or > 40) { throw new InvalidOperationException($"Unexpected version number: {versionNum}"); } VersionControlStruct vcStruct = new(); int version = versionNum; QRCodeVersion versionData = VersionTable.GetVersionByNum(versionNum); int numTotalBytes = versionData.TotalCodewords; ErrorCorrectionBlocks ecBlocks = versionData.GetECBlocksByLevel(level); int numDataBytes = numTotalBytes - ecBlocks.NumErrorCorrectionCodewards; int numECBlocks = ecBlocks.NumBlocks; VersionDetail vcDetail = new(version, numTotalBytes, numDataBytes, numECBlocks); vcStruct.VersionDetail = vcDetail; return vcStruct; }