資源簡介
創(chuàng)自CRT_310讀卡器Demo源碼 包含大部分主要的操作,如:進(jìn)卡、退卡、讀磁條、IC卡讀卡、APDU發(fā)送等等

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Globalization;
using?System.Linq;
using?System.Runtime.InteropServices;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
namespace?CardTest
{
????public?partial?class?Form1?:?Form
????{
????????int?ComFlag?=?0;
????????byte?CPUType?=?2;
????????#region?DLL
????????//打開串口
????????[DllImport(“CRT_310.dll“)]
????????public?static?extern?int?CommOpen(string?port);
????????//關(guān)閉串口
????????[DllImport(“CRT_310.dll“)]
????????public?static?extern?int?CommClose(int?ComHandle);
????????//復(fù)位讀卡機(jī)//0x00=不彈卡?0x01=前端彈卡?0x02=后端彈卡
????????[DllImport(“CRT_310.dll“)]
????????public?static?extern?int?CRT310_Reset(int?ComHandle?byte?_Eject);
????????//停卡位置
????????[DllImport(“CRT_310.dll“)]
????????public?static?extern?int?CRT310_CardPosition(int?ComHandle?byte?_Position);
????????//移動(dòng)卡
????????[DllImport(“CRT_310.dll“)]
????????public?static?extern?int?CRT310_MovePosition(int?ComHandle?byte?_Position);
????????//進(jìn)卡控制
????????[DllImport(“CRT_310.dll“)]
????????public?static?extern?int?CRT310_CardSetting(int?ComHandle?byte?_CardIn?byte?_EnableBackIn);
????????//讀磁軌數(shù)據(jù)
????????[DllImport(“CRT_310.dll“)]
????????public?static?extern?int?MC_ReadTrack(int?ComHandle?byte?_Mode?byte?_track?ref?int?_TrackDataLen?byte[]?_TrackData);
????????//IC卡上電
????????[DllImport(“CRT_310.dll“)]
????????public?static?extern?int?CRT_IC_CardOpen(int?ComHandle);
????????//IC卡下電
????????[DllImport(“CRT_310.dll“)]
????????public?static?extern?int?CRT_IC_CardClose(int?ComHandle);
????????//檢測(cè)IC卡類型
????????[DllImport(“CRT_310.dll“)]
????????public?static?extern?int?CRT_R_DetectCard(int?ComHandle?ref?char?_CardType?ref?char?_CardInfor);
????????//CPU卡熱復(fù)位
????????[DllImport(“CRT_310.dll“)]
????????public?static?extern?int?CPU_WarmReset(int?ComHandle?ref?byte?_CPUType?byte[]?_exData?ref?int?_exdataLen);
????????//T0卡發(fā)送APDU
????????[DllImport(“CRT_310.dll“)]
????????public?static?extern?int?CPU_T0_C_APDU(int?ComHandle?int?_dataLen?byte[]?_APDUData?byte[]?_exData?ref?int?_exdataLen);
????????//T1卡發(fā)送APDU
????????[DllImport(“CRT_310.dll“)]
????????public?static?extern?int?CPU_T1_C_APDU(int?ComHandle?int?_dataLen?byte[]?_APDUData?byte[]?_exData?ref?int?_exdataLen);
????????#endregion
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?ShowMessage(string?str)//顯示信息
????????{
????????????txtShow.Text?+=?“-------------------------------\r\n“;
????????????txtShow.Text?+=?str?+?“\r\n“;
????????????txtShow.Selectionstart?=?txtShow.Text.Length;
????????????panel1.Focus();
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)//打開串口
????????{
????????????ComFlag?=?CommOpen(“COM“?+?txtCom.Text.Trim());
????????????if?(ComFlag?!=?0)
????????????????lblComStatus.Text?=
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
????..A..H.?????41984??2018-09-28?15:01??CardTest\.vs\CardTest\v14\.suo
????..A..H.?????38400??2017-06-16?19:57??CardTest\.vs\CardTest\v15\.suo
????I.A....???????184??2018-06-13?10:23??CardTest\CardTest\App.config
????I.A....?????38400??2018-07-19?08:04??CardTest\CardTest\bin\Debug\CardTest.exe
????I.A....???????184??2018-06-13?10:23??CardTest\CardTest\bin\Debug\CardTest.exe.config
????I.A....?????32256??2018-07-19?08:04??CardTest\CardTest\bin\Debug\CardTest.pdb
????I.A....?????22696??2018-09-28?15:01??CardTest\CardTest\bin\Debug\CardTest.vshost.exe
????I.A....???????184??2018-06-13?10:23??CardTest\CardTest\bin\Debug\CardTest.vshost.exe.config
????I.A....???????490??2016-07-16?19:44??CardTest\CardTest\bin\Debug\CardTest.vshost.exe.manifest
????I.A....????102400??2011-11-24?10:05??CardTest\CardTest\bin\Debug\CRT_310.dll
????I.A....??????3872??2018-06-13?10:23??CardTest\CardTest\CardTest.csproj
????I.A....?????18352??2018-07-19?08:06??CardTest\CardTest\Form1.cs
????I.A....?????21792??2018-07-18?11:17??CardTest\CardTest\Form1.Designer.cs
????I.A....??????5817??2018-07-18?10:59??CardTest\CardTest\Form1.resx
????I.A....?????16958??2017-06-14?16:41??CardTest\CardTest\generic_bank_Credit_Card_64px_559160_easyicon.net.ico
????I.A....??????1317??2018-09-28?15:01??CardTest\CardTest\obj\Debug\CardTest.csproj.FileListAbsolute.txt
????I.A....??????1012??2018-07-18?11:05??CardTest\CardTest\obj\Debug\CardTest.csproj.GenerateResource.Cache
????I.A....??????8563??2018-06-13?10:23??CardTest\CardTest\obj\Debug\CardTest.csprojResolveAssemblyReference.cache
????I.A....?????38400??2018-07-19?08:04??CardTest\CardTest\obj\Debug\CardTest.exe
????I.A....???????180??2018-07-18?11:05??CardTest\CardTest\obj\Debug\CardTest.Form1.resources
????I.A....?????32256??2018-07-19?08:04??CardTest\CardTest\obj\Debug\CardTest.pdb
????I.A....???????180??2018-06-13?10:23??CardTest\CardTest\obj\Debug\CardTest.Properties.Resources.resources
????I.A....????????42??2017-06-14?16:09??CardTest\CardTest\obj\Debug\CoreCompileInputs.cache
????I.A....??????1760??2018-06-13?10:24??CardTest\CardTest\obj\Debug\DesignTimeResolveAssemblyReferences.cache
????I.A....??????6975??2018-09-28?15:01??CardTest\CardTest\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
????I.A....?????????0??2017-06-14?16:09??CardTest\CardTest\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
????I.A....?????????0??2017-06-14?16:09??CardTest\CardTest\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
????I.A....?????????0??2017-06-14?16:09??CardTest\CardTest\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
????I.A....??????3584??2018-06-13?10:24??CardTest\CardTest\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
????I.A....???????520??2017-06-14?16:09??CardTest\CardTest\Program.cs
............此處省略21個(gè)文件信息
- 上一篇:蛐蛐舊版本1.0.0.1
- 下一篇:2017最新游戲支付平臺(tái)程序
評(píng)論
共有 條評(píng)論