LicenseKey.vb 950 B

123456789101112131415161718192021222324252627282930
  1. Imports System
  2. Imports System.Xml
  3. Imports ComPDFKit.NativeMethod
  4. Public NotInheritable Class SDKLicenseHelper
  5. Public Shared Function ParseLicenseXML() As String
  6. Try
  7. Dim xmlDocument As New XmlDocument()
  8. xmlDocument.Load("license_key_windows.xml")
  9. Dim xmlNode As XmlNode = xmlDocument.SelectSingleNode("/license/key")
  10. If xmlNode Is Nothing Then
  11. Return String.Empty
  12. Else
  13. Return xmlNode.InnerText
  14. End If
  15. Catch
  16. Return String.Empty
  17. End Try
  18. End Function
  19. Public Shared Function LicenseVerify() As Boolean
  20. If Not CPDFSDKVerifier.LoadNativeLibrary() Then
  21. Return False
  22. End If
  23. Dim verifyResult As LicenseErrorCode = CPDFSDKVerifier.LicenseVerify(ParseLicenseXML(), False)
  24. Return (verifyResult <> LicenseErrorCode.E_LICENSE_SUCCESS)
  25. End Function
  26. End Class