Example #1
0
 /// <summary>
 /// カードのアクセス権を解放する
 /// </summary>
 public void StopAccess()
 {
     if (cardContext != IntPtr.Zero)
     {
         WinSCard.Disconnect(cardContext, 0);
         cardContext = IntPtr.Zero;
     }
 }
Example #2
0
        /// <summary>
        /// ライブラリの解放
        /// (DisposeLibraryを実行した場合、次の利用では再びInitializeLibraryを実行する)
        /// </summary>
        /// <returns></returns>
        public bool DisposeLibrary()
        {
            if (cardContext != IntPtr.Zero)
            {
                WinSCard.Disconnect(cardContext, 0);
                cardContext = IntPtr.Zero;
            }

            if (rwContext != IntPtr.Zero)
            {
                WinSCard.ReleaseContext(rwContext);
                rwContext = IntPtr.Zero;
            }
            res = cmd = authKey = null;
            Debug.WriteLine("PcscReader Disposed!");
            return(true);
        }