|
@@ -1,38 +1,16 @@
|
|
|
using ComPDFKit.NativeMethod;
|
|
|
using System;
|
|
|
using System.Xml;
|
|
|
+using static ComPDFKit.NativeMethod.CPDFSDKVerifier;
|
|
|
|
|
|
public static class SDKLicenseHelper
|
|
|
-{
|
|
|
- public static string key = string.Empty;
|
|
|
- public static string secret = string.Empty;
|
|
|
-
|
|
|
+{
|
|
|
public static bool LicenseVerify()
|
|
|
{
|
|
|
- string sdkLicensePath = "license_key_windows.xml";
|
|
|
- XmlDocument xmlDocument = new XmlDocument();
|
|
|
- xmlDocument.Load(sdkLicensePath);
|
|
|
-
|
|
|
- XmlNode keyNode = xmlDocument.SelectSingleNode("/license/key");
|
|
|
- XmlNode secretNode = xmlDocument.SelectSingleNode("/license/secret");
|
|
|
-
|
|
|
- if (keyNode != null && secretNode != null)
|
|
|
- {
|
|
|
- key = keyNode.InnerText;
|
|
|
- secret = secretNode.InnerText;
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- Console.WriteLine("Key or secret element not found in the XML.");
|
|
|
- }
|
|
|
- bool result = CPDFSDKVerifier.LoadNativeLibrary();
|
|
|
- if (!result)
|
|
|
+ if (!LoadNativeLibrary())
|
|
|
return false;
|
|
|
|
|
|
- LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(key, secret);
|
|
|
- if (verifyResult != LicenseErrorCode.LICENSE_ERR_SUCCESS)
|
|
|
- return false;
|
|
|
- return result;
|
|
|
+ LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify("license_key_windows.txt", true);
|
|
|
+ return (verifyResult != LicenseErrorCode.E_LICENSE_SUCCESS);
|
|
|
}
|
|
|
}
|