The following code sample shows example usage of the facility:
using Slps.ProtectionAttributes;
public class MyCode
{
public void WillNotBeProtectedUnlessOneChecksTheMethodInCodeProtector()
{
}
[Feature( "FeatureA" )]
public void WillBeTiedToFeatureA()
{
}
[Feature( "Execute" )]
public void WillBeProtectedButNotTiedToASpecificFeature()
{
}
}
Each method marked with FeatureAttribute will be automatically included in the candidates for automated protection via any of the protection approaches :
When using the FeatureAttribute it is still necessary to generate a Code Protector .SLMCfg configuration file but it is NOT necessary to manually select any methods for protection/licensing.
NB one should specify protection for a method either via the .SLMCfg file or via the FetureAttribute - not both.
Notes:
- Version 3.0.1910 and later of Code Protector had an additional [Transform] attribute; due to a bug in its implementation this is now deprecated and one should immediately replace all instances of [Transform] with [Feature(“Execute”)].
- Releases of Code Protector prior to 3.0.1908.1027 had a bug which may cause the protected method to throw an exception on execution if you don't have any explicitly protected methods in an assembly.
- Code Protector versions prior to 3.0.1910 had a single attribute, SLMTransformAttribute only - this remains in the SDK for backward compatibility purposes.