12345678910111213141516171819202122232425262728293031323334353637 |
- Imports ComPDFKit.NativeMethod
- Imports System
- Imports System.Xml
- Public NotInheritable Class SDKLicenseHelper
- Public Shared key As String = String.Empty
- Public Shared secret As String = String.Empty
- Public Shared Function LicenseVerify() As Boolean
- Dim sdkLicensePath As String = "license_key_windows.xml"
- Dim xmlDocument As New XmlDocument()
- xmlDocument.Load(sdkLicensePath)
- Dim keyNode As XmlNode = xmlDocument.SelectSingleNode("/license/key")
- Dim secretNode As XmlNode = xmlDocument.SelectSingleNode("/license/secret")
- If keyNode IsNot Nothing AndAlso secretNode IsNot Nothing Then
- key = keyNode.InnerText
- secret = secretNode.InnerText
- Else
- Console.WriteLine("Key or secret element not found in the XML.")
- Return False
- End If
- Dim result As Boolean = CPDFSDKVerifier.LoadNativeLibrary()
- If Not result Then
- Return False
- End If
- Dim verifyResult As LicenseErrorCode = CPDFSDKVerifier.LicenseVerify(key, secret)
- If verifyResult <> LicenseErrorCode.LICENSE_ERR_SUCCESS Then
- Return False
- End If
- Return result
- End Function
- End Class
|