IDCertNew.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. //using System;
  2. //using System.Collections.Generic;
  3. //using System.Linq;
  4. //using System.Web;
  5. //using System.Runtime.InteropServices;
  6. //using System.Threading;
  7. //using System.Text;
  8. //namespace EmisTerminal.EIF
  9. //{
  10. // public class IDCertNew
  11. // {
  12. // #region 民族表
  13. // static public string[] Nation = {"无",
  14. // "汉族","蒙古族","回族","藏族","维吾尔族",
  15. // "苗族","彝族","壮族","布依族","朝鲜族",
  16. // "满族",
  17. // "侗族",
  18. // "瑶族",
  19. // "白族",
  20. // "土家族",
  21. // "哈尼族",
  22. // "哈萨克族",
  23. // "傣族",
  24. // "黎族",
  25. // "傈僳族",
  26. // "佤族",
  27. // "畲族",
  28. // "高山族",
  29. // "拉祜族",
  30. // "水族",
  31. // "东乡族",
  32. // "纳西族",
  33. // "景颇族",
  34. // "柯尔克孜族",
  35. // "土族",
  36. // "达斡尔族",
  37. // "仫佬族",
  38. // "羌族",
  39. // "布朗族",
  40. // "撒拉族",
  41. // "毛难族",
  42. // "仡佬族",
  43. // "锡伯族",
  44. // "阿昌族",
  45. // "普米族",
  46. // "塔吉克族",
  47. // "怒族",
  48. // "乌孜别克",
  49. // "俄罗斯族",
  50. // "鄂温克族",
  51. // "崩龙族",
  52. // "保安族",
  53. // "裕固族",
  54. // "京族",
  55. // "塔塔尔族",
  56. // "独龙族",
  57. // "鄂伦春族",
  58. // "赫哲族",
  59. // "门巴族",
  60. // "珞巴族",
  61. // "其它",
  62. // "外国血统"};
  63. // #endregion
  64. // #region 导入函数
  65. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  66. // public static extern int InitComm(int port);
  67. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  68. // public static extern int InitCommExt();
  69. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  70. // public static extern int CloseComm();
  71. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  72. // public static extern int Authenticate();
  73. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  74. // public static extern int Read_Content(int active);
  75. // [DllImport("termb.dll", CharSet = CharSet.Ansi)]
  76. // public static extern int Read_Content_Path(string path, int active);
  77. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  78. // public static extern unsafe int GetSAMID(ref byte id);
  79. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  80. // public static extern int GetRFID(ref UInt32 id);
  81. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  82. // public static extern void LedOnOff(Int32 ledid, bool onoff);
  83. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  84. // public static extern void BuzzerOnOff(int onoff);
  85. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  86. // public static extern unsafe bool GetName2(ref byte sName, ref int nLen);
  87. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  88. // public static extern unsafe bool GetSex2(ref byte sBuf, ref int nLen);
  89. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  90. // public static extern unsafe bool GetNation2(ref byte sBuf, ref int nLen);
  91. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  92. // public static extern unsafe bool GetBornDate2(ref byte sBuf, ref int nLen);
  93. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  94. // public static extern unsafe bool GetAddress2(ref byte sBuf, ref int nLen);
  95. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  96. // public static extern unsafe bool GetIDNo2(ref byte sBuf, ref int nLen);
  97. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  98. // public static extern unsafe bool GetSignGov2(ref byte sBuf, ref int nLen);
  99. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  100. // public static extern unsafe bool GetStartDate2(ref byte sBuf, ref int nLen);
  101. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  102. // public static extern unsafe bool GetEndDate2(ref byte sBuf, ref int nLen);
  103. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  104. // public static extern unsafe bool GetNewAddress2(ref byte sBuf, ref int nLen);
  105. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  106. // public static extern unsafe int TransApduCommand(int nReaderSlot, ref byte pSendDatas, int nSendLen, ref byte pRecvDatas, ref int nRecvLen);
  107. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  108. // public static extern unsafe int ResetCard(int nReaderSlot, ref byte pRecvDatas, ref int nRecvLen);
  109. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  110. // public static extern unsafe bool GetFingerPrint2(ref byte sBuf, ref int nLen);
  111. // [DllImport("termb.dll", CharSet = CharSet.Ansi)]
  112. // public static extern unsafe bool MakeIDCardImages(string sHead, string sIDCardImagePath);
  113. // //外国人永久居住证
  114. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  115. // public static extern unsafe int IsFPRIDCard();//是否是外国人居住证
  116. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  117. // public static extern unsafe bool GetFPR_ENName2(ref byte sBuf, ref int nLen);//英文名
  118. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  119. // public static extern unsafe bool GetFPR_SEX2(ref byte sBuf, ref int nLen);//性别
  120. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  121. // public static extern unsafe bool GetFPR_IDNo2(ref byte sBuf, ref int nLen);//身份证号
  122. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  123. // public static extern unsafe bool GetFPR_NationCode2(ref byte sBuf, ref int nLen);//国籍代码
  124. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  125. // public static extern unsafe bool GetFPR_Nation2(ref byte sBuf, ref int nLen);//国籍代码中文()
  126. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  127. // public static extern unsafe bool GetFPR_CHNName2(ref byte sBuf, ref int nLen);//中文姓名
  128. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  129. // public static extern unsafe bool GetFPR_ValidStartDate2(ref byte sBuf, ref int nLen);//证件签发时间
  130. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  131. // public static extern unsafe bool GetFPR_ValidEndDate2(ref byte sBuf, ref int nLen);//证件终止时间
  132. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  133. // public static extern unsafe bool GetFPR_Birthday2(ref byte sBuf, ref int nLen);//出生日期
  134. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  135. // public static extern unsafe bool GetFPR_IDVersion2(ref byte sBuf, ref int nLen);//证件版本号
  136. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  137. // public static extern unsafe bool GetFPR_IssuingAuthorityCode2(ref byte sBuf, ref int nLen);//当次申请受理机关代码
  138. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  139. // public static extern unsafe bool GetFPR_IDType2(ref byte sBuf, ref int nLen);//证件类型标识
  140. // //---------------------------------------------------------------------------
  141. // //港澳台居民居住证相关函数
  142. // //---------------------------------------------------------------------------
  143. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  144. // public static extern unsafe int IsGATIDCard();//是否港澳台居民居住证
  145. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  146. // public static extern unsafe bool GetGAT_Name2(ref byte sBuf, ref int nLen);//姓名
  147. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  148. // public static extern unsafe bool GetGAT_SEX2(ref byte sBuf, ref int nLen);//性别
  149. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  150. // public static extern unsafe bool GetGAT_SEXCode2(ref byte sBuf, ref int nLen);//性别代码
  151. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  152. // public static extern unsafe bool GetGAT_Address2(ref byte sBuf, ref int nLen);//详细地址
  153. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  154. // public static extern unsafe bool GetGAT_IDNo2(ref byte sBuf, ref int nLen);//公民身份证号码
  155. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  156. // public static extern unsafe bool GetGAT_IssuingAuthority2(ref byte sBuf, ref int nLen);//签发机关
  157. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  158. // public static extern unsafe bool GetGAT_ValidStartDate2(ref byte sBuf, ref int nLen);//有效起始日期
  159. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  160. // public static extern unsafe bool GetGAT_ValidEndDate2(ref byte sBuf, ref int nLen);//有效截至日期
  161. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  162. // public static extern unsafe bool GetGAT_PassportNo2(ref byte sBuf, ref int nLen);//通行证号码(
  163. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  164. // public static extern unsafe bool GetGAT_IssuanceCount2(ref byte sBuf, ref int nLen);//签发次数
  165. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  166. // public static extern unsafe bool GetGAT_IDType2(ref byte sBuf, ref int nLen);//证件类型标识(2B),大写字母J
  167. // [DllImport("termb.dll", CharSet = CharSet.Auto)]
  168. // public static extern unsafe bool IsVerifyKey();
  169. // #endregion
  170. // public static string GetSAMNo()
  171. // {
  172. // byte[] bySAMID = new byte[100];
  173. // int nRet = IDCertNew.GetSAMID(ref bySAMID[0]);
  174. // if (nRet == 0)
  175. // return System.Text.Encoding.GetEncoding("GB2312").GetString(bySAMID);
  176. // return string.Empty;
  177. // }
  178. // #region 工具函数
  179. // public static byte[] StrToByteArray(string str)
  180. // {
  181. // ASCIIEncoding encoding = new ASCIIEncoding();
  182. // return encoding.GetBytes(str);
  183. // }
  184. // public static string ByteArrayToStr(byte[] barr)
  185. // {
  186. // System.Text.UnicodeEncoding encoding = new UnicodeEncoding();
  187. // return encoding.GetString(barr);
  188. // }
  189. // #endregion
  190. // }
  191. //}