Ejemplo n.º 1
0
 /// <summary>
 /// ライブラリの初期化
 /// </summary>
 public void InitializeLibrary(UseCard useCard)
 {
     //PC/SC接続を優先する
     if (PcscReader.CheckPcsc())
     {
         reader     = new PcscReader(this);
         Connection = ConnetKind.Pcsc;
     }
     else
     {
         //PC/SCが使えない場合
         if (useCard == (UseCard.Felica | UseCard.Mifare))
         {
             throw new PcscException(WinSCardError.SCARD_E_NOT_READY, null);
         }
         else if (useCard == UseCard.Mifare)
         {
             reader     = new NfcReader(this);
             Connection = ConnetKind.Nfc;
         }
         else
         {
             reader     = new FelicaReader(this);
             Connection = ConnetKind.Felica;
         }
     }
     reader.InitializeLibrary();
     this.useCard = useCard;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// ライブラリの解放
        /// (DisposeLibraryを実行した場合、次の利用では再びInitializeLibraryを実行する)
        /// </summary>
        /// <returns></returns>
        public bool DisposeLibrary()
        {
            bool res = true;

            if (reader != null)
            {
                reader.DisposeLibrary();
                reader     = null;
                Connection = ConnetKind.None;
            }

            return(res);
        }