borepin/NFC/Readers/PCSC/PCSC_Hardware.cs

34 lines
714 B
C#
Raw Normal View History

2020-09-15 15:27:01 +02:00
using PCSC;
namespace NFC.Readers.PCSC
{
2020-11-07 01:14:51 +01:00
public class PCSC_Hardware : IHardware
2020-09-15 15:27:01 +02:00
{
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)
{
2020-11-07 01:14:51 +01:00
return new PCSC_Reader(readerID);
2020-09-15 15:27:01 +02:00
}
}
}