Inheritance: LicenseManagerBase
Ejemplo n.º 1
0
        private void exportLicenseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var folderDialog = new FolderBrowserDialog())
            {
                var result = folderDialog.ShowDialog();

                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    var path = folderDialog.SelectedPath;
                    var licenseWriter = new LicenseWriter();

                    int counter = 0;
                    for (var index = 0; index < ltvLicenses.SelectedIndices.Count; index++)
                    {
                        var license = this.Licenses[ltvLicenses.SelectedIndices[index]];
                        licenseWriter.WriteLicenseV2(
                            path + "\\" + license.LicenseName,
                            license.ID,
                            license.Username,
                            license.Sha1Password);

                        counter++;
                    }
                    Logger.LogInformation("Exported " + counter + " licenses");
                }
            }
        }
Ejemplo n.º 2
0
        private void changeGUIDToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ltvLicenses.SelectedIndices.Count <= 0)
                return;

            if (MessageBox.Show("Are you sure you want to change your GUID, your license may stop working after", "GUID", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
                return;


            var originalGuid = ltvLicenses.GetSubItemTextFromSelectedIndex(2);
            using (var guidForm = new frmGUIDChanger(originalGuid))
            {
                var result = guidForm.ShowDialog();

                if (result == DialogResult.OK)
                {
                    if (guidForm.NewGUID.Length != 32)
                    {
                        Logger.LogWarning("Invalid GUID");
                        return;
                    }
                    var index = ltvLicenses.SelectedIndices[0];
                    var licenseFile = Licenses[index];
                    licenseFile.GUID = guidForm.NewGUID;
                    Licenses[index] = licenseFile;

                    var writer = new LicenseWriter();
                    writer.WriteLicense(
                        writer.LocalPath + licenseFile.LicenseName,
                        licenseFile.ID,
                        licenseFile);

                    Logger.LogInformation("GUID changed, reloading licenses");
                    LoadLocalLicenses();
                }
            }

        }