NetSeal_Helper.NetSeal.LicenseManager.LicenseWriter.WriteLicense C# (CSharp) Method

WriteLicense() private method

private WriteLicense ( string path, string netsealId, string guid, bool remember, string username, string password, FileAttributes attributes ) : void
path string
netsealId string
guid string
remember bool
username string
password string
attributes FileAttributes
return void
        internal void WriteLicense(string path, string netsealId, string guid, bool remember, string username, string password, FileAttributes attributes = 0)
        {
            if (string.IsNullOrWhiteSpace(path))
                throw new Exception(nameof(path));

            var licenseFile = new LicenseFile
            {
                GUID = guid,
                Remember = remember,
                Username = username,
                Sha1Password = password
            };

            InternalWriteLicense(path, netsealId, licenseFile, attributes);
        }

Same methods

LicenseWriter::WriteLicense ( string path, string netsealId, NetSeal_Helper.NetSeal.LicenseManager.LicenseFile licenseFile, FileAttributes attributes ) : void

Usage Example

Example #1
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();
                }
            }

        }
All Usage Examples Of NetSeal_Helper.NetSeal.LicenseManager.LicenseWriter::WriteLicense