示例#1
0
        /// <summary>
        /// Pasori PC/SCの利用可否
        /// </summary>
        /// <returns>T:利用可能</returns>
        public static bool CheckPcsc()
        {
            //RC-S380以降
            IntPtr context = IntPtr.Zero;

            if (WinSCard.EstablishContext(ref context))
            {
                String readerName = WinSCard.ListReaders(context);
                WinSCard.ReleaseContext(context);

                if (readerName != null)
                {
                    Regex ver = new Regex("PaSoRi\\s+([0-9]+(\\.[0-9]+)*)", RegexOptions.IgnoreCase);
                    Match m   = ver.Match(readerName);
                    if (m.Success)
                    {
                        String verStr = m.Groups[1].Value;
                        if (float.Parse(verStr) >= 3.0f)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
示例#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);
        }