For everyone that is looking for a general idea on how to check a license for a grasshopper component, @menno provided an answer in a private conversation but he pointed out that this should be posted public so other people in the future can benefit from it. I totally agree with that
Below you can find the code that @menno provided on how implement the license check in grasshopper:
public class MyCategoryIcon : Grasshopper.Kernel.GH_AssemblyPriority
{
public override Grasshopper.Kernel.GH_LoadingInstruction PriorityLoad()
{
bool ok = CheckLicense(); // this you need to implement yourself
if (ok)
{
Grasshopper.Instances.ComponentServer.AddCategoryIcon("MyCategory", somebitmap);
Grasshopper.Instances.ComponentServer.AddCategoryShortName("MyCategory", "MyCat");
Grasshopper.Instances.ComponentServer.AddCategorySymbolName("MyCategory", 'M');
return Grasshopper.Kernel.GH_LoadingInstruction.Proceed;
}
else
{
return Grasshopper.Kernel.GH_LoadingInstruction.Abort;
}
}
}
The code above was the last piece of information I was needing to complete the license check for the grasshopper component I am developing. Keep in mind that you need to come up with your own license checking mechanism.
Below there are some extra information:
More_info_1
More_info_2