Пример #1
0
        private void LoadLicenseFile()
        {
            if (LicenseOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                MOG_TimeBomb timeBomb = new MOG_TimeBomb(LicenseOpenFileDialog.FileName);
                if (timeBomb.IsValid())
                {
                    mLicenseFile = LicenseOpenFileDialog.FileName;
                    LicenseRichTextBox.Enabled = true;

                    LicenseRichTextBox.Text  = "";
                    LicenseRichTextBox.Text += "Licence file: " + LicenseOpenFileDialog.FileName + "\n\n";
                    LicenseRichTextBox.Text += "Licenced server MAC address:" + timeBomb.GetRegisteredMacAddress() + "\n";
                    LicenseRichTextBox.Text += "License Creation Date:" + timeBomb.GetInstallDate().ToString() + "\n";
                    LicenseRichTextBox.Text += "License Expiration Date:" + timeBomb.GetExpireDate().ToString() + "\n\n";
                    LicenseRichTextBox.Text += "Total Licenses:" + timeBomb.GetClientLicenseCount().ToString() + "\n\n";
                    LicenseRichTextBox.Text += "Disabled Features:" + timeBomb.GetDisabledFeatureList().Trim("[]".ToCharArray()) + "\n";
                }
                else
                {
                    MessageBox.Show("File (" + LicenseOpenFileDialog.FileName + ")\ndoes not seem to be a valid license file", "Incompatible License!", MessageBoxButtons.OK);
                    LicenseRichTextBox.Enabled = false;
                }
            }
        }
        private bool PopulateLicenseInfo(MOG_TimeBomb timeBomb, string licenseFilename)
        {
            if (timeBomb.IsValid())
            {
                mLicenseFile = licenseFilename;
                LicenseRichTextBox.Enabled = true;

                LicenseRichTextBox.Text  = "";
                LicenseRichTextBox.Text += "Licence file: " + licenseFilename + "\n\n";
                LicenseRichTextBox.Text += "Licenced server MAC address:" + timeBomb.GetRegisteredMacAddress() + "\n";
                LicenseRichTextBox.Text += "License Creation Date:" + timeBomb.GetInstallDate().ToString() + "\n";
                LicenseRichTextBox.Text += "License Expiration Date:" + timeBomb.GetExpireDate().ToString() + "\n\n";
                LicenseRichTextBox.Text += "Total Licenses:" + timeBomb.GetClientLicenseCount().ToString() + "\n\n";
                LicenseRichTextBox.Text += "Disabled Features:" + timeBomb.GetDisabledFeatureList().Trim("[]".ToCharArray()) + "\n";

                return(true);
            }
            else
            {
                LicenseRichTextBox.Text  = "UnLicenced Server\n";
                LicenseRichTextBox.Text += "Total UnLicensed Connections: 4 \n\n";
                return(false);
            }
        }