mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 23:01:52 +01:00
34 lines
704 B
C#
34 lines
704 B
C#
using PCSC;
|
|
|
|
namespace NFC.Readers.PCSC
|
|
{
|
|
public class 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 Reader(readerID);
|
|
}
|
|
}
|
|
}
|