Example #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 void LoadLicenseFile()
        {
            if (LicenseOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                MOG_TimeBomb timeBomb = new MOG_TimeBomb(LicenseOpenFileDialog.FileName);
                if (PopulateLicenseInfo(timeBomb, LicenseOpenFileDialog.FileName))
                {
                    try
                    {
                        string installedLicense = Path.Combine(MOG_Main.GetExecutablePath_StripCurrentDirectory(), "mog_license");
                        File.Copy(LicenseOpenFileDialog.FileName, installedLicense, true);

                        MessageBox.Show(string.Format("Restart your server for this new license file to take effect"), "MOG License");
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(string.Format("Unable to deploy license file with error {0}!", e.Message), "MOG License");
                    }
                }
            }
        }