tijian_jichuang/Code/SOH.IDCaraRead.Potevio.IDMR02_TG/ReadCard.cs
2025-02-20 11:54:48 +08:00

137 lines
2.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
namespace SOH.IDCaraRead.Potevio.IDMR02_TG
{
public class ReadCard : SOH.Interface.IIDCardRead
{
Card2.PERSONINFOW person;
string birthday = "";
string validDate = "";
Image image = null;
const int maxErrorTextLen = 32;
public DateTime csrq
{
get
{
throw new NotImplementedException();
}
}
public string dz
{
get
{
return person.address;
}
}
public string fzjg
{
get
{
throw new NotImplementedException();
}
}
public string mz
{
get
{
throw new NotImplementedException();
}
}
public string mzcode
{
get
{
throw new NotImplementedException();
}
}
public string sfzh
{
get
{
return person.cardId;
}
}
public string xbcode
{
get
{
throw new NotImplementedException();
}
}
public string xm
{
get
{
return person.name;
}
}
public DateTime yxqjz
{
get
{
throw new NotImplementedException();
}
}
public DateTime yxqqs
{
get
{
throw new NotImplementedException();
}
}
public int exit()
{
Int32 result;
StringBuilder errorText = new StringBuilder(maxErrorTextLen);
//读完卡后,必须关闭设备。
result = Card2.CloseCardReader();
Card2.GetErrorTextW(errorText, maxErrorTextLen);
return result;
}
public int init()
{
return Card2.OpenCardReader(0, 2, 115200);
}
public int read()
{
Int32 result;
String imagePath;
StringBuilder errorText = new StringBuilder(maxErrorTextLen);
if (image != null)
{
image.Dispose();
image = null;
}
imagePath = Path.GetTempPath() + Guid.NewGuid().ToString("N")+".bmp";
//当程序打开设备后,可以多次调用读取信息函数。
result = Card2.GetPersonMsgW(ref person, imagePath);
Card2.GetErrorTextW(errorText, maxErrorTextLen);
return result;
}
}
}