private void button1_Click(object sender, EventArgs e)
        {
            clear();

            pf.BeginLog(InfoSys.CardTypeStrNetSet, InfoSys.MethodReadCard);

            if (!pf.SeedIC())
            {
                this.lbCardType.Text = InfoSys.StrSeekFailure;
                pf.EndLog(InfoSys.CardTypeStrNetSet, InfoSys.MethodReadCard);
                return;
            }

            this.lbSerialNumber.Text = pf.getSnr().ToString("X");

            int    mode          = 4;            //以B密码认证
            int    sec           = 1;            //扇区
            int    block         = 0;
            string key           = pf.getKeyB(); //读卡密码
            string result_ReadIC = "";
            string result_AuthIC = "";

            int len_IP       = 0;
            int len_Port     = 0;
            int len_APN      = 0;
            int len_UserName = 0;
            int len_Password = 0;

            //读取扇区1内容
            sec = 1;
            //认证卡密码B
            result_AuthIC = CardCommon.AuthIC(icdev, mode, sec, key);
            pf.AuthLog(InfoSys.CardTypeStrNetSet, InfoSys.MethodReadCard, sec, result_AuthIC);
            if (result_AuthIC == InfoSys.StrAuthSuccess)
            {
                //读数据块0,数据块0为卡类型(1字节)、是否域名访问(1字节)、有效IP地址长度(1字节)、有效端口号长度(1字节)
                //APN名称长度(1字节)、APN用户名长度(1字节)、APN密码长度(1字节)
                block         = 0;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    this.lbCardType.Text = result_ReadIC.Substring(0, 2);
                    if (this.lbCardType.Text != InfoSys.CardTypeNetSet)
                    {
                        this.lbState.Text = "非" + InfoSys.CardTypeStrNetSet + "," + InfoSys.StrCannotRead;
                        pf.Log(this.lbState.Text);
                        pf.EndLog(InfoSys.CardTypeStrNetSet, InfoSys.MethodReadCard);
                        return;
                    }

                    IsDomain_old             = result_ReadIC.Substring(2, 2);
                    this.ckbIsDomain.Checked = IsDomain_old == "01";

                    len_IP       = int.Parse(result_ReadIC.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
                    len_Port     = int.Parse(result_ReadIC.Substring(6, 2), System.Globalization.NumberStyles.HexNumber);
                    len_APN      = int.Parse(result_ReadIC.Substring(8, 2), System.Globalization.NumberStyles.HexNumber);
                    len_UserName = int.Parse(result_ReadIC.Substring(10, 2), System.Globalization.NumberStyles.HexNumber);
                    len_Password = int.Parse(result_ReadIC.Substring(12, 2), System.Globalization.NumberStyles.HexNumber);
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrNetSet, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrNetSet, InfoSys.MethodReadCard);
                    return;
                }

                //读数据块1,IP地址或域名地址
                block         = 1;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    if (len_IP > 0)
                    {
                        string v = result_ReadIC.Substring(0, len_IP * 2);
                        this.txtIP.Text = HexStringUtility.ByteArrayToStr(HexStringUtility.HexStringToByteArray(v));
                    }
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrNetSet, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrNetSet, InfoSys.MethodReadCard);
                    return;
                }

                //读数据块2,端口号(5字节)
                block         = 2;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    if (len_Port > 0)
                    {
                        string v = result_ReadIC.Substring(0, len_Port * 2);
                        this.txtPort.Text = HexStringUtility.ByteArrayToStr(HexStringUtility.HexStringToByteArray(v));
                    }
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrNetSet, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrNetSet, InfoSys.MethodReadCard);
                    return;
                }
            }

            //读取扇区2内容
            sec = 2;
            //认证卡密码B
            result_AuthIC = CardCommon.AuthIC(icdev, mode, sec, key);
            pf.AuthLog(InfoSys.CardTypeStrNetSet, InfoSys.MethodReadCard, sec, result_AuthIC);
            if (result_AuthIC == InfoSys.StrAuthSuccess)
            {
                //读数据块0,APN名称
                block         = 0;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    if (len_APN > 0)
                    {
                        string v = result_ReadIC.Substring(0, len_APN * 2);
                        this.txtAPN.Text = HexStringUtility.ByteArrayToStr(HexStringUtility.HexStringToByteArray(v));
                    }
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrNetSet, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrNetSet, InfoSys.MethodReadCard);
                    return;
                }

                //读数据块1,用户名
                block         = 1;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    if (len_UserName > 0)
                    {
                        string v = result_ReadIC.Substring(0, len_UserName * 2);
                        this.txtUserName.Text = HexStringUtility.ByteArrayToStr(HexStringUtility.HexStringToByteArray(v));
                    }
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrNetSet, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrNetSet, InfoSys.MethodReadCard);
                    return;
                }

                //读数据块2,密码
                block         = 2;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    if (len_Password > 0)
                    {
                        string v = result_ReadIC.Substring(0, len_Password * 2);
                        this.txtPassword.Text = HexStringUtility.ByteArrayToStr(HexStringUtility.HexStringToByteArray(v));
                    }
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrNetSet, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrNetSet, InfoSys.MethodReadCard);
                    return;
                }
            }

            if (this.lbCardType.Text == InfoSys.CardTypeNetSet)
            {
                SerialNumber_old  = this.lbSerialNumber.Text.Trim();
                this.lbState.Text = InfoSys.StrReadSuccess;
            }
            else
            {
                this.lbState.Text = "非" + InfoSys.CardTypeStrNetSet + "," + InfoSys.StrCannotRead;
                MessageBox.Show(this.lbState.Text);
            }
            pf.EndLog(InfoSys.CardTypeNetSet, InfoSys.MethodReadCard);
        }