Пример #1
0
 public static bool[] Code(QRCodeServiceInformation.CorrectionLvl clvl, int mask)
 {
     bool[] code = new bool[15];
     for (int i = 0; i < code.Length; i++)
     {
         code[i] = table[clvl][mask][i] == '1';
     }
     return(code);
 }
Пример #2
0
 public static int BlocksAmount(int version, QRCodeServiceInformation.CorrectionLvl lvl) => table[lvl][version - 1];
 public static QRCodeServiceInformation GetServiceInformationForDataLength(int PayloadLength, QRCodeServiceInformation.CorrectionLvl correctionLvl)
 {
     for (int version = 0; version < 40; version++)
     {
         if (table[correctionLvl][version] >= PayloadLength + 4 + ((version + 1) <= 9 ? 8 : 16))//4 - способ кодирования, 8 или 16 - длина количества информации, 8(если версия <10)
         {
             return new QRCodeServiceInformation()
                    {
                        Lvl = correctionLvl, Version = version + 1
                    }
         }
     }
     ;
     throw new Exception();
 }