LJInstallGlobal.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using System.IO;
  2. using System.Reflection;
  3. using LJLib.Tools.File;
  4. namespace LJLib.InstallHelper
  5. {
  6. static class LJInstallGlobal
  7. {
  8. private const string section = "E0A0E72ECA4D4BEC950A4A3B1E75DC0F";
  9. public static string CurrentPath
  10. {
  11. get
  12. {
  13. return Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Replace("file:\\", "");
  14. }
  15. }
  16. public static string FileName
  17. {
  18. get
  19. {
  20. return Path.GetFileName(Assembly.GetExecutingAssembly().GetName().CodeBase);
  21. }
  22. }
  23. public static string XmlFile
  24. {
  25. get
  26. {
  27. return FileName + ".xml";
  28. }
  29. }
  30. public static void SetValue(string key, string value)
  31. {
  32. string xmlfile = CurrentPath + "\\" + XmlFile;
  33. XmlConfig xmlconfig = new XmlConfig();
  34. xmlconfig.SetXmlFileValue(xmlfile, section, key, value);
  35. }
  36. public static string GetValue(string key)
  37. {
  38. string xmlfile = CurrentPath + "\\" + XmlFile;
  39. XmlConfig xmlconfig = new XmlConfig();
  40. return xmlconfig.GetXmlFileValue(xmlfile, section, key, string.Empty);
  41. }
  42. public static string ServerName
  43. {
  44. get
  45. {
  46. return GetValue("ServerName");
  47. }
  48. set
  49. {
  50. SetValue("ServerName", value);
  51. }
  52. }
  53. public static string DisplayName
  54. {
  55. get
  56. {
  57. return GetValue("DisplayName");
  58. }
  59. set
  60. {
  61. SetValue("DisplayName", value);
  62. }
  63. }
  64. public static string Description
  65. {
  66. get
  67. {
  68. return GetValue("Description");
  69. }
  70. set
  71. {
  72. SetValue("Description", value);
  73. }
  74. }
  75. public static string ImagePath
  76. {
  77. get
  78. {
  79. return GetValue("ImagePath");
  80. }
  81. set
  82. {
  83. SetValue("ImagePath", value);
  84. }
  85. }
  86. }
  87. }