Example #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            KeyManager Km         = new KeyManager(txtProductID.Text);
            string     productKey = txtProductKey.Text;

            if (Km.ValidKey(ref productKey))
            {
                KeyValuesClass Kv = new KeyValuesClass();
                if (Km.DisassembleKey(productKey, ref Kv))
                {
                    LicenseInfo Lic = new LicenseInfo();
                    Lic.ProductKey = productKey;
                    Lic.FullName   = "XENOS";
                    if (Kv.Type == LicenseType.TRIAL)
                    {
                        Lic.Day   = Kv.Expiration.Day;
                        Lic.Month = Kv.Expiration.Month;
                        Lic.Year  = Kv.Expiration.Year;
                    }
                    Km.SaveSuretyFile(string.Format(@"{0}\Key.lic", Application.StartupPath), Lic);
                    MessageBox.Show("Successfully registered.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Your product key is invalid.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            KeyManager km          = new KeyManager(txt_proudect.Text);
            string     proudectKey = Txt_key.Text;

            if (km.ValidKey(ref proudectKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                if (km.DisassembleKey(proudectKey, ref kv))
                {
                    LicenseInfo lc = new LicenseInfo();
                    lc.ProductKey = proudectKey;
                    lc.FullName   = "solution Company for SoftWare";
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        lc.Day   = kv.Expiration.Day;
                        lc.Month = kv.Expiration.Month;
                        lc.Year  = kv.Expiration.Year;
                    }
                    km.SaveSuretyFile(string.Format(@"{0}\key.lic", Application.StartupPath), lc);
                    MessageBox.Show("you have been successfuly registred", "message", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                    Properties.Settings.Default.ProudectKey = "YES";
                    Properties.Settings.Default.Save();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("your proudect key is invalid", "message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            KeyManager km            = new KeyManager(textProductID.Text);
            string     ProductionKey = textProductKey.Text;

            if (km.ValidKey(ref ProductionKey))

            {
                KeyValuesClass kv = new KeyValuesClass();
                if (km.DisassembleKey(ProductionKey, ref kv))
                {
                    LicenseInfo Lic = new LicenseInfo();
                    Lic.ProductKey = ProductionKey;
                    Lic.FullName   = "FoxLearn";

                    km.SaveSuretyFile(string.Format(@"{0}\Key.lic", Application.StartupPath), Lic);

                    MessageBox.Show("OK");
                }
                else
                {
                    MessageBox.Show("False!!");
                }
            }
        }
Example #4
0
        private void frmAbout_Load(object sender, EventArgs e)
        {
            lblProductID.Text = ComputerInfo.GetComputerId();
            KeyManager  km  = new KeyManager(lblProductID.Text);
            LicenseInfo lic = new LicenseInfo();
            //Get license information from license file
            int    value      = km.LoadSuretyFile(string.Format(@"{0}\Key.lic", Application.StartupPath), ref lic);
            string productKey = lic.ProductKey;

            //Check valid
            if (km.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                //Decrypt license key
                if (km.DisassembleKey(productKey, ref kv))
                {
                    lblProductName.Text = "*****@*****.**";
                    lblProductKey.Text  = productKey;
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        lblLicenseType.Text = string.Format("{0} days", (kv.Expiration - DateTime.Now.Date).Days);
                    }
                    else
                    {
                        lblLicenseType.Text = "Full";
                    }
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            KeyManager km         = new KeyManager(tbProductID.Text);
            string     productKey = tbProductKey.Text;

            if (km.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                if (km.DisassembleKey(productKey, ref kv))
                {
                    LicenseInfo lic = new LicenseInfo();
                    lic.ProductKey = productKey;
                    lic.FullName   = "Imad khamkhami";
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        lic.Day   = kv.Expiration.Day;
                        lic.Month = kv.Expiration.Month;
                        lic.Year  = kv.Expiration.Year;
                    }
                    km.SaveSuretyFile(string.Format(@"{0}\Key.lic", Application.StartupPath), lic);
                    MessageBox.Show("You Have been successfully registred", "Message", MessageBoxButtons.OK, MessageBoxIcon.Question);
                    this.Dispose();
                }
            }
            else
            {
                MessageBox.Show("Your Product Key is Invalide ! ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #6
0
        private void frmAbout_Load(object sender, EventArgs e)
        {
            _lblProductId.Text = ComputerInfo.GetComputerId();
            KeyManager  km         = new KeyManager(_lblProductId.Text);
            LicenseInfo lic        = new LicenseInfo();
            int         value      = km.LoadSuretyFile(string.Format(@"{0}\Key.lic", Application.StartupPath), ref lic);
            string      productKey = lic.ProductKey;

            if (km.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                if (km.DisassembleKey(productKey, ref kv))
                {
                    //_lblProductName.Text = "Phần mềm chấm điểm";
                    _lblProductKey.Text = productKey;
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        _lblLicenseType.Text = string.Format("Bản dùng thử còn {0} ngày", (kv.Expiration - DateTime.Now.Date).Days);
                    }
                    else
                    {
                        _lblLicenseType.Text = "Bản quyền đã kích hoạt";
                    }
                }
            }
        }
Example #7
0
        private void frmRegistration_FormClosing(object sender, FormClosingEventArgs e)
        {
            KeyManager  km         = new KeyManager(ComputerInfo.GetComputerId());
            LicenseInfo lic        = new LicenseInfo();
            bool        isActive   = false;//bien kiem tra kich hoat
            int         value      = km.LoadSuretyFile(string.Format(@"{0}\Key.lic", Application.StartupPath), ref lic);
            string      productKey = lic.ProductKey;

            if (km.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                if (km.DisassembleKey(productKey, ref kv))
                {
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        //dung thu ma con ngay thi cho chay
                        if ((kv.Expiration - DateTime.Now.Date).Days > 0)
                        {
                            isActive = true;
                        }
                    }
                    else
                    {
                        isActive = true;
                    }
                }
            }

            // neu khong con ngay su dung, thoat khoi chuong trinh
            if (!isActive)
            {
                MessageBox.Show("Vui lòng kích hoạt bản quyền để sử dụng. Xin cám ơn.", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Application.Exit();
            }
        }
 private void FrmAbout_Load(object sender, EventArgs e)
 {
     try
     {
         Cursor             = Cursors.WaitCursor;
         txtProdutoID_.Text = ComputerInfo.GetComputerId();
         KeyManager  km         = new KeyManager(txtProdutoID_.Text);
         LicenseInfo Lic        = new LicenseInfo();
         int         value      = km.LoadSuretyFile(string.Format(@"{0}\Key.Lic", Application.StartupPath), ref Lic);
         string      produtoKey = Lic.ProductKey;
         if (km.ValidKey(ref produtoKey))
         {
             KeyValuesClass kv = new KeyValuesClass();
             if (km.DisassembleKey(produtoKey, ref kv))
             {
                 txtProdutoNome.Text = Lic.FullName;
                 txtProdutoKey_.Text = produtoKey;
                 if (kv.Type == LicenseType.TRIAL)
                 {
                     txtLicenceType.Text = string.Format("{0} Dias", (kv.Expiration - DateTime.Now.Date).Days);
                 }
                 else
                 {
                     txtLicenceType.Text = "FULL";
                 }
             }
         }
     }
     finally
     {
         Cursor = Cursors.Default;
     }
 }
Example #9
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            KeyManager km         = new KeyManager(txtProductID.Text);
            string     productKey = txtProductKey.Text;

            if (km.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                if (km.DisassembleKey(productKey, ref kv))
                {
                    LicenseInfo lic = new LicenseInfo();
                    lic.ProductKey = productKey;
                    lic.FullName   = "FoxLearn";
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        lic.Day   = kv.Expiration.Day;
                        lic.Month = kv.Expiration.Month;
                        lic.Year  = kv.Expiration.Year;
                    }
                    //km.SaveSuretyFile(string.Format(@"{0}\Key.lic", Application.StartupPath), lic);
                    km.SaveSuretyFile(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Key.lic", lic);
                    MessageBox.Show("You have been successfully registered", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Your product key is invalid", "Meesage", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Example #10
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            KeyManager keyManagerObj = new KeyManager(txtProductID.Text);
            string     productKey    = txtProductKey.Text;

            if (keyManagerObj.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                if (keyManagerObj.DisassembleKey(productKey, ref kv))
                {
                    LicenseInfo lic = new LicenseInfo();
                    lic.ProductKey = productKey;
                    lic.FullName   = "Pastry Management System";
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        lic.Day   = kv.Expiration.Day;
                        lic.Month = kv.Expiration.Month;
                        lic.Year  = kv.Expiration.Year;
                    }
                    keyManagerObj.SaveSuretyFile(string.Format(@"{0}\key.lic", Application.StartupPath), lic);
                    MsgBox.Information("You have been successfully registered the product");
                    Hide();
                }
            }
            else
            {
                MsgBox.Error("Your product key is invalid");
                Hide();
            }
        }
Example #11
0
        private void About_Load(object sender, EventArgs e)
        {
            txt_proudect.Text = ComputerInfo.GetComputerId();
            KeyManager  km = new KeyManager(txt_proudect.Text);
            LicenseInfo lc = new LicenseInfo();

            int    value       = km.LoadSuretyFile(string.Format(@"{0}\key.lic", Application.StartupPath), ref lc);
            string proudectKey = lc.ProductKey;

            if (km.ValidKey(ref proudectKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                if (km.DisassembleKey(proudectKey, ref kv))
                {
                    txt_name.Text = "solution Company for SoftWare";
                    Txt_key.Text  = proudectKey;
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        txt_Licence.Text = string.Format("{0} days", (kv.Expiration - DateTime.Now.Date).Days);
                    }
                    else
                    {
                        txt_Licence.Text = "Full";
                    }
                }
            }
        }
Example #12
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            KeyManager km         = new KeyManager(txtProductID.Text);
            string     productKey = txtProductKey.Text;

            if (km.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                if (km.DisassembleKey(productKey, ref kv))
                {
                    LicenseInfo lic = new LicenseInfo();
                    lic.ProductKey = productKey;
                    lic.FullName   = "EmdSoft";
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        lic.Day   = kv.Expiration.Day;
                        lic.Month = kv.Expiration.Month;
                        lic.Year  = kv.Expiration.Year;
                    }


                    km.SaveSuretyFile(string.Format(@"{0}\Key.lic", Application.StartupPath), lic);
                    MessageBox.Show("Etkinleştirme işlemi gerçekleştirildi.", "Mesaj", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Ürün anahtarı geçersiz.", "Mesaj", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private void ok_btn_Click(object sender, EventArgs e)
        {
            KeyManager km         = new KeyManager(productid_lbl.Text);
            string     productKey = productkey_txt.Text;

            //Check valid
            if (km.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                //Decrypt license key
                if (km.DisassembleKey(productKey, ref kv))
                {
                    LicenseInfo lic = new LicenseInfo();
                    lic.ProductKey = productKey;
                    lic.FullName   = "ABCD BANK";

                    //Save license key to file
                    km.SaveSuretyFile(string.Format(@"{0}\active.lic", Application.StartupPath), lic);
                    MessageBox.Show("You have been successfully registered.", "ABCD BANK", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Dispose();
                    Login_form lgf = new Login_form();
                    lgf.Show();
                }
            }
            else
            {
                MessageBox.Show("Your product key is invalid.", "ABCD BANK", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #14
0
        private void frmAbout_Load(object sender, EventArgs e)
        {
            lbProductID.Text = ComputerInfo.GetComputerId();
            KeyManager  km  = new KeyManager(lbProductID.Text);
            LicenseInfo lic = new LicenseInfo();


            km.LoadSuretyFile(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Key.lic", ref lic);
            string productKey = lic.ProductKey;

            if (km.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                if (km.DisassembleKey(productKey, ref kv))
                {
                    lbProductName.Text = "VISA";
                    lbProductKey.Text  = productKey;
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        lbLicenseType.Text = string.Format("{0} days", (kv.Expiration - DateTime.Now.Date).Days);
                    }
                    else
                    {
                        lbLicenseType.Text = "Full";
                    }
                }
            }
        }
Example #15
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            KeyManager km = new KeyManager(txtProductID.Text);

            string productKey = txtProductKey.Text;

            //Check valid
            if (km.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                //Decrypt license key
                if (km.DisassembleKey(productKey, ref kv))
                {
                    LicenseInfo lic = new LicenseInfo();
                    lic.ProductKey = productKey;
                    lic.FullName   = "PhongNguyen";
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        lic.Day   = kv.Expiration.Day;
                        lic.Month = kv.Expiration.Month;
                        lic.Year  = kv.Expiration.Year;
                    }
                    //Save license key to file
                    km.SaveSuretyFile(string.Format(@"{0}\Key.lic", Application.StartupPath), lic);
                    MessageBox.Show("You have been successfully registered.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Your product key is invalid.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #16
0
        private void frmAbout_Load(object sender, EventArgs e)
        {
            lblProductID.Text = ComputerInfo.GetComputerId();
            KeyManager  km         = new KeyManager(lblProductID.Text);
            LicenseInfo lic        = new LicenseInfo();
            int         value      = km.LoadSuretyFile(string.Format(@"key.lic", Application.StartupPath), ref lic);
            string      productKey = lic.ProductKey;

            if (km.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                if (km.DisassembleKey(productKey, ref kv))
                {
                    lblName.Text       = "Pastry Management System";
                    lblProductKey.Text = productKey;
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        lblLicenseType.Text = string.Format("{0} days", (kv.Expiration - DateTime.Now.Date).Days);
                    }
                    else
                    {
                        lblLicenseType.Text = "Full";
                    }
                }
            }
        }
Example #17
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Setting.Port = 9090;
            //Setting.MarkSendFile = "@#$filetxt##$#@";
            ///License
            ///
            string      id         = ComputerInfo.GetComputerId();
            KeyManager  km         = new KeyManager(id);
            LicenseInfo lic        = new LicenseInfo();
            int         value      = km.LoadSuretyFile(string.Format(@"{0}\Key.lic", Application.StartupPath), ref lic);
            string      productkey = lic.ProductKey;

            if (value <= 0)
            {
                Application.Run(new License());
                //Application.Run(new frmClient());
            }
            else if (value > 0)
            {
                KeyValuesClass kv = new KeyValuesClass();
                if (km.DisassembleKey(productkey, ref kv))
                {
                    //lblProductname.Text = lic.FullName;//lic.ProductKey
                    //lblProductKey.Text = lic.ProductKey; //productkey;
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        int day = Convert.ToInt32((kv.Expiration - DateTime.Now.Date).Days);
                        if (day >= 0)
                        {
                            DialogResult dr = MessageBox.Show("Bạn còn: " + string.Format("{0} ngày ", (kv.Expiration - DateTime.Now.Date).Days) + "sử dụng phần mềm! \n Bạn có muốn nhập key để active", "active", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                            if (dr == DialogResult.Yes)
                            {
                                Application.Run(new License());
                            }
                            Application.Run(new frmClient());
                        }
                        else
                        {
                            MessageBox.Show("Bạn đã hết hạn dùng thử vui lòng nhập key để active!", "Active", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                            Application.Run(new License());
                        }
                    }
                    else
                    {
                        //lblLicenceType.Text = "Full";
                        Application.Run(new frmClient());
                    }
                }
            }
            //Application.Run(new frmClient());
        }
Example #18
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            List <String> List_ = new List <string>();

            string[] lst = txtProductKey.Text.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string line in lst)
            {
                List_.Add(line);
            }

            KeyManager km = new KeyManager(txtProductID.Text);

            if (List_.Count >= 7)
            {
                productKey = List_[0] + "-" + List_[2] + "-" + List_[4] + "-" + List_[5] + "-" + List_[6] + "-" + List_[7];

                diskid1 = MD5(SHA1(GetHardDiskSerialNo())).Substring(7, 5);
                diskid2 = MD5(SHA1(GetHardDiskSerialNo())).Substring(14, 5);

                if (km.ValidKey(ref productKey) && diskid1 == List_[1] && diskid2 == List_[3])
                {
                    KeyValuesClass kv = new KeyValuesClass();
                    if (km.DisassembleKey(productKey, ref kv))
                    {
                        LicenseInfo lic = new LicenseInfo();
                        lic.ProductKey = productKey;
                        lic.FullName   = "Phần mềm quản lý nhân khẩu";
                        if (kv.Type == LicenseType.TRIAL)
                        {
                            lic.Day   = kv.Expiration.Day;
                            lic.Month = kv.Expiration.Month;
                            lic.Year  = kv.Expiration.Year;
                        }
                        km.SaveSuretyFile(string.Format(@"{0}\License.lic", Application.StartupPath), lic);
                        LinceseAbout();
                        txtProductKey.Text = productKey_;
                        if (XtraMessageBox.Show("Key đã được áp dụng. Khởi động lại phần mềm?", "Thành công", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                        {
                            this.Close();
                            RestartApp(1, "prjQLNK.exe");
                        }
                    }
                }
                else
                {
                    XtraMessageBox.Show("Lỗi bản quyền", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                XtraMessageBox.Show("Lỗi bản quyền", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #19
0
        public void LicenseAbout()
        {
            string LicensePath = Application.StartupPath + "\\License.lic";

            try
            {
                if (File.Exists(LicensePath))
                {
                    LicenseInfo    lic        = new LicenseInfo();
                    string         ProductID  = ComputerInfo.GetComputerId();
                    KeyManager     km         = new KeyManager(ProductID);
                    int            value      = km.LoadSuretyFile(string.Format(@"{0}\License.lic", Application.StartupPath), ref lic);
                    string         productKey = lic.ProductKey;
                    KeyValuesClass kv         = new KeyValuesClass();
                    if (km.DisassembleKey(productKey, ref kv))
                    {
                        if (kv.Type == LicenseType.TRIAL && (kv.Expiration - DateTime.Now.Date).Days > 0)
                        {
                            lblLicense.Caption = "Bản quyền: Thời gian còn " + string.Format("{0} ngày sử dụng", (kv.Expiration - DateTime.Now.Date).Days);
                        }
                        else
                        {
                            lblLicense.Caption = "Bản quyền: " + "Không giới hạn";
                        }
                        if ((kv.Expiration - DateTime.Now.Date).Days == 0 && kv.Type != LicenseType.FULL)
                        {
                            btnDangNhap.Enabled = false;
                            lblLicense.Caption  = "Bản quyền: " + "Hết hạn";
                            alertControl1.Show(this, "Cảnh báo", "Bản quyền của bạn đã hết hạn, vui lòng cập nhật Key mới!");
                        }
                        if ((kv.Expiration - DateTime.Now.Date).Days < 10 && (kv.Expiration - DateTime.Now.Date).Days != 0 && kv.Type != LicenseType.FULL)
                        {
                            alertControl1.Show(this, "Cảnh báo", "Bản quyền của bạn sắp hết hạn, vui lòng cập nhật Key mới!");
                        }
                    }
                }
                else
                {
                    lblLicense.Caption  = "Bản quyền: Chưa đăng ký";
                    btnDangNhap.Enabled = false;
                    alertControl1.Show(this, "Cảnh báo", "Bạn chưa đăng ký bản quyền. Vui lòng nhập key để tiếp tục sử dụng!");
                }
            }
            catch (Exception)
            {
                btnDangNhap.Enabled = false;
                XtraMessageBox.Show("Lỗi bản quyền, vui lòng Key mới để tiếp tục sử dụng!");
                return;
            }
        }
Example #20
0
 public void BtnGerar_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(txtLicenceExpiracao.Text))
     {
         KeyManager     km = new KeyManager(txtProdutoID.Text);
         KeyValuesClass kv;
         string         productKey = string.Empty;
         if (cbLicenceType.SelectedIndex == 0)
         {
             kv = new KeyValuesClass()
             {
                 Type        = LicenseType.FULL,
                 Header      = Convert.ToByte(9),
                 Footer      = Convert.ToByte(6),
                 ProductCode = (byte)ProdutoID,
                 Edition     = FoxLearn.License.Edition.ENTERPRISE,
                 Version     = 1,
             };
             if (!km.GenerateKey(kv, ref productKey))
             {
                 txtProdutoKey.Text = "Erro ao Gerar a Licença";
             }
         }
         else
         {
             kv = new KeyValuesClass()
             {
                 Type        = LicenseType.TRIAL,
                 Header      = Convert.ToByte(9),
                 Footer      = Convert.ToByte(6),
                 ProductCode = (byte)ProdutoID,
                 Edition     = FoxLearn.License.Edition.ENTERPRISE,
                 Version     = 1,
                 Expiration  = DateTime.Now.AddDays(Convert.ToInt32(txtLicenceExpiracao.Text))
             };
             if (!km.GenerateKey(kv, ref productKey))
             {
                 txtProdutoKey.Text = "Erro ao Gerar a Licença";
             }
         }
         txtProdutoKey.Text = productKey;
     }
     else
     {
         MessageBox.Show("Digite o número de dias a usar o sistema por favor!...", "");
         txtLicenceExpiracao.Focus();
     }
 }
Example #21
0
        private void LinceseAbout()
        {
            string LicensePath = Application.StartupPath + "\\License.lic";

            if (File.Exists(LicensePath))
            {
                FileInfo fInfo = new FileInfo(LicensePath);
                dpkCreatedate.Text = fInfo.LastWriteTime.ToString();
                LicenseInfo lic        = new LicenseInfo();
                KeyManager  km         = new KeyManager(txtProductID.Text);
                int         value      = km.LoadSuretyFile(string.Format(@"{0}\License.lic", Application.StartupPath), ref lic);
                string      productKey = lic.ProductKey;

                diskid1 = MD5(SHA1(GetHardDiskSerialNo())).Substring(7, 5);
                diskid2 = MD5(SHA1(GetHardDiskSerialNo())).Substring(14, 5);

                List <String> List_ = new List <string>();
                string[]      lst   = lic.ProductKey.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string line in lst)
                {
                    List_.Add(line);
                }

                productKey_        = List_[0] + "-" + diskid1 + "-" + List_[1] + "-" + diskid2 + "-" + List_[2] + "-" + List_[3] + "-?????-?????";
                txtProductKey.Text = productKey_;

                if (km.ValidKey(ref productKey))
                {
                    KeyValuesClass kv = new KeyValuesClass();
                    if (km.DisassembleKey(productKey, ref kv))
                    {
                        if (kv.Type == LicenseType.TRIAL)
                        {
                            txtRemaining.Text = string.Format("{0} ngày sử dụng", (kv.Expiration - DateTime.Now.Date).Days);
                        }
                        else
                        {
                            txtRemaining.Text = "Không giới hạn";
                        }
                    }
                }
            }
            else
            {
                txtRemaining.Text = "Chưa đăng ký";
            }
        }
Example #22
0
        public LicenceModelsHelps GetLicence()
        {
            var         U   = ComputerInfo.GetComputerId();
            KeyManager  km  = new KeyManager(U);
            LicenseInfo Lic = new LicenseInfo();

            Models.Helps.LicenceModelsHelps modelsHelps = null;
            try
            {
                var    getLicence = GetLocalDataUsert("ISoft 2019", "Licence");
                int    value      = km.LoadSuretyFile(string.Format(@"{0}\Key.Lic", getLicence), ref Lic);
                string produtoKey = Lic.ProductKey;
                if (km.ValidKey(ref produtoKey))
                {
                    KeyValuesClass kv = new KeyValuesClass();
                    if (km.DisassembleKey(produtoKey, ref kv))
                    {
                        modelsHelps = new LicenceModelsHelps
                        {
                            FullName        = Lic.FullName,
                            DataExpiration  = kv.Expiration,
                            Dias            = kv.Type == LicenseType.TRIAL ? $"{(kv.Expiration - DateTime.Now.Date).Days} Dias" : "FULL",
                            DiasSimples     = (kv.Expiration - DateTime.Now.Date).Days,
                            Key             = produtoKey,
                            KeyID           = U,
                            typelicence     = kv.Type.ToString(),
                            Year            = Lic.Year,
                            licencaNaturesa = (Models.Helps.Edition)kv.Edition,
                        };
                        return(modelsHelps);
                    }
                    return(null);
                }
                else
                {
                    return(null);
                }
            }
            catch (System.Exception exe)
            {
                XtraMessageBox.Show("Erro na Leitura da licença\n"
                                    + exe.Message, "Tente mais outra vez",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
            }
            return(modelsHelps);
        }
Example #23
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            KeyManager     km = new KeyManager(textProductID.Text);
            KeyValuesClass kv;
            string         ProductionKey = textProductKey.Text;

            kv = new KeyValuesClass()
            {
                Type    = LicenseType.FULL, Header = Convert.ToByte(9), Footer = Convert.ToByte(6), ProductCode = (byte)ProductionCode,
                Edition = Edition.ENTERPRISE, Version = 1
            };
            if (!km.GenerateKey(kv, ref ProductionKey))
            {
                textProductKey.Text = "ERROR";
            }
            textProductKey.Text = ProductionKey;
        }
Example #24
0
        public frmMain()
        {
            InitializeComponent();

            //kiem tra license
            KeyManager  km         = new KeyManager(ComputerInfo.GetComputerId());
            LicenseInfo lic        = new LicenseInfo();
            int         value      = km.LoadSuretyFile(string.Format(@"{0}\Key.lic", Application.StartupPath), ref lic);
            string      productKey = lic.ProductKey;
            bool        isActive   = false;//bien kiem tra kich hoat

            if (km.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                if (km.DisassembleKey(productKey, ref kv))
                {
                    if (kv.Type == LicenseType.TRIAL)
                    {
                        //dung thu ma con ngay thi cho chay
                        if ((kv.Expiration - DateTime.Now.Date).Days > 0)
                        {
                            isActive = true;
                        }
                    }
                    else
                    {
                        isActive = true;
                    }
                }
            }

            if (isActive)
            {
                //da kich hoat thi load url camera
                LoadUrlCamera();
            }
            else
            {
                using (frmRegistration frm = new frmRegistration())
                {
                    frm.ShowDialog();
                }
            }
        }
Example #25
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            KeyManager     km = new KeyManager(txtProductID.Text);
            KeyValuesClass kv;
            string         productKey = string.Empty;

            if (cboLicenseType.SelectedIndex == 0)
            {
                kv = new KeyValuesClass()
                {
                    Type        = LicenseType.FULL,
                    Header      = Convert.ToByte(9),
                    Footer      = Convert.ToByte(6),
                    ProductCode = (byte)ProductCode,
                    Edition     = Edition.ENTERPRISE,
                    Version     = 1
                };

                if (!km.GenerateKey(kv, ref productKey))
                {
                    txtProductKey.Text = "ERROR";
                }
            }
            else
            {
                kv = new KeyValuesClass()
                {
                    Type        = LicenseType.TRIAL,
                    Header      = Convert.ToByte(9),
                    Footer      = Convert.ToByte(6),
                    ProductCode = (byte)ProductCode,
                    Edition     = Edition.ENTERPRISE,
                    Version     = 1,
                    Expiration  = DateTime.Now.Date.AddDays(Convert.ToInt32(txtExperience.Text))
                };

                if (!km.GenerateKey(kv, ref productKey))
                {
                    txtProductKey.Text = "ERROR";
                }
            }

            txtProductKey.Text = productKey;
        }
        public void LicenKey()
        {
            KeyManager  km  = new KeyManager(ComputerInfo.GetComputerId());
            LicenseInfo lic = new LicenseInfo();
            //Get license information from license file
            int    value      = km.LoadSuretyFile(string.Format(@"{0}\active.lic", Application.StartupPath), ref lic);
            string productKey = lic.ProductKey;

            //Check valid
            if (km.ValidKey(ref productKey))
            {
                KeyValuesClass kv = new KeyValuesClass();
                //Decrypt license key
                if (km.DisassembleKey(productKey, ref kv))
                {
                    getLicenKey = productKey;
                }
            }
        }
Example #27
0
 private void _btnRegister_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(_txtProductId.Text.Trim()))
     {
         MessageBox.Show("Vui lòng nhập mã sản phẩm.", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         KeyManager km         = new KeyManager(_txtProductId.Text);
         string     productkey = _txtProductKey.Text;
         if (km.ValidKey(ref productkey))
         {
             KeyValuesClass kv = new KeyValuesClass();
             if (km.DisassembleKey(productkey, ref kv))
             {
                 LicenseInfo lic = new LicenseInfo();
                 lic.ProductKey = productkey;
                 lic.FullName   = "Phần mềm chấm điểm";
                 if (kv.Type == LicenseType.TRIAL)
                 {
                     lic.Day   = kv.Expiration.Day;
                     lic.Month = kv.Expiration.Month;
                     lic.Year  = kv.Expiration.Year;
                 }
                 if (kv.Type == LicenseType.TRIAL && (kv.Expiration - DateTime.Now.Date).Days <= 0)
                 {
                     MessageBox.Show("Mã sản phẩm đã hết hạn. Vui lòng điền mã sản phẩm khác để sử dụng.", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     km.SaveSuretyFile(string.Format(@"{0}\Key.lic", Application.StartupPath), lic);
                     MessageBox.Show("Bạn đã kích hoạt thành công.", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     this.Close();
                 }
             }
         }
         else
         {
             MessageBox.Show("Mã sản phẩm bạn nhập không chính xác.\nVui lòng kiểm tra lại mã sản phẩm.", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Example #28
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            KeyManager     km = new KeyManager(txt_proudect.Text);
            KeyValuesClass kv;
            string         proudectKey = string.Empty;

            if (Cmb_Licence.SelectedIndex == 0)
            {
                kv = new KeyValuesClass()
                {
                    Type        = LicenseType.FULL,
                    Header      = Convert.ToByte(9),
                    Footer      = Convert.ToByte(6),
                    ProductCode = (byte)proudectCode,
                    Edition     = Edition.ENTERPRISE,
                    Version     = 1
                };
                if (!km.GenerateKey(kv, ref proudectKey))
                {
                    Txt_key.Text = "error";
                }
            }
            else
            {
                kv = new KeyValuesClass()
                {
                    Type        = LicenseType.TRIAL,
                    Header      = Convert.ToByte(9),
                    Footer      = Convert.ToByte(6),
                    ProductCode = (byte)proudectCode,
                    Edition     = Edition.ENTERPRISE,
                    Expiration  = DateTime.Now.Date.AddDays(Convert.ToInt32(Txt_Day.Text)),
                };
                if (!km.GenerateKey(kv, ref proudectKey))
                {
                    Txt_key.Text = "error";
                }
            }

            Txt_key.Text = proudectKey;
        }
        private void btnGenerate_Click(object sender, RoutedEventArgs e)
        {
            KeyManager     km = new KeyManager(txtProductID.Text);
            KeyValuesClass kv;
            string         productKey = string.Empty;

            if (cbbLicenseType.SelectedItem.ToString() == "FULL")
            {
                kv = new KeyValuesClass()
                {
                    Type        = LicenseType.FULL,
                    Header      = Convert.ToByte(9),
                    Footer      = Convert.ToByte(6),
                    ProductCode = (byte)ProductCode,//As order of your software
                    Edition     = Edition.ENTERPRISE,
                    Version     = 1
                };
                if (!km.GenerateKey(kv, ref productKey))//Generate full license key
                {
                    txtProductKey.Text = "ERROR";
                }
            }
            else if (cbbLicenseType.SelectedItem.ToString() == "TRIAL")
            {
                kv = new KeyValuesClass()
                {
                    Type        = LicenseType.TRIAL,
                    Header      = Convert.ToByte(9),
                    Footer      = Convert.ToByte(6),
                    ProductCode = (byte)ProductCode,
                    Edition     = Edition.ENTERPRISE,
                    Version     = 1,
                    Expiration  = DateTime.Now.Date.AddDays(Convert.ToInt32(txtExperienceDays.Text))
                };
                if (!km.GenerateKey(kv, ref productKey))//Generate trial license key
                {
                    txtProductKey.Text = "ERROR";
                }
            }
            txtProductKey.Text = productKey;
        }
Example #30
0
        private void btnReg_Click(object sender, RoutedEventArgs e)
        {
            KeyManager key        = new KeyManager(textProductId.Text);
            string     productKey = textSerialKey.Text;

            try
            {
                if (key.ValidKey(ref productKey))
                {
                    KeyValuesClass kv = new KeyValuesClass();
                    if (key.DisassembleKey(productKey, ref kv))
                    {
                        LicenseInfo lic = new LicenseInfo();
                        lic.FullName   = "TRIMG AIR LINES";
                        lic.ProductKey = productKey;
                        if (key.SaveSuretyFile("Key.lic", lic))
                        {
                            Helpers.ShowMessage("Sukes Registrasi");
                            this.Success = true;
                            this.Close();
                        }
                        else
                        {
                            throw new SystemException("Serial Key Tidak Tersimpan !");
                        }
                    }
                    else
                    {
                        throw new SystemException("Invalid Registration !");
                    }
                }
                else
                {
                    throw new SystemException("Serial Key Invalid !");
                }
            }
            catch (Exception ex)
            {
                Helpers.ShowMessage(ex.Message);
            }
        }