Exemplo n.º 1
0
        protected override string GetEncoding(string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                return(string.Empty);
            }
            if (this.Checksum)
            {
                value += Code11.GetChecksum(value);
            }
            if (!value.StartsWith(Code11.Prefix))
            {
                value = Code11.Prefix + value;
            }
            if (!value.EndsWith(Code11.Suffix))
            {
                value += Code11.Suffix;
            }
            StringBuilder stringBuilder = new StringBuilder();

            for (int index = 0; index < value.Length; ++index)
            {
                if (stringBuilder.Length > 0)
                {
                    stringBuilder.Append(Symbology1D.GapChar);
                }
                stringBuilder.Append(Code11.Encoding[value[index]]);
            }
            return(stringBuilder.ToString());
        }
Exemplo n.º 2
0
        private static string GetChecksum(string value)
        {
            int length = value.Length;

            value += (string)(object)Code11.GetChecksum(value, 10, 11);
            if (length >= 10)
            {
                value += (string)(object)Code11.GetChecksum(value, 9, 11);
            }
            return(value.Substring(length));
        }