using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace PDF_Office.Helper
{
    public  class SDKLisenceHelper
    {
        /// <summary>
        /// 从XML文件读取sdk密钥信息
        /// </summary>
        public SDKLisenceHelper()
        {
            string xmlPath = "SDKLisence";
            Assembly assembly = Assembly.GetExecutingAssembly();
            var stream =  (string)Properties.Resources.ResourceManager.GetObject(xmlPath);
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(stream);
            var node = xmlDoc.SelectSingleNode("Lisences");
            if (node != null)
            {
                DevKey = node.Attributes["devKey"].Value.ToString();
                DevSecret = node.Attributes["devSecret"].Value.ToString();
                UserKey = node.Attributes["userKey"].Value.ToString();
                UserSecret = node.Attributes["userSecret"].Value.ToString();
                ConverterDevKey = node.Attributes["ConverterDevKey"].Value.ToString();
                ConverterDevSecret = node.Attributes["ConverterDevSecret"].Value.ToString();
                ConverterUserkey = node.Attributes["ConverterUserkey"].Value.ToString();
                ConverterUserSecret = node.Attributes["ConverterUserSecret"].Value.ToString();
            }
        }

        public string DevKey{ get; set; }

        public string DevSecret { get; set; }
        public string UserKey { get; set; }
        public string UserSecret { get; set; }
        public string ConverterDevKey { get; set; }
        public string ConverterDevSecret { get; set; }
        public string ConverterUserkey { get; set; }
        public string ConverterUserSecret{ get; set; }
    }
}
