OPC Studio User's Guide and Reference
RegisterFile Method



OpcLabs.BaseLib Assembly > OpcLabs.BaseLib.ComponentModel Namespace > LicensingManagement Class : RegisterFile Method
Name of the licensing component for which the location of the license key should be registered. Consult the documentation for the value that corresponds to your product.

The value of this parameter cannot be null (Nothing in Visual Basic).

ID of the license key for whose location should be registered. Consult the documentation for the values to be used with your product.

The value of this parameter cannot be null (Nothing in Visual Basic).

The name of the file containing the license.

The value of this parameter cannot be null (Nothing in Visual Basic).

Registers a license key located in a file.
Syntax
'Declaration
 
Public Sub RegisterFile( _
   ByVal componentName As String, _
   ByVal licenseId As String, _
   ByVal filePath As String _
) 
'Usage
 
Dim instance As LicensingManagement
Dim componentName As String
Dim licenseId As String
Dim filePath As String
 
instance.RegisterFile(componentName, licenseId, filePath)
public void RegisterFile( 
   string componentName,
   string licenseId,
   string filePath
)
public:
void RegisterFile( 
   String^ componentName,
   String^ licenseId,
   String^ filePath
) 

Parameters

componentName
Name of the licensing component for which the location of the license key should be registered. Consult the documentation for the value that corresponds to your product.

The value of this parameter cannot be null (Nothing in Visual Basic).

licenseId
ID of the license key for whose location should be registered. Consult the documentation for the values to be used with your product.

The value of this parameter cannot be null (Nothing in Visual Basic).

filePath
The name of the file containing the license.

The value of this parameter cannot be null (Nothing in Visual Basic).

Exceptions
ExceptionDescription
A license key file is already registered for componentName and licenseId.

A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception.

An invalid Uniform Resource Identifier (URI) was detected.
Remarks

The same combination of componentName and licenseId must not (and cannot) be registered more than once. An attempt to do so will result in an System.ArgumentException. Be careful not to put the registration code into Web request handlers (without further logic) which are called repeatedly.

The actual presence and validity of the license key is not checked at the time when the location is registered. If you want an exception be thrown when the file does not exist or is not accessible, use the RegisterFileWithExistenceCheck method.

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also