using ComPDFKit.NativeMethod;
using Compdfkit_Tools.Helper;
using System.IO;
using System.Reflection;
using System.Windows;
using System.Xml;
using static ComPDFKit.NativeMethod.CPDFSDKVerifier;

namespace Viewer
{ 
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    /// 
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            string str = this.GetType().Assembly.Location;
            base.OnStartup(e);
            LicenseVerify();
        }

        private static bool LicenseVerify()
        {
            bool result = LoadNativeLibrary();
            if (!result)
                return false;

            SDKLicenseHelper sdkLicenseHelper = new SDKLicenseHelper();

            LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(sdkLicenseHelper.key, sdkLicenseHelper.secret);
            if (verifyResult != LicenseErrorCode.LICENSE_ERR_SUCCESS)
                return false;
            return result;
        }
    }
}