Beispiel #1
0
        private void EncodeTextCompleteString(string text)
        {
            TextMode textMode = new TextMode();

            text = PDF417.ValidateText(text);
            this.encodedRawData.AddRange((IEnumerable <long>)textMode.EncodeData(text, false));
        }
Beispiel #2
0
        internal TextModeDefinitionEntry GetNextValidCharacter(
            string remainingData)
        {
            TextModeDefinitionEntry characterInTable = TextMode.FindCharacterInTable((int)remainingData[0]);

            if (characterInTable != null || remainingData.Length <= 1)
            {
                return(characterInTable);
            }
            remainingData = remainingData.Substring(1);
            return(this.GetNextValidCharacter(remainingData));
        }
Beispiel #3
0
        private static string ValidateText(string text)
        {
            string empty = string.Empty;

            for (int index = 0; index < text.Length; ++index)
            {
                if (TextMode.FindCharacterInTable((int)text[index]) != null)
                {
                    empty += (string)(object)text[index];
                }
            }
            return(empty);
        }
Beispiel #4
0
        private void EncodeText(string text, ref int dataIndex, int numberOfTexModeCharsAtPosition)
        {
            TextMode textMode   = new TextMode();
            int      startIndex = dataIndex + numberOfTexModeCharsAtPosition;
            bool     shouldApplyNonLatchData = false;

            if (startIndex < text.Length - 1)
            {
                PDF417.DetermineNextMode(text.Substring(startIndex), ref shouldApplyNonLatchData);
            }
            this.encodedRawData.Add(900L);
            this.encodedRawData.AddRange((IEnumerable <long>)textMode.EncodeData(text.Substring(dataIndex, numberOfTexModeCharsAtPosition), shouldApplyNonLatchData));
            dataIndex += numberOfTexModeCharsAtPosition;
        }
Beispiel #5
0
 internal void PadData(bool shouldApplyNonLatchData)
 {
     if (shouldApplyNonLatchData)
     {
         if (this.CurrentSymbolSubmode != TextSubMode.Punctuation)
         {
             this.formattedDataInt.Add((long)TextMode.FindCharacterInTable(1006).RowIndex);
         }
         else
         {
             this.formattedDataInt.Add((long)TextMode.FindCharacterInTable(1001).RowIndex);
         }
     }
     else
     {
         this.formattedDataInt.Add((long)TextMode.FindCharacterInTable(1005).RowIndex);
     }
 }
Beispiel #6
0
        private static int GetNumberOfCharsAtPosition(string text, int currentPosition)
        {
            int num = 0;

            while (currentPosition <= text.Length - 1 && PDF417.GetNumberOfDigitsAtPosition(text, currentPosition) < 13 && TextMode.FindCharacterInTable((int)text[currentPosition]) != null)
            {
                ++currentPosition;
                ++num;
            }
            return(num);
        }