SDKLisenceHelper.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Reflection;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Xml;
  9. namespace PDF_Office.Helper
  10. {
  11. public class SDKLisenceHelper
  12. {
  13. /// <summary>
  14. /// 从XML文件读取sdk密钥信息
  15. /// </summary>
  16. public SDKLisenceHelper()
  17. {
  18. string xmlPath = "SDKLisence";
  19. Assembly assembly = Assembly.GetExecutingAssembly();
  20. var stream = (string)Properties.Resources.ResourceManager.GetObject(xmlPath);
  21. XmlDocument xmlDoc = new XmlDocument();
  22. xmlDoc.LoadXml(stream);
  23. var node = xmlDoc.SelectSingleNode("Lisences");
  24. if (node != null)
  25. {
  26. DevKey = node.Attributes["devKey"].Value.ToString();
  27. DevSecret = node.Attributes["devSecret"].Value.ToString();
  28. UserKey = node.Attributes["userKey"].Value.ToString();
  29. UserSecret = node.Attributes["userSecret"].Value.ToString();
  30. ConverterDevKey = node.Attributes["ConverterDevKey"].Value.ToString();
  31. ConverterDevSecret = node.Attributes["ConverterDevSecret"].Value.ToString();
  32. ConverterUserkey = node.Attributes["ConverterUserkey"].Value.ToString();
  33. ConverterUserSecret = node.Attributes["ConverterUserSecret"].Value.ToString();
  34. }
  35. }
  36. public string DevKey{ get; set; }
  37. public string DevSecret { get; set; }
  38. public string UserKey { get; set; }
  39. public string UserSecret { get; set; }
  40. public string ConverterDevKey { get; set; }
  41. public string ConverterDevSecret { get; set; }
  42. public string ConverterUserkey { get; set; }
  43. public string ConverterUserSecret{ get; set; }
  44. }
  45. }