mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-13 23:31:48 +01:00
34 lines
714 B
C#
34 lines
714 B
C#
using PCSC;
|
|
|
|
namespace NFC.Readers.PCSC
|
|
{
|
|
public class PCSC_Hardware : IHardware
|
|
{
|
|
public string[] GetReaders()
|
|
{
|
|
var contextFactory = ContextFactory.Instance;
|
|
using (var context = contextFactory.Establish(SCardScope.System))
|
|
{
|
|
return context.GetReaders();
|
|
}
|
|
}
|
|
|
|
public bool IsAvailable()
|
|
{
|
|
if(GetReaders().Length == 0)
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public IReader OpenReader(string readerID)
|
|
{
|
|
return new PCSC_Reader(readerID);
|
|
}
|
|
}
|
|
}
|