Hanson.SmartCardReader 2.0.0

dotnet add package Hanson.SmartCardReader --version 2.0.0                
NuGet\Install-Package Hanson.SmartCardReader -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hanson.SmartCardReader" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Hanson.SmartCardReader --version 2.0.0                
#r "nuget: Hanson.SmartCardReader, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Hanson.SmartCardReader as a Cake Addin
#addin nuget:?package=Hanson.SmartCardReader&version=2.0.0

// Install Hanson.SmartCardReader as a Cake Tool
#tool nuget:?package=Hanson.SmartCardReader&version=2.0.0                

README

Hanson.SmartCardReader

主要功能

  1. 取得系統所有讀卡機資訊
  2. 提供讀取晶片卡廠商資訊
  3. 提供讀取特定卡片資訊

前置條件

  • 開發環境需具備 NET 472 or NET 462
  • 運行於 Windows Platform (x86, x64)

安裝方式

授權

此專案採用的 License為 Apache-2.0

使用範例

命名空間

using Hanson.SmartCardReader;
  • 取得所有讀卡機 相關使用範例
private void Sample()
{
   string[] readers = CardReaderFactory.GetReaderList();
   if (readers.Length == 0)
   {
       Console.WriteLine("未插入讀卡機");
   }
   else
   {
       foreach (var item in readers)
       {
             Console.WriteLine($"讀卡機{item}");
       }
   }

}
  • 讀取卡片資訊相關使用範例
private void Sample()
{
    string readerName = "Generic Smart Card Reader Interface 0";
    using (var reader = CardReaderFactory.CreateInstance(SmartCardType.HealthCardTw, readerName))
    {
        reader.Start();
        reader.OnCardInsertedEvent += (x) =>
        {
            var infos = reader.GetCardInfo();
            Console.WriteLine(infos.ToJsonSerialize());
        };
        reader.OnCardRemovedEvent += (x) =>
        {
            Console.WriteLine($"Reader:{x} 移出卡片");
        };
        Console.ReadKey();
    }
}
Product Compatible and additional computed target framework versions.
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 138 4/16/2024