Beispiel #1
0
    public int prDisconnect()
    {
        /* Closing the device */
        while (_pr != null)
        {
            try
            {
                if (_doc != null)
                {
                    _doc.Free();
                }

                _pr.ResetDocument();

                _pr.CloseDevice();
                _pr.Dispose();
                _pr = null;

                break;
            }
            catch (Exception)
            {
                //if (gxSystem.GetErrorCode() == (int)GX_ERROR_CODES.GX_EBUSY)
                continue;
            }
        }
        return(0);
    }
Beispiel #2
0
        public void Passports_Should_Fail_Strict_Validation()
        {
            var passports = PassportReader.ReadPassports(InvalidData);

            var validPassports = passports.Count(x => x.IsValid(true));

            // all passports should be invalid
            validPassports.Should().Be(0);
        }
Beispiel #3
0
        public void Passports_Should_Pass_Strict_Validation()
        {
            var passports = PassportReader.ReadPassports(ValidData).ToArray();

            var validPassports = passports.Count(x => x.IsValid(true));

            // all passports should be valid
            validPassports.Should().Be(passports.Length);
        }
Beispiel #4
0
    public int prConnect()
    {
        if (_helper == null)
        {
            _helper = new Helper();
        }

        try
        {
            /* Opening the PR system */
            _pr = new PassportReader(); /* Object for the PR system */

/*
 *          if (_pr.TestPowerState() != 0)
 *          {
 *              ErrorMessage = "The power is off";
 *              return -1;
 *          }
 */
            /* Validity check */
            if (!_pr.IsValid())
            {
                ErrorMessage = "Failed to initialize!";
                return(1303);
            }

            /* Connecting to the first device */
            _pr.UseDevice(0, (int)PR_USAGEMODE.PR_UMODE_FULL_CONTROL);
        }
        catch (gxException e)
        {
            return(_helper.GetErrorMessage(e, out _errorMessage));
        }
        catch (Exception e)
        {
            _errorMessage = e.Message + " --- prConnect()";
            return(1305);
        }

        return(0);
    }
Beispiel #5
0
        }                                      //No MRZ mais visiteurid pour scan de la pièce

        #region Contructeur
        public ScannerPiece()
        {
            pr = new PassportReader();

            visiteurID = "";

            if (!pr.IsValid())
            {
                throw new InvalidProgramException("Lecteur non prêt.");
            }
            else
            {
                try
                {
                    pr.UseDevice(0, (int)PR_USAGEMODE.PR_UMODE_FULL_CONTROL);
                }
                catch (Exception ex)
                {
                    Program.LogFich.Error(ex.ToString());
                    MessageBox.Show("Lecteur ARH non prêt.");
                    //throw new InvalidProgramException("Lecteur non prêt.");
                }
            }
        }
    public int prDisconnect()
    {
        /* Closing the device */
        while (_pr != null)
        {
            try
            {
                if (_doc != null)
                    _doc.Free();

                _pr.ResetDocument();

                _pr.CloseDevice();
                _pr.Dispose();
                _pr = null;

                break;
            }
            catch (Exception)
            {
                //if (gxSystem.GetErrorCode() == (int)GX_ERROR_CODES.GX_EBUSY)
                continue;
            }
        }
        return 0;
    }
    public int prConnect()
    {
        if (_helper == null)
            _helper = new Helper();

        try
        {
            /* Opening the PR system */
            _pr = new PassportReader();	/* Object for the PR system */
        /*
            if (_pr.TestPowerState() != 0)
            {
                ErrorMessage = "The power is off";
                return -1;
            }
        */
            /* Validity check */
            if (!_pr.IsValid())
            {
                ErrorMessage = "Failed to initialize!";
                return 1303;
            }

            /* Connecting to the first device */
            _pr.UseDevice(0, (int)PR_USAGEMODE.PR_UMODE_FULL_CONTROL);

        }
        catch (gxException e)
        {
            return _helper.GetErrorMessage(e, out _errorMessage);
        }
        catch (Exception e)
        {
            _errorMessage = e.Message + " --- prConnect()";
            return 1305;
        }

        return 0;
    }
Beispiel #8
0
        public void Should_Map_Passports()
        {
            var passports = PassportReader.ReadPassports(Data).ToArray();

            passports.Should().HaveCount(4);
        }