public void BeginTransaction()
 {
     try
     {
         card.BeginTransaction();
     }
     catch (SmartCardException scEx)
     {
         SmartcardFault scFault = new SmartcardFault(scEx);
         throw new FaultException<SmartcardFault>(scFault);
     }
     catch (Exception ex)
     {
         GeneralFault genFault = new GeneralFault(ex);
         throw new FaultException<GeneralFault>(genFault);
     }
 }
 public void Disconnect(DISCONNECT disposition)
 {
     try
     {
         card.Disconnect(disposition);
     }
     catch (SmartCardException scEx)
     {
         SmartcardFault scFault = new SmartcardFault(scEx);
         throw new FaultException<SmartcardFault>(scFault);
     }
     catch (Exception ex)
     {
         GeneralFault genFault = new GeneralFault(ex);
         throw new FaultException<GeneralFault>(genFault);
     }
 }
 public void Connect(string reader, SHARE shareMode, PROTOCOL preferredProtocols)
 {
     try
     {
         card.Connect(reader, shareMode, preferredProtocols);
     }
     catch (SmartCardException scEx)
     {
         SmartcardFault scFault = new SmartcardFault(scEx);
         throw new FaultException<SmartcardFault>(scFault);
     }
     catch (Exception ex)
     {
         GeneralFault genFault = new GeneralFault(ex);
         throw new FaultException<GeneralFault>(genFault);
     }
 }
        public APDUResponse Transmit(APDUCommand apduCmd)
        {
            try
            {
                Core.Smartcard.APDUCommand apduCommand = new Core.Smartcard.APDUCommand(
                    apduCmd.Class,
                    apduCmd.Ins,
                    apduCmd.P1,
                    apduCmd.P2,
                    (apduCmd.Data == null || apduCmd.Data.Length == 0) ? null : apduCmd.Data,
                    apduCmd.Le);

                Core.Smartcard.APDUResponse apduResponse = card.Transmit(apduCommand);

                return new APDUResponse()
                {
                    Data = apduResponse.Data,
                    SW1 = apduResponse.SW1,
                    SW2 = apduResponse.SW2
                };
            }
            catch (SmartCardException scEx)
            {
                SmartcardFault scFault = new SmartcardFault(scEx);
                throw new FaultException<SmartcardFault>(scFault);
            }
            catch (Exception ex)
            {
                GeneralFault genFault = new GeneralFault(ex);
                throw new FaultException<GeneralFault>(genFault);
            }
        }
 public string[] ListReaders()
 {
     try
     {
         return card.ListReaders();
     }
     catch (SmartCardException scEx)
     {
         SmartcardFault scFault = new SmartcardFault(scEx);
         throw new FaultException<SmartcardFault>(scFault);
     }
     catch (Exception ex)
     {
         GeneralFault genFault = new GeneralFault(ex);
         throw new FaultException<GeneralFault>(genFault);
     }
 }
 public byte[] GetAttribute(uint attribId)
 {
     try
     {
         return card.GetAttribute(attribId); ;
     }
     catch (SmartCardException scEx)
     {
         SmartcardFault scFault = new SmartcardFault(scEx);
         throw new FaultException<SmartcardFault>(scFault);
     }
     catch (Exception ex)
     {
         GeneralFault genFault = new GeneralFault(ex);
         throw new FaultException<GeneralFault>(genFault);
     }
 }