Exemple #1
0
            public override bool Parse()
            {
                try
                {
                    var l1 = Mrz.Substring(0, 44);
                    var l2 = Mrz.Substring(44);

                    array = new string[] { l1, l2 };

                    AddComponent(MrzComponentCode.DocumentCode, l1.Substring(0, 2));
                    AddComponent(MrzComponentCode.IssuingState, l1.Substring(2, 3));
                    AddComponent(MrzComponentCode.Name, l1.Substring(5, 39));

                    AddComponent(MrzComponentCode.DocumentNumber, l2.Substring(0, 9));
                    AddComponent(MrzComponentCode.DocumentNumberCheckDigit, l2.Substring(9, 1));
                    AddComponent(MrzComponentCode.Nationality, l2.Substring(10, 3));
                    AddComponent(MrzComponentCode.DateOfBirth, l2.Substring(13, 6));
                    AddComponent(MrzComponentCode.DateOfBirthCheckDigit, l2.Substring(19, 1));
                    AddComponent(MrzComponentCode.Sex, l2.Substring(20, 1));
                    AddComponent(MrzComponentCode.DateOfExpiry, l2.Substring(21, 6));
                    AddComponent(MrzComponentCode.DateOfExpiryCheckDigit, l2.Substring(27, 1));
                    AddComponent(MrzComponentCode.OptionalData, l2.Substring(28, 14));
                    AddComponent(MrzComponentCode.OptionalDataCheckDigit, l2.Substring(42, 1));
                    AddComponent(MrzComponentCode.CompositeCheckDigit, l2.Substring(43, 1));
                }
                catch (Exception ex)
                {
                    var debugException = ex;
                    return(false);
                }

                return(true);
            }
            public override bool Parse()
            {
                try
                {
                    var l1 = Mrz.Substring(0, 30);
                    var l2 = Mrz.Substring(30, 30);
                    var l3 = Mrz.Substring(60);

                    array = new string[] { l1, l2, l3 };

                    AddComponent(MrzComponentCode.DocumentCode, l1.Substring(0, 2));
                    AddComponent(MrzComponentCode.IssuingState, l1.Substring(2, 3));
                    AddComponent(MrzComponentCode.DocumentNumber, l1.Substring(5, 9));
                    AddComponent(MrzComponentCode.DocumentNumberCheckDigit, l1.Substring(14, 1));

                    AddComponent(MrzComponentCode.DateOfBirth, l2.Substring(0, 6));
                    AddComponent(MrzComponentCode.DateOfBirthCheckDigit, l2.Substring(6, 1));
                    AddComponent(MrzComponentCode.Sex, l2.Substring(7, 1));
                    AddComponent(MrzComponentCode.DateOfExpiry, l2.Substring(8, 6));
                    AddComponent(MrzComponentCode.DateOfExpiryCheckDigit, l2.Substring(14, 1));
                    AddComponent(MrzComponentCode.Nationality, l2.Substring(15, 3));

                    AddComponent(MrzComponentCode.Name, l3);
                }
                catch (Exception ex)
                {
                    var debugException = ex;
                    return(false);
                }

                return(true);
            }
Exemple #3
0
            public override bool Parse()
            {
                try
                {
                    var l1 = Mrz.Substring(0, 36);
                    var l2 = Mrz.Substring(36);

                    array = new string[] { l1, l2 };
                }
                catch (Exception ex)
                {
                    var debugException = ex;
                    return(false);
                }

                // TODO: parsing is not complete.
                return(false);
            }