constants.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Xml;
  6. namespace CollectInformation.Tools
  7. {
  8. public static class constants
  9. {
  10. public static string urlbase = "http://broadcast.kqyjy.com";
  11. public static string host = urlbase + "/api/";
  12. public static string filehost = urlbase + "/files/{0}/{1}_{2}_{3}/upload";
  13. public static string fetch = "usual/{0}/fetch";
  14. public static string update = "usual/{0}/update";
  15. public static string install = "usual/{0}";
  16. public static string tempFiles = "tempFiles\\";
  17. public static string userToken = null;
  18. public static string loginName = "";
  19. public static string loginpwd = "";
  20. public static string saveName = "0";
  21. public static string savePwd = "0";
  22. public static void init(string path)
  23. {
  24. try
  25. {
  26. XmlDocument xdoc = new XmlDocument();
  27. xdoc.Load(path + "\\config.xml");
  28. XmlNode configNode = xdoc.FirstChild;
  29. constants.urlbase = configNode.SelectSingleNode("urlbase").InnerText;
  30. constants.host = constants.urlbase + "/api/";
  31. constants.filehost = constants.urlbase + "/files/{0}/{1}_{2}_{3}/upload";
  32. constants.loginName = configNode.SelectSingleNode("loginName").InnerText;
  33. constants.loginpwd = configNode.SelectSingleNode("password").InnerText;
  34. constants.saveName = configNode.SelectSingleNode("saveName").InnerText;
  35. constants.savePwd = configNode.SelectSingleNode("savePwd").InnerText;
  36. }
  37. catch (Exception e)
  38. {
  39. }
  40. }
  41. }
  42. }