// Shows how to obtain the serial number of the active license, and determine whether it is a stock demo or trial license.
// You can use any OPC UA client, including our Connectivity Explorer and OpcCmd utility, to connect to the server.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client, server and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-OPCStudio-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.
using System;
using OpcLabs.EasyOpc.UA;
namespace UAServerDocExamples.Licensing
{
partial class LicenseInfo
{
public static void SerialNumber()
{
// Instantiate the server object.
var server = new EasyUAServer();
// Obtain the serial number from the license info.
long serialNumber = (uint)server.LicenseInfo["Multipurpose.SerialNumber"];
// Display the serial number.
Console.WriteLine("SerialNumber: {0}", serialNumber);
// Determine whether we are running as demo or trial.
if ((1111110000 <= serialNumber) && (serialNumber <= 1111119999))
Console.WriteLine("This is a stock demo or trial license.");
else
Console.WriteLine("This is not a stock demo or trial license.");
}
}
}
' Shows how to obtain the serial number of the active license, and determine whether it is a stock demo or trial license.
' You can use any OPC UA client, including our Connectivity Explorer and OpcCmd utility, to connect to the server.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET .
' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
' a commercial license in order to use Online Forums, and we reply to every post.
Imports OpcLabs.EasyOpc.UA
Namespace Licensing
Partial Friend Class LicenseInfo
Shared Sub SerialNumber()
' Instantiate the server object.
Dim server = New EasyUAServer()
' Obtain the serial number from the license info.
Dim serialNumber As Long = CUInt(server.LicenseInfo("Multipurpose.SerialNumber"))
' Display the serial number.
Console.WriteLine("SerialNumber: {0}", serialNumber)
' Determine whether we are running as demo or trial.
If (1111110000 <= serialNumber) And (serialNumber <= 1111119999) Then
Console.WriteLine("This is a stock demo or trial license.")
Else
Console.WriteLine("This is not a stock demo or trial license.")
End If
End Sub
End Class
End Namespace