public override System.ComponentModel.License GetLicense(System.ComponentModel.LicenseContext context, Type type, object instance, bool allowExceptions) { if (context.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime) { // Creating a special DesigntimeLicense will able you to design your // control without breaking Visual Studio in the process return(new DesigntimeLicense( )); } /* * byte[ ] existingSerialKey = getExistingSerial( ); * // Algorithm can be SHA1CryptoServiceProvider for instance * byte[ ] data = System.Security.Cryptography.HashAlgorithm.Create( ).ComputeHash( * username, * dateRequested, * validUntilDate, * // any other data you would like to validate * ); * // todo: also check if licensing period is over here. ;-) * for( int i = 0; i < existingSerialKey.Length; ++i ) * { * if( existingSerialKey[ i ] != data[ i ] ) * { * if( allowExceptions ) * { * throw new LicenseException( type, instance, "License is invalid" ); * } * return null; * } * } */ // RuntimeLicense can be anything inheriting from License return(new RuntimeLicense( )); }
public static bool _GetLicense_System_ComponentModel_LicFileLicenseProvider_System_ComponentModel_LicenseContext_System_Type_System_Object_System_Boolean( ) { //Parameters System.ComponentModel.LicenseContext context = null; System.Type type = null; System.Object instance = null; System.Boolean allowExceptions = null; //ReturnType/Value System.ComponentModel.License returnVal_Real = null; System.ComponentModel.License returnVal_Intercepted = null; //Exception Exception exception_Real = null; Exception exception_Intercepted = null; InterceptionMaintenance.disableInterception( ); try { returnValue_Real = System.ComponentModel.LicFileLicenseProvider.GetLicense(context, type, instance, allowExceptions); } catch (Exception e) { exception_Real = e; } InterceptionMaintenance.enableInterception( ); try { returnValue_Intercepted = System.ComponentModel.LicFileLicenseProvider.GetLicense(context, type, instance, allowExceptions); } catch (Exception e) { exception_Intercepted = e; } Return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted)); }
public static bool _CreateWithContext_System_Type_System_ComponentModel_LicenseContext( ) { //Parameters System.Type type = null; System.ComponentModel.LicenseContext creationContext = null; //ReturnType/Value System.Object returnVal_Real = null; System.Object returnVal_Intercepted = null; //Exception Exception exception_Real = null; Exception exception_Intercepted = null; InterceptionMaintenance.disableInterception( ); try { returnValue_Real = System.ComponentModel.LicenseManager.CreateWithContext(type, creationContext); } catch (Exception e) { exception_Real = e; } InterceptionMaintenance.enableInterception( ); try { returnValue_Intercepted = System.ComponentModel.LicenseManager.CreateWithContext(type, creationContext); } catch (Exception e) { exception_Intercepted = e; } Return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted)); }