DeployLX Software Protection System

SecureLicenseManager..::..Validate Method

Searches the machine for a license and validates the limits.

Syntax

Public Shared Function Validate ( _
	instance As Object, _
	type As Type, _
	requestInfo As LicenseValidationRequestInfo _
) As SecureLicense
public static SecureLicense Validate(
	Object instance,
	Type type,
	LicenseValidationRequestInfo requestInfo
)

Parameters

instance
The object to be validated. If nullNothingnullptra null reference (Nothing in Visual Basic), type must be provided.
type
The runtime Type of the object. If nullNothingnullptra null reference (Nothing in Visual Basic), instance must be provided. If the class might be inherited by another developer you should explicitly pass the type.
requestInfo
Additional information to use during validation.

Return Value

Returns the license if found. If no license is found a NoLicenseException is thrown.

Remarks

The Validate method searches the user's machine for a license and attempts to validate the Limits. If no license can be found an exception is thrown which will halt the use of the component or can be caught and displayed to the user.

Note If the protected class will be inherited by another class in a different assembly you should pass a value for the type specifying the type of the protected class.

Validation Topics

Examples

You can check for a license in your class by calling the Validate(Object, Type, LicenseValidationRequestInfo) method as in the following code.

Visual Basic
Imports Microsoft.VisualBasic
Imports System
Imports System.Windows.Forms
Imports DeployLX.Licensing.v5

Namespace VBProtectedDll
    Public Class ProtectedClass
        Private _license As SecureLicense

        Public Sub New()
            _license = SecureLicenseManager.Validate(Me, Nothing, Nothing)
        End Sub

        Public Sub DoSomething()
            If _license.IsTrial Then
                MessageBox.Show("Hello from ProtectedClass, enjoy the trial.")
            Else
                MessageBox.Show("Hello from ProtectedClass, thanks for your purchase.")
            End If
        End Sub
    End Class
End Namespace
C#
using System;
using System.Windows.Forms;
using DeployLX.Licensing.v5;

namespace CSharpProtectedDll
{
    public class ProtectedClass
    {
        private SecureLicense _license;

        public ProtectedClass()
        {
            _license = SecureLicenseManager.Validate( this, null, null );
        }

        public void DoSomething(  )
        {
            if( _license.IsTrial )
                MessageBox.Show( "Hello from ProtectedClass, enjoy the trial." );
            else
                MessageBox.Show( "Hello from ProtectedClass, thanks for your purchase." );
        }
    }
}

Exceptions

ExceptionCondition
DeployLX.Licensing.v5..::..NoLicenseException Thrown when no valid license could be found. Check the ValidationRecords collection for a list of errors that occurred during validation. Check the CheckedLicenses collection for a list of licenses that were tried.
DeployLX.Licensing.v5..::..SecureLicenseException Thrown when there is an internal unhandled exception while searching for a valid license.

Assembly:  DeployLX.Licensing.v5 (in DeployLX.Licensing.v5.dll)

See Also