I once got it working for EA-Matic (which is now free).
This is the code I had back then:
/// <summary>
/// When a user directly enters a license key that doesn't match a Sparx Systems key into the License Management dialog EA_AddInLicenseValidate is broadcast to all Enterprise Architect Add-Ins,
/// providing them with a chance to use the Add-In key to determine the level of functionality to provide.
/// When a key is retrieved from the Sparx Systems Keystore only the target Add-In will be called with the key.
/// For the Add-In to validate itself against this key, the Add-In's EA_AddinLicenseValidate handler should return true to confirm that the license has been validated.
/// As the EA_AddinLicenseValidate event is broadcast to all Add-Ins, one license can validate many Add-Ins.
/// If an Add-In elects to handle a license key by returning true to EA_AddinLicenseValidate, it is called upon to provide a description of the license key through the
/// EA_AddinLicenseGetDescription event.
/// If more than one Add-In elects to handle a license key, the first Add-In that returns true to EA_AddinLicenseValidate is queried for the license key description.
/// </summary>
/// <param name="Repository">An EA.Repository object representing the currently open Enterprise Architect model.
/// Poll its members to retrieve model data and user interface status information.</param>
/// <param name="AddinKey">The Add-in license key that has been entered in the License Management dialog.</param>
/// <returns>For the Add-in to validate against this key it should return true to indicate that the key is valid and has been handled.</returns>
public override bool EA_AddInLicenseValidate(EA.Repository Repository, string AddinKey)
{
License eaLicense = new License(AddinKey, publicKey);
if (eaLicense.isValid)
{
//the license is valid so replace the evaluation license with this one
this.license = eaLicense;
}
//debug
EAAddinFramework.Utilities.Logger.log("license.Isvalid = "+eaLicense.isValid.ToString()+" for license key: " + AddinKey);
return license.isValid;
}
/// <summary>
/// Before the Enterprise Architect License Management dialog is displayed, EA_AddInLicenseGetDescription is sent once for each Add-In key to the first Add-In that elected to handle that key.
/// The value returned by EA_AddinLicenseGetDescription is used as the key's plain text description.
/// </summary>
/// <param name="Repository">An EA.Repository object representing the currently open Enterprise Architect model.
/// Poll its members to retrieve model data and user interface status information.</param>
/// <param name="AddinKey">The Add-In license key that Enterprise Architect requires a description for.</param>
/// <returns>A String containing a plain text description of the provided AddinKey.</returns>
public override string EA_AddinLicenseGetDescription(EA.Repository Repository, string AddinKey)
{
string licensedescription = string.Empty;
License license = new License(AddinKey, publicKey);
if (license.isValid)
{
licensedescription = "License for EA-Matic issued to " + license.client;
}
return licensedescription;
}
/// <summary>
/// As an add-in writer you can distribute keys to your add-in via the Enterprise Architect Keystore providing your
/// keys are generated using a prefix that allows Enterprise Architect to identify the add-in to which they belong.
/// EA_GetSharedAddinName is called by Enterprise Architect to determine what prefix an add-in is using.
/// If a matching key is found in the keystore the License Management dialog will display the name returned
/// by EA_AddinLicenseGetDescription to your users.
/// Finally, when the user selects a key, that key will be passed to your add-in to validate
/// by calling EA_AddinLicenseValidate.
/// </summary>
/// <param name="Repository">An EA.Repository object representing the currently open Enterprise Architect model.
/// Poll its members to retrieve model data and user interface status information.</param>
/// <returns>A String containing a product name code for the provided Add-In. This will be shown in plain text at the start of any keys added to the keystore. We recommend contacting Sparx Systems directly with proposed values to ensure you don't clash with any other add-ins.
/// eg. The following keys would all be interpreted as belonging to an add-in returning "MYADDIN" from this function:
/// · MYADDIN-Test
/// · MYADDIN-{7AC4D426-9083-4fa2-93B7-25E2B7FB8DC5}
/// · MYADDIN-7AC4D426-9083-4fa2-93B7
/// · MYADDIN-25E2B7FB8DC5
/// · MYADDIN-2hDfHKA5jf0GAjn92UvqAnxwC13dxQGJtH7zLHJ9Ym8=</returns>
public override string EA_GetSharedAddinName(EA.Repository Repository)
{
return "EAMatic";
}
Geert