public CredentialsManager(string pi_propertyname, string pi_contractnumber, string pi_install, int pi_propertyid)
        {
            m_Encryptor = KeyValidate.getKeyValidator("TR_TP", pi_propertyname, pi_contractnumber, pi_install);

            if (m_Encryptor == null)
            {
                throw(new Exception("Either the Install Key, Property Name, or Contract Number is wrong..."));
            }
            else
            {
                m_IniFileName = m_Utils.AppPath + "ENC_FILE.ini";
                this.loadProps();
                UserSecurityInfo info = this.getServiceConnectionInfo();
                this.m_TPUserID   = info.LogName;
                this.m_TPPassword = info.Password;
            }
        }
Example #2
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            if (m_CustomKeyValidate == null)
            {
                return;
            }

            if (tbCustomSerialNo.Text.Length <= 0)
            {
                return;
            }

            if (m_CustomKeyValidate.IsValid == false)
            {
                return;
            }

            tbVerificationCode.Text = m_KeyGen.GenKey(Convert.ToInt32(numVerifyDaysLeft.Value), m_CustomKeyValidate.DecodedMachineCode);

            m_Verify = m_KeyGen.ValidateGenKey(tbVerificationCode.Text);

            if (m_Verify.IsValid == false)
            {
                lblVerifyIsValidValue.Text = "X";

                lblVerifyIsValidValue.Visible      = false;
                lblVerifyCreationDateValue.Visible = false;
                lblVerifyMachineCodeValue.Visible  = false;
                lblVerifyExpiredDateValue.Visible  = false;
            }
            else
            {
                lblVerifyIsValidValue.Text = "O";

                lblVerifyIsValidValue.Visible      = true;
                lblVerifyCreationDateValue.Visible = true;
                lblVerifyMachineCodeValue.Visible  = true;
                lblVerifyExpiredDateValue.Visible  = true;

                lblVerifyCreationDateValue.Text = m_Verify.CreationDate.ToString("yyyy/MM/dd hh:mm:ss");
                lblVerifyExpiredDateValue.Text  = m_Verify.ExpireDate.ToString("yyyy/MM/dd hh:mm:ss");
                lblVerifyMachineCodeValue.Text  = m_Verify.DecodedMachineCode.ToString();
            }
        }
Example #3
0
        private void BtnFixed_Click(object sender, EventArgs e)
        {
            //先產生一組序號;//
            string sn = m_KeyGen.GenKey(30);

            //取得此SN的機械碼;//
            m_CustomKeyValidate = m_KeyGen.ValidateGenKey(sn);
            string machineCode = m_CustomKeyValidate.DecodedMachineCode.ToString();

            //判斷是否為指定的電腦,不是的話不可使用此程式;//
            if (machineCode != tbGiveCPU.Text)
            {
                MessageBox.Show(this, "非指定電腦,不允許進行此操作!", "訊息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //進行序號修復;//
            m_KeyGen.SaveSN(tbGiveSN.Text);

            //更新本機電腦資訊;//
            tbCurrentSN.Text = m_KeyGen.GetKeyFromRegistry();
        }
Example #4
0
        private void tbCustomSerialNo_TextChanged(object sender, EventArgs e)
        {
            if (tbCustomSerialNo.Text.Length <= 0)
            {
                return;
            }

            m_CustomKeyValidate = m_KeyGen.ValidateGenKey(tbCustomSerialNo.Text);

            lblCustomIsValidValue.Visible = true;

            if (m_CustomKeyValidate.IsValid == false)
            {
                lblCustomIsValidValue.Text = "X";

                lblCustomCreationDateValue.Visible = false;
                lblCustomMachineCodeValue.Visible  = false;
                lblCustomIsExpiredValue.Visible    = false;
                lblCustomExpiredDateValue.Visible  = false;
                lblCustomDaysLeftValue.Visible     = false;
            }
            else
            {
                lblCustomIsValidValue.Text = "O";

                lblCustomCreationDateValue.Visible = true;
                lblCustomMachineCodeValue.Visible  = true;
                lblCustomIsExpiredValue.Visible    = true;
                lblCustomExpiredDateValue.Visible  = true;
                lblCustomDaysLeftValue.Visible     = true;

                lblCustomIsExpiredValue.Text    = m_CustomKeyValidate.IsExpired == false ? "O" : "X";
                lblCustomCreationDateValue.Text = m_CustomKeyValidate.CreationDate.ToString("yyyy/MM/dd hh:mm:ss");
                lblCustomExpiredDateValue.Text  = m_CustomKeyValidate.ExpireDate.ToString("yyyy/MM/dd hh:mm:ss");
                lblCustomMachineCodeValue.Text  = m_CustomKeyValidate.DecodedMachineCode.ToString();
                lblCustomDaysLeftValue.Text     = m_CustomKeyValidate.DaysLeft.ToString();
            }
        }