Ejemplo n.º 1
0
        public bool AuthorizeCheck()
        {
            softAuthorize = new SoftAuthorize();
            softAuthorize.FileSavePath = Application.StartupPath + @"\Authorize.txt"; // 设置存储激活码的文件,该存储是加密的
            softAuthorize.LoadByFile();

            // 检测激活码是否正确,没有文件,或激活码错误都算作激活失败
            if (!softAuthorize.IsAuthorizeSuccess(AuthorizeEncrypted))
            {
                // 显示注册窗口
                Console.WriteLine(AuthorizeEncrypted(softAuthorize.GetMachineCodeString()));;

                using (FormAuthorize form =
                           new FormAuthorize(
                               softAuthorize,
                               "请联系【简普智能0519-85858817】获取激活码",
                               AuthorizeEncrypted))
                {
                    if (form.ShowDialog() != DialogResult.OK)
                    {
                        // 授权失败,退出
                        return(false);
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
 private void FormAuthorize_Load(object sender, EventArgs e)
 {
     textBox1.Text = softAuthorize.GetMachineCodeString();
 }