Exemplo n.º 1
0
 public static bool IsValidLength(string mrzLine)
 {
     if (string.IsNullOrEmpty(mrzLine))
     {
         return(false);
     }
     return(MrzFormat.FindByLength(mrzLine) != null);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes the <see cref="MrzFormat"/> class.
 /// </summary>
 static MrzFormat()
 {
     Id1 = new MrzFormat(Id1FormatName, 3, 30);
     Id2 = new MrzFormat(Id2FormatName, 2, 36);
     Id3 = new MrzFormat(Id3FormatName, 2, 44);
     formats = new List<MrzFormat>();
     formats.AddRange(new[] { Id1, Id2, Id3 });
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes the <see cref="MrzFormat"/> class.
 /// </summary>
 static MrzFormat()
 {
     Id1     = new MrzFormat(Id1FormatName, 3, 30);
     Id2     = new MrzFormat(Id2FormatName, 2, 36);
     Id3     = new MrzFormat(Id3FormatName, 2, 44);
     formats = new List <MrzFormat>();
     formats.AddRange(new[] { Id1, Id2, Id3 });
 }
Exemplo n.º 4
0
        private static MrzParser Create(string mrz, MrzFormat format)
        {
            switch (format.Name)
            {
                case MrzFormat.Id1FormatName: return new Id1Parser(mrz);
                case MrzFormat.Id2FormatName: return new Id2Parser(mrz);
                case MrzFormat.Id3FormatName: return new Id3Parser(mrz);
            }

            throw new ArgumentException(string.Format("Mrz Format '{0}' is unknown", format), "format");
        }
Exemplo n.º 5
0
        private static MrzParser Create(string mrz, MrzFormat format)
        {
            switch (format.Name)
            {
            case MrzFormat.Id1FormatName: return(new Id1Parser(mrz));

            case MrzFormat.Id2FormatName: return(new Id2Parser(mrz));

            case MrzFormat.Id3FormatName: return(new Id3Parser(mrz));
            }

            throw new ArgumentException(string.Format("Mrz Format '{0}' is unknown", format), "format");
        }
Exemplo n.º 6
0
        public static MrzParser Create(string mrz)
        {
            if (string.IsNullOrEmpty(mrz))
            {
                throw new ArgumentNullException("mrz");
            }
            var format = MrzFormat.FindByTotalLength(mrz);

            if (format == null)
            {
                throw new ArgumentException("Could not determine Mrz Format given the specified mrz value.", "mrz");
            }
            return(Create(mrz, format));
        }