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

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

            if (!pf.SeedIC())
            {
                this.lbCardType.Text = InfoSys.StrSeekFailure;
                pf.EndLog(InfoSys.CardTypeStrRead, 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 = "";

            //读取扇区1内容
            sec = 1;
            //认证卡密码B
            result_AuthIC = CardCommon.AuthIC(icdev, mode, sec, key);
            pf.AuthLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard, sec, result_AuthIC);
            if (result_AuthIC == InfoSys.StrAuthSuccess)
            {
                //读数据块0,数据块0为卡类型(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.CardTypeRead)
                    {
                        this.lbState.Text = "非" + InfoSys.CardTypeStrRead + "," + InfoSys.StrCannotRead;
                        pf.Log(this.lbState.Text);
                        pf.EndLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard);
                        return;
                    }
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrRead, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard);
                    return;
                }

                //读数据块1,累计用水量(4字节),累计用电量(4字节),年可开采量(4字节),年剩余可开采量(4字节)
                block         = 1;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    ToolsForm.setTextLabel(this.label35, result_ReadIC.Substring(0, 8), "0", 1);
                    ToolsForm.setTextLabel(this.label36, result_ReadIC.Substring(8, 8), "0", 1);
                    ToolsForm.setTextLabel(this.label37, result_ReadIC.Substring(16, 8), "0", 1);
                    ToolsForm.setTextLabel(this.label38, result_ReadIC.Substring(24, 8), "0", 1);
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrRead, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard);
                    return;
                }

                //读数据块2,地址码(7字节),设备类型(1字节)
                block         = 2;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    this.label33.Text = result_ReadIC.Substring(0, 8);
                    this.label34.Text = result_ReadIC.Substring(8, 2);
                    if (this.label34.Text.Trim() == "00")
                    {
                        this.label34.Text += " - 单站";
                    }
                    else if (this.label34.Text.Trim() == "01")
                    {
                        this.label34.Text += " - 主站";
                    }
                    else if (this.label34.Text.Trim() == "02")
                    {
                        this.label34.Text += " - 从站";
                    }
                    else
                    {
                        this.label34.Text += " - 未知类型";
                    }
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrRead, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard);
                    return;
                }
            }

            //读取扇区2内容
            sec = 2;
            //认证卡密码B
            result_AuthIC = CardCommon.AuthIC(icdev, mode, sec, key);
            pf.AuthLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard, sec, result_AuthIC);
            if (result_AuthIC == InfoSys.StrAuthSuccess)
            {
                //读数据块0,用户卡号(4字节),ic序列号(4字节),开泵剩余水量(4字节),开泵剩余电量(4字节)
                block         = 0;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    this.label39.Text = result_ReadIC.Substring(0, 8);
                    this.label40.Text = result_ReadIC.Substring(8, 8);
                    ToolsForm.setTextLabel(this.label43, result_ReadIC.Substring(16, 8), "0", 1);
                    ToolsForm.setTextLabel(this.label44, result_ReadIC.Substring(24, 8), "0", 1);
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrRead, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard);
                    return;
                }

                //读数据块1,本次用水量(4字节),本次用电量(4字节),关泵剩余水量(4字节),关泵剩余电量(4字节)
                block         = 1;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    ToolsForm.setTextLabel(this.label49, result_ReadIC.Substring(0, 8), "0", 1);
                    ToolsForm.setTextLabel(this.label50, result_ReadIC.Substring(8, 8), "0", 1);
                    ToolsForm.setTextLabel(this.label47, result_ReadIC.Substring(16, 8), "0", 1);
                    ToolsForm.setTextLabel(this.label48, result_ReadIC.Substring(24, 8), "0", 1);
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrRead, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard);
                    return;
                }

                //读数据块1,开泵时间(6字节),关泵时间(6字节),记录类型(1字节),开泵类型(1字节),关泵类型(1字节)
                block         = 2;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    this.label41.Text = result_ReadIC.Substring(0, 12);
                    this.label45.Text = result_ReadIC.Substring(12, 12);
                    this.label51.Text = result_ReadIC.Substring(24, 2);
                    if (this.label51.Text.Trim() == "00")
                    {
                        this.label51.Text += " - 正常扣费";
                    }
                    else if (this.label51.Text.Trim() == "01")
                    {
                        this.label51.Text += " - 未扣费";
                    }
                    else if (this.label51.Text.Trim() == "02")
                    {
                        this.label51.Text += " - 免费";
                    }
                    else
                    {
                        this.label51.Text += " - 未知";
                    }
                    this.label42.Text = result_ReadIC.Substring(26, 2);
                    if (this.label42.Text.Trim() == "01")
                    {
                        this.label42.Text += " - 刷卡开泵";
                    }
                    else if (this.label42.Text.Trim() == "02")
                    {
                        this.label42.Text += " - 手动开泵";
                    }
                    else if (this.label42.Text.Trim() == "03")
                    {
                        this.label42.Text += " - 远程GPRS开泵";
                    }
                    else if (this.label42.Text.Trim() == "04")
                    {
                        this.label42.Text += " - 远程短信开泵";
                    }
                    else
                    {
                        this.label42.Text += " - 未知";
                    }
                    this.label46.Text = result_ReadIC.Substring(28, 2);
                    if (this.label46.Text.Trim() == "01")
                    {
                        this.label46.Text += " - 刷卡关泵";
                    }
                    else if (this.label46.Text.Trim() == "02")
                    {
                        this.label46.Text += " - 手动关泵";
                    }
                    else if (this.label46.Text.Trim() == "03")
                    {
                        this.label46.Text += " - 远程GPRS关泵";
                    }
                    else if (this.label46.Text.Trim() == "04")
                    {
                        this.label46.Text += " - 远程短信关泵";
                    }
                    else if (this.label46.Text.Trim() == "05")
                    {
                        this.label46.Text += " - 欠费关泵";
                    }
                    else
                    {
                        this.label46.Text += " - 未知";
                    }
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrRead, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard);
                    return;
                }
            }

            //读取扇区3内容
            sec = 3;
            //认证卡密码B
            result_AuthIC = CardCommon.AuthIC(icdev, mode, sec, key);
            pf.AuthLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard, sec, result_AuthIC);
            if (result_AuthIC == InfoSys.StrAuthSuccess)
            {
                //读数据块0,用户卡号(4字节),ic序列号(4字节),开泵剩余水量(4字节),开泵剩余电量(4字节)
                block         = 0;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    this.label52.Text = result_ReadIC.Substring(0, 8);
                    this.label53.Text = result_ReadIC.Substring(8, 8);
                    ToolsForm.setTextLabel(this.label56, result_ReadIC.Substring(16, 8), "0", 1);
                    ToolsForm.setTextLabel(this.label57, result_ReadIC.Substring(24, 8), "0", 1);
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrRead, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard);
                    return;
                }

                //读数据块1,本次用水量(4字节),本次用电量(4字节),关泵剩余水量(4字节),关泵剩余电量(4字节)
                block         = 1;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    ToolsForm.setTextLabel(this.label62, result_ReadIC.Substring(0, 8), "0", 1);
                    ToolsForm.setTextLabel(this.label63, result_ReadIC.Substring(8, 8), "0", 1);
                    ToolsForm.setTextLabel(this.label60, result_ReadIC.Substring(16, 8), "0", 1);
                    ToolsForm.setTextLabel(this.label61, result_ReadIC.Substring(24, 8), "0", 1);
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrRead, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard);
                    return;
                }

                //读数据块1,开泵时间(6字节),关泵时间(6字节),记录类型(1字节),开泵类型(1字节),关泵类型(1字节)
                block         = 2;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    this.label54.Text = result_ReadIC.Substring(0, 12);
                    this.label58.Text = result_ReadIC.Substring(12, 12);
                    this.label64.Text = result_ReadIC.Substring(24, 2);
                    if (this.label64.Text.Trim() == "00")
                    {
                        this.label64.Text += " - 正常扣费";
                    }
                    else if (this.label64.Text.Trim() == "01")
                    {
                        this.label64.Text += " - 未扣费";
                    }
                    else if (this.label64.Text.Trim() == "02")
                    {
                        this.label64.Text += " - 免费";
                    }
                    else
                    {
                        this.label64.Text += " - 未知";
                    }
                    this.label55.Text = result_ReadIC.Substring(26, 2);
                    if (this.label55.Text.Trim() == "01")
                    {
                        this.label55.Text += " - 刷卡开泵";
                    }
                    else if (this.label55.Text.Trim() == "02")
                    {
                        this.label55.Text += " - 手动开泵";
                    }
                    else if (this.label55.Text.Trim() == "03")
                    {
                        this.label55.Text += " - 远程GPRS开泵";
                    }
                    else if (this.label55.Text.Trim() == "04")
                    {
                        this.label55.Text += " - 远程短信开泵";
                    }
                    else
                    {
                        this.label55.Text += " - 未知";
                    }
                    this.label59.Text = result_ReadIC.Substring(28, 2);
                    if (this.label59.Text.Trim() == "01")
                    {
                        this.label59.Text += " - 刷卡关泵";
                    }
                    else if (this.label59.Text.Trim() == "02")
                    {
                        this.label59.Text += " - 手动关泵";
                    }
                    else if (this.label59.Text.Trim() == "03")
                    {
                        this.label59.Text += " - 远程GPRS关泵";
                    }
                    else if (this.label59.Text.Trim() == "04")
                    {
                        this.label59.Text += " - 远程短信关泵";
                    }
                    else if (this.label59.Text.Trim() == "05")
                    {
                        this.label59.Text += " - 欠费关泵";
                    }
                    else
                    {
                        this.label59.Text += " - 未知";
                    }
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrRead, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard);
                    return;
                }
            }

            if (this.lbCardType.Text == InfoSys.CardTypeRead)
            {
                SerialNumber_old  = this.lbSerialNumber.Text.Trim();
                this.lbState.Text = InfoSys.StrReadSuccess;
            }
            else
            {
                this.lbState.Text = "非" + InfoSys.CardTypeStrRead + "," + InfoSys.StrCannotRead;
                MessageBox.Show(this.lbState.Text);
            }
            pf.EndLog(InfoSys.CardTypeStrRead, InfoSys.MethodReadCard);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            clear();

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

            if (!pf.SeedIC())
            {
                this.lbCardType.Text = InfoSys.StrSeekFailure;
                pf.EndLog(InfoSys.CardTypeStrDevice, 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 = "";

            //读取扇区1内容
            sec = 1;
            //认证卡密码B
            result_AuthIC = CardCommon.AuthIC(icdev, mode, sec, key);
            pf.AuthLog(InfoSys.CardTypeStrDevice, InfoSys.MethodReadCard, sec, result_AuthIC);
            if (result_AuthIC == InfoSys.StrAuthSuccess)
            {
                //读数据块0,数据块0为卡类型(1字节)、行政区划码(3字节)、镇(乡)村编码(3字节)、测站编码(1字节)、年度可开采水量(4字节)、可用水量提醒值(2字节)、可用水量提醒值(2字节)
                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.CardTypeDevice)
                    {
                        this.lbState.Text = "非" + InfoSys.CardTypeStrDevice + "," + InfoSys.StrCannotRead;
                        pf.Log(this.lbState.Text);
                        pf.EndLog(InfoSys.CardTypeStrDevice, InfoSys.MethodReadCard);
                        return;
                    }
                    this.txtAddressCode1.Text = result_ReadIC.Substring(2, 6);
                    this.txtAddressCode2.Text = result_ReadIC.Substring(8, 6);
                    int i_AddressCode3 = Convert.ToInt32("0x" + result_ReadIC.Substring(14, 2), 16);
                    this.txtAddressCode3.Text = i_AddressCode3.ToString();
                    ToolsForm.setTextTextBox(this.txtYearExploitation, result_ReadIC.Substring(16, 8), "0", 1);
                    try
                    {
                        ToolsForm.setTextTextBox(this.txtAlertAvailableWater, Convert.ToInt32("0x" + result_ReadIC.Substring(24, 4), 16).ToString(), "0", 0);
                    }
                    catch { }
                    try
                    {
                        ToolsForm.setTextTextBox(this.txtAlertAvailableElectric, Convert.ToInt32("0x" + result_ReadIC.Substring(28, 4), 16).ToString(), "0", 0);
                    }
                    catch { }
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrDevice, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrDevice, InfoSys.MethodReadCard);
                    return;
                }

                //读数据块1,数据块1为流量计类型(1字节)、电表脉冲数(2字节bcd码)、水位报警值(4字节)
                block         = 1;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    string s = result_ReadIC.Substring(0, 2);
                    this.cboTypeCode.SelectedIndex = 0;
                    foreach (object item in this.cboTypeCode.Items)
                    {
                        if (int.Parse(item.ToString().Split('-')[0]) == Convert.ToInt32("0x" + s, 16))
                        {
                            this.cboTypeCode.SelectedItem = item;
                            break;
                        }
                    }
                    this.txtMeterPulse.Text = result_ReadIC.Substring(2, 4).TrimStart('0');
                    ToolsForm.setTextTextBox(this.txtAlertWaterLevel, result_ReadIC.Substring(6, 8), "0", 1);
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrDevice, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrDevice, InfoSys.MethodReadCard);
                    return;
                }

                //读数据块2,数据块2为站类型(1字节)、地址码(2字节)
                block         = 2;
                result_ReadIC = CardCommon.ReadIC(icdev, sec, block);
                if (result_ReadIC.Length == 32)
                {
                    string s1 = result_ReadIC.Substring(0, 2);
                    this.comboBox1.SelectedIndex = 0;
                    foreach (object item in this.comboBox1.Items)
                    {
                        if (int.Parse(item.ToString().Split('-')[0]) == Convert.ToInt32("0x" + s1, 16))
                        {
                            this.comboBox1.SelectedItem = item;
                            break;
                        }
                    }

                    string s2 = result_ReadIC.Substring(2, 4);
                    try
                    {
                        this.txtStationCode.Text = Convert.ToInt32("0x" + s2, 16).ToString().TrimStart('0');
                    }
                    catch { }
                    if (this.txtStationCode.Text == "")
                    {
                        this.txtStationCode.Text = "0";
                    }
                }
                else
                {
                    this.lbState.Text = InfoSys.InfoReadFailure(sec, block, InfoSys.CardTypeStrDevice, InfoSys.StrReadFailure);
                    pf.Log(this.lbState.Text);
                    pf.EndLog(InfoSys.CardTypeStrDevice, InfoSys.MethodReadCard);
                    return;
                }
            }

            if (this.lbCardType.Text == InfoSys.CardTypeDevice)
            {
                SerialNumber_old  = this.lbSerialNumber.Text.Trim();
                this.lbState.Text = InfoSys.StrReadSuccess;
            }
            else
            {
                this.lbState.Text = "非" + InfoSys.CardTypeStrDevice + "," + InfoSys.StrCannotRead;
                MessageBox.Show(this.lbState.Text);
            }
            pf.EndLog(InfoSys.CardTypeStrDevice, InfoSys.MethodReadCard);
        }
        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);
        }