Ejemplo n.º 1
0
        private unsafe void Display(string Apth, int havefinger)
        {
            FileStream fsMyfile = new FileStream(Apth + "\\wz.txt", FileMode.Open, FileAccess.Read);

            BinaryReader brMyfile = new BinaryReader(fsMyfile);
            brMyfile.BaseStream.Seek(0, SeekOrigin.Begin);
            string infostr = "";
            byte[] data1 = new Byte[fsMyfile.Length];

            for (int i = 0; i < fsMyfile.Length; i++)
            { data1[i] = brMyfile.ReadByte(); }


            fsMyfile.Close();
            brMyfile.Close();

            infostr = Encoding.Unicode.GetString(data1);


            Global.fullname = infostr.Substring(0, 14).Trim();
            Global.sex = infostr.Substring(15, 1).Trim();
            switch (Global.sex)
            {
                case "0": Global.sex = "未知"; break;
                case "1": Global.sex = "男"; break;
                case "2": Global.sex = "女"; break;

                default: Global.sex = "未说明"; break;
            }
            Global.nation = infostr.Substring(16, 2).Trim();

            Global.GetNation(Global.nation);

            Global.birthDateTmp = infostr.Substring(18, 8);
            Global.birthDateTmp = Global.birthDateTmp.Substring(0, 4) + "年" + Global.birthDateTmp.Substring(4, 2) + "月" + Global.birthDateTmp.Substring(6, 2) + "日";
            Global.birthDate= Global.birthDateTmp.Substring(0, 4) + "-" + Global.birthDateTmp.Substring(4, 2) + "-" + Global.birthDateTmp.Substring(6, 2) ;

            Global.address = infostr.Substring(26, 20).Trim() + "\r\n" + infostr.Substring(46, 15).Trim();
            Global.IDN = infostr.Substring(61, 18);

            Global.regDept = infostr.Substring(79, 15).Trim();
            Global.ValidDatetmp = infostr.Substring(94, 16);

            if (Global.ValidDatetmp.Substring(8, 2) == "长期")
            {
                Global.validBeginDate = Global.ValidDatetmp.Substring(0, 4) + "-" + Global.ValidDatetmp.Substring(4, 2) + "-" + Global.ValidDatetmp.Substring(6, 2);
                Global.validEndDate= Global.ValidDatetmp.Substring(8, 2);
            }
            else
            {
                Global.validBeginDate = Global.ValidDatetmp.Substring(0, 4) + "-" + Global.ValidDatetmp.Substring(4, 2) + "-" + Global.ValidDatetmp.Substring(6, 2);
                Global.validEndDate = Global.ValidDatetmp.Substring(8, 4) + "-" + Global.ValidDatetmp.Substring(12, 2) + "-" + Global.ValidDatetmp.Substring(14, 2);
            }

            if (Global.ValidDatetmp.Substring(8, 2) == "长期")
            {
                Global.ValidDatetmp = Global.ValidDatetmp.Substring(0, 4) + "." + Global.ValidDatetmp.Substring(4, 2) + "." + Global.ValidDatetmp.Substring(6, 2) + "-" + Global.ValidDatetmp.Substring(8, 2);
            }
            else
            {
                Global.ValidDatetmp = Global.ValidDatetmp.Substring(0, 4) + "." + Global.ValidDatetmp.Substring(4, 2) + "." + Global.ValidDatetmp.Substring(6, 2) + "-" + Global.ValidDatetmp.Substring(8, 4) + "." + Global.ValidDatetmp.Substring(12, 2) + "." + Global.ValidDatetmp.Substring(14, 2);
            }

            this.Invoke((EventHandler)(delegate { label_name.Text = "" + Global.fullname; }));
            this.Invoke((EventHandler)(delegate { label_sex.Text = "" + Global.sex; }));
            this.Invoke((EventHandler)(delegate { label_mz.Text = "" + Global.nation; }));
            this.Invoke((EventHandler)(delegate { label_ch.Text = "" + Global.birthDate; }));
            this.Invoke((EventHandler)(delegate { label_zz.Text = "" + Global.address; }));

            this.Invoke((EventHandler)(delegate { label_sf.Text = "" + Global.IDN; }));
            this.Invoke((EventHandler)(delegate { label_qf.Text = "" + Global.regDept; }));
            this.Invoke((EventHandler)(delegate { label_yx.Text = "" + Global.ValidDatetmp; }));


            this.Invoke((EventHandler)(delegate { PbCardzp.BackgroundImage= new Bitmap(Apth + "\\zp.bmp"); }));


            if (havefinger == 3)
            {

                FileStream fpMyfile = new FileStream(Apth + "\\fp.dat", FileMode.Open, FileAccess.Read);

                BinaryReader bpMyfile = new BinaryReader(fpMyfile);
                bpMyfile.BaseStream.Seek(0, SeekOrigin.Begin);
          
                for (int i = 0; i < fpMyfile.Length; i++)
                {
                    penple_fp[i] = bpMyfile.ReadByte();

                }
                if (fpMyfile.Length > 0)
                {
                    havefp = (int)(fpMyfile.Length / 512);
                }
                for (int j = 0; j < havefp; j++)
                {
                    penple_code[2 * j] = penple_fp[5 + j * 512];
                    penple_code[2 * j + 1] = penple_fp[6 + j * 512];

                }

                Global.fingerCount = havefp;
                Global.fingerDesc = Global.Getfpcode(havefp, penple_code); 
              

                fpMyfile.Close();
                bpMyfile.Close();
                              
            }
            else
            {
                Array.Clear(penple_fp, 0, penple_fp.Length);
                Array.Clear(penple_code, 0, penple_code.Length);
                havefp = 0;


                Global.fingerCount = 0;
                Global.fingerDesc = "";

                this.Invoke((EventHandler)(delegate
                {
                    
                }));
            }

        }