private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                ulong Serial = CDogTools.GetInstance().GetSerial();
                if (Serial == 0)
                {
                    MessageBox.Show("请确认是否已插入加密狗?", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
                }
                else if (HasExist(Serial))
                {
                    //MessageBox.Show("该加密狗已经初始化过,可修改用户信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (CDogTools.GetInstance().initLock())
                {
                    CDogTools.GetInstance().WriteLock(101, 32291);
                    CDogTools.GetInstance().WriteLock(102, 5389);
                    CDogTools.GetInstance().WriteLock(103, 23740);
                    CDogTools.GetInstance().WriteLock(104, 7575);

                    //101 6 PROFILE.FLANGE_THICKNESS111 6  PROFILE.WEB_THICKNESS
                    CDogTools.GetInstance().WriteLock(201, "PROF");
                    CDogTools.GetInstance().WriteLock(202, "ILE.");
                    CDogTools.GetInstance().WriteLock(203, "FLAN");
                    CDogTools.GetInstance().WriteLock(204, "GE_T");
                    CDogTools.GetInstance().WriteLock(205, "HICK");
                    CDogTools.GetInstance().WriteLock(206, "NESS");

                    CDogTools.GetInstance().WriteLock(211, "PROF");
                    CDogTools.GetInstance().WriteLock(212, "ILE.");
                    CDogTools.GetInstance().WriteLock(213, "WEB_");
                    CDogTools.GetInstance().WriteLock(214, "THIC");
                    CDogTools.GetInstance().WriteLock(215, "KNES");
                    CDogTools.GetInstance().WriteLock(216, "S");


                    if (CDogTools.GetInstance().GetLongData(104) == 7575)
                    {
                        if (CDogTools.GetInstance().Validate())
                        {
                            MessageBox.Show("加密狗初始化完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("加密狗初始化失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("加密狗初始化失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                MessageBox.Show("加密狗初始化失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemple #2
0
 public static CDogTools GetInstance()
 {
     if (null == mDogTools)
     {
         mDogTools = new CDogTools();
         mDogTools.GetSerial();
     }
     return(mDogTools);
 }