private void DataEncodeTestOneDataRow(string inputString, IEnumerable <bool> expected) { EncodationStruct eStruct = DataEncode.Encode(inputString, ErrorCorrectionLevel.H); IEnumerable <bool> actualResult = eStruct.DataCodewords; BitVectorTestExtensions.CompareIEnumerable(actualResult, expected, "string"); }
private void TestOneCase(string inputString, ErrorCorrectionLevel eclevel, IEnumerable <bool> expected) { EncodationStruct encodeStruct = DataEncode.Encode(inputString, eclevel); IEnumerable <bool> actualResult = ECGenerator.FillECCodewords(encodeStruct.DataCodewords, encodeStruct.VersionDetail); BitVectorTestExtensions.CompareIEnumerable(actualResult, expected, "string"); }
private static BitMatrix ProcessEncodationResult(EncodationStruct encodeStruct, ErrorCorrectionLevel errorLevel) { BitList codewords = ECGenerator.FillECCodewords(encodeStruct.DataCodewords, encodeStruct.VersionDetail); TriStateMatrix triMatrix = new TriStateMatrix(encodeStruct.VersionDetail.MatrixWidth); PositioninngPatternBuilder.EmbedBasicPatterns(encodeStruct.VersionDetail.Version, triMatrix); triMatrix.EmbedVersionInformation(encodeStruct.VersionDetail.Version); triMatrix.EmbedFormatInformation(errorLevel, new Pattern0()); triMatrix.TryEmbedCodewords(codewords); return(triMatrix.GetLowestPenaltyMatrix(errorLevel)); }
/// <summary> /// Encodes the specified content. /// </summary> /// <param name="content">The content.</param> /// <param name="errorLevel">The error level.</param> /// <returns></returns> /// <remarks></remarks> internal static BitMatrix Encode(string content, ErrorCorrectionLevel errorLevel) { EncodationStruct encodeStruct = DataEncode.Encode(content, errorLevel); BitList codewords = ECGenerator.FillECCodewords(encodeStruct.DataCodewords, encodeStruct.VersionDetail); var triMatrix = new TriStateMatrix(encodeStruct.VersionDetail.MatrixWidth); PositioninngPatternBuilder.EmbedBasicPatterns(encodeStruct.VersionDetail.Version, triMatrix); triMatrix.EmbedVersionInformation(encodeStruct.VersionDetail.Version); triMatrix.EmbedFormatInformation(errorLevel, new Pattern0()); triMatrix.TryEmbedCodewords(codewords); return(triMatrix.GetLowestPenaltyMatrix(errorLevel)); }
private void Encode(string content, int option) { ErrorCorrectionLevel errorLevel = ErrorCorrectionLevel.H; EncodationStruct encodeStruct = DataEncode.Encode(content, errorLevel); BitList codewords = ECGenerator.FillECCodewords(encodeStruct.DataCodewords, encodeStruct.VersionDetail); if (option == 3) { return; } TriStateMatrix triMatrix = new TriStateMatrix(encodeStruct.VersionDetail.MatrixWidth); PositioninngPatternBuilder.EmbedBasicPatterns(encodeStruct.VersionDetail.Version, triMatrix); triMatrix.EmbedVersionInformation(encodeStruct.VersionDetail.Version); triMatrix.EmbedFormatInformation(errorLevel, new Pattern0()); triMatrix.TryEmbedCodewords(codewords); triMatrix.GetLowestPenaltyMatrix(errorLevel); }
internal static BitMatrix Encode(IEnumerable <byte> content, ErrorCorrectionLevel errorLevel) { EncodationStruct encodeStruct = DataEncode.Encode(content, errorLevel); return(ProcessEncodationResult(encodeStruct, errorLevel)); }
internal static BitMatrix Encode(string content, ErrorCorrectionLevel errorLevel, MaskPatternType maskPatternType) { EncodationStruct encodeStruct = DataEncode.Encode(content, errorLevel); return(ProcessEncodationResult(encodeStruct, errorLevel, maskPatternType)); }