123456789101112131415161718192021222324252627282930313233343536 |
- using ComPDFKit.NativeMethod;
- using System.Xml;
- public static class SDKLicenseHelper
- {
- public static string ParseLicenseXML()
- {
- try
- {
- XmlDocument xmlDocument = new XmlDocument();
- xmlDocument.Load("license_key_windows.xml");
- XmlNode xmlNode = xmlDocument.SelectSingleNode("/license/key");
- if (xmlNode == null)
- {
- return string.Empty;
- }
- else
- {
- return xmlNode.InnerText;
- }
- }
- catch
- {
- return string.Empty;
- }
- }
- public static bool LicenseVerify()
- {
- if (!CPDFSDKVerifier.LoadNativeLibrary())
- return false;
- LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(ParseLicenseXML(), false);
- return (verifyResult == LicenseErrorCode.E_LICENSE_SUCCESS);
- }
- }
|