/// <summary>
/// コンストラクタ
/// </summary>
public Felica()
{
// x64対応 20100501 - DeForest
try
{
// プラットフォーム別のロードモジュール名決定(x64/x86サポート、Iteniumはサポート外)
if (System.IntPtr.Size >= 8) // x64
{
szDLLname = "felicalib64.dll";
}
else // x86
{
szDLLname = "felicalib.dll";
}
// DLLロード
bdDLL = new BindDLL(szDLLname);
// エントリー取得
pasori_open = (Pasori_open)bdDLL.GetDelegate("pasori_open", typeof(Pasori_open));
pasori_close = (Pasori_close)bdDLL.GetDelegate("pasori_close", typeof(Pasori_close));
pasori_init = (Pasori_init)bdDLL.GetDelegate("pasori_init", typeof(Pasori_init));
felica_polling = (Felica_polling)bdDLL.GetDelegate("felica_polling", typeof(Felica_polling));
felica_free = (Felica_free)bdDLL.GetDelegate("felica_free", typeof(Felica_free));
felica_getidm = (Felica_getidm)bdDLL.GetDelegate("felica_getidm", typeof(Felica_getidm));
felica_getpmm = (Felica_getpmm)bdDLL.GetDelegate("felica_getpmm", typeof(Felica_getpmm));
felica_read_without_encryption02 = (Felica_read_without_encryption02)bdDLL.GetDelegate("felica_read_without_encryption02", typeof(Felica_read_without_encryption02));
}
catch (Exception)
{
throw new Exception(szDLLname + " をロードできません");
}
pasorip = pasori_open(null);
if (pasorip == IntPtr.Zero)
{
throw new Exception(szDLLname + " を開けません");
}
if (pasori_init(pasorip) != 0)
{
throw new Exception("PaSoRi に接続できません");
}
}