Beispiel #1
0
        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");
        }
Beispiel #3
0
        internal static BitMatrix Encode(string content, ErrorCorrectionLevel errorLevel)
        {
            EncodationStruct encodeStruct = DataEncode.Encode(content, 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));
        }
Beispiel #4
0
        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));
        }