コード例 #1
0
 public static bool IsValidLength(string mrzLine)
 {
     if (string.IsNullOrEmpty(mrzLine))
     {
         return(false);
     }
     return(MrzFormat.FindByLength(mrzLine) != null);
 }
コード例 #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 });
 }
コード例 #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 });
 }
コード例 #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");
        }
コード例 #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");
        }
コード例 #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));
        }