日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

c# char unsigned_dll 中含有unsigned char数组,被C#调用 -

發(fā)布時間:2025/10/17 230 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c# char unsigned_dll 中含有unsigned char数组,被C#调用 - 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

public class OPVcDll

{

#region 對USB接口的使用(PHILIPH卡)

[DllImport("dcrf32.dll")]

public static extern int dc_init(Int16 port, long baud);? //初試化

[DllImport("dcrf32.dll")]

public static extern short dc_exit(int icdev);

[DllImport("dcrf32.dll")]

public static extern short dc_reset(int icdev, uint sec);

[DllImport("dcrf32.dll")]

public static extern short dc_request(int icdev, char _Mode, ref uint TagType);

[DllImport("dcrf32.dll")]

public static extern short dc_card(int icdev, char _Mode, ref ulong Snr);

[DllImport("dcrf32.dll")]

public static extern short dc_halt(int icdev);

[DllImport("dcrf32.dll")]

public static extern short dc_anticoll(int icdev, char _Bcnt, ref ulong IcCardNo);

[DllImport("dcrf32.dll")]

public static extern short dc_beep(int icdev, uint _Msec);蜂鳴

[DllImport("dcrf32.dll")]

public static extern short dc_authentication(int icdev, int _Mode, int _SecNr);

[DllImport("dcrf32.dll")]

public static extern short dc_load_key(int icdev, int mode, int secnr, [In] byte[] nkey);? //密碼裝載到讀寫模塊中

[DllImport("dcrf32.dll")]

public static extern short dc_load_key_hex(int icdev, int mode, int secnr, string nkey);? //密碼裝載到讀寫模塊中

[DllImport("dcrf32.dll")]

public static extern short dc_write(int icdev, int adr, [In] byte[] sdata);? //向卡中寫入數(shù)據(jù)

[DllImport("dcrf32.dll")]

public static extern short dc_write(int icdev, int adr, [In] string sdata);? //向卡中寫入數(shù)據(jù)

[DllImport("dcrf32.dll")]

public static extern short dc_write_hex(int icdev, int adr, [In] string sdata);? //向卡中寫入數(shù)據(jù)(轉(zhuǎn)換為16進(jìn)制)

[DllImport("dcrf32.dll")]

public static extern short dc_read(int icdev, int adr, [Out] byte[] sdata);

[DllImport("dcrf32.dll")]

public static extern short dc_read(int icdev, int adr, [MarshalAs(UnmanagedType.LPStr)] StringBuilder sdata);? //從卡中讀數(shù)據(jù)

[DllImport("dcrf32.dll")]

public static extern short dc_read_hex(int icdev, int adr, [MarshalAs(UnmanagedType.LPStr)] StringBuilder sdata);? //從卡中讀數(shù)據(jù)(轉(zhuǎn)換為16進(jìn)制)

[DllImport("dcrf32.dll")]

public static extern int a_hex(string oldValue, ref string newValue, Int16 len);? //普通字符轉(zhuǎn)換成十六進(jìn)制字符

[DllImport("dcrf32.dll")]

public static extern void hex_a(ref string oldValue, ref string newValue, int len);? //十六進(jìn)制字符轉(zhuǎn)換成普通字符

///

/// 讀取卡信息? (unsigned char * )

///

///

///

///

[DllImport("PdocMACDll.dll")]

public static extern int mif_CPU_Card(int icdev, [MarshalAs(UnmanagedType.LPArray)]byte[] _Snrlen);

public static? int mif_CPU_Card(int icdev, ref byte[] _Snrlen)

{

return mif_CPU_Card(icdev, _Snrlen);

}

#endregion

///

/// 初始化設(shè)備

///

public static int Icdev

{

get

{

int dc_init = OPVcDll.dc_init(100, 115200);

if (dc_init > 0)

{

return dc_init;

}

else

{

throw new Exception("初始化失敗!");

}

}

}

///

/// 獲取卡信息

///

///

public static string ReadIc()

{

string cardId = "";

int st;

byte[] icCardNo = new byte[16];

char tt = (char)1;

uint ss = 0;

int dc_init = Icdev;

dc_beep((Int16)dc_init, 50);

st =dc_request(dc_init, tt, ref ss); //檢測卡

if (st!=0)

{

dc_exit(dc_init); //退出

throw new Exception("獲取卡信息出錯!");

}

//是否為CPU卡

if (ss != 8)

{

dc_exit(dc_init); //退出

throw new Exception("該卡為非CPU卡不可以在本功能中發(fā)行!");

}

mif_CPU_Card(dc_init, ref icCardNo);

string str = Encoding.Default.GetString(icCardNo);

if (str != null)

{

cardId = str;

}

else

{

dc_exit(dc_init); //退出

throw new Exception("尋卡失敗!");

}

return cardId;

}

總結(jié)

以上是生活随笔為你收集整理的c# char unsigned_dll 中含有unsigned char数组,被C#调用 -的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。