GetDelegate() public method

�w�薼�̃A���}�l�[�W�֐��|�C���^��f���Q�[�g�ɕϊ�
public GetDelegate ( string szProcName, Type typDelegate ) : Delegate
szProcName string �A���}�l�[�W�֐���
typDelegate System.Type �ϊ�����f���Q�[�g��Type
return System.Delegate
示例#1
0
        /// <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 に接続できません");
            }
        }
示例#2
0
        /// <summary>
        /// �R���X�g���N�^
        /// </summary>
        public Felica()
        {
            // x64�Ή� 20100501 - DeForest
            try
            {
                // �v���b�g�t�H�[���ʂ̃��[�h���W���[��������ix64/x86�T�|�[�g�AItenium�̓T�|�[�g�O�j
                if (System.IntPtr.Size >= 8)    // x64
                {
                    szDLLname = "felicalib64.dll";
                }
                else                // x86
                {
                    szDLLname = "felicalib.dll";
                }
                // DLL���[�h
                bdDLL = new BindDLL(szDLLname);
                // �G���g���[�擾
                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 + " ����[�h�ł��܂���");
            }

            pasorip = pasori_open(null);
            if (pasorip == IntPtr.Zero)
            {
                throw new Exception(szDLLname + " ��J���܂���");
            }
            if (pasori_init(pasorip) != 0)
            {
                throw new Exception("PaSoRi �ɐڑ��ł��܂���");
            }
        }