LocalPath.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /*******************************************************************************
  2. * Copyright(c) 2012 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:LocalPath.cs
  5. * 2.功能描述:系统各种路径的取得
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 欧阳涛 2012/06/07 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Text;
  12. namespace Dongke.IBOSS.PRD.Basics.Library
  13. {
  14. /// <summary>
  15. /// 系统各种路径的取得
  16. /// </summary>
  17. public class LocalPath
  18. {
  19. static LocalPath()
  20. {
  21. try
  22. {
  23. // 取得程序运行的路径
  24. StringBuilder personalDataSavePath = new StringBuilder();
  25. personalDataSavePath.Append(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));
  26. personalDataSavePath.Append(@"\");
  27. personalDataSavePath.Append(@"DongkeSoft\IBOSSPRD");
  28. personalDataSavePath.Append(@"\");
  29. // 根路径
  30. RootPath = personalDataSavePath.ToString();
  31. // 错误日志路径
  32. LogRootPath = RootPath + @"Log\";
  33. // 缓存路径&文件名
  34. CacheRootPath = RootPath + @"CacheData\";
  35. CacheFileName = CacheRootPath + "Cache_{0}.cache";
  36. // DataGridView设置保存路径&文件名
  37. GridSettingRoot = RootPath + @"GridSetting\";
  38. GridSettingFileName = GridSettingRoot + "Grid_{0}_{1}.grid";
  39. // 自动更新文件下载路径
  40. InstallerDownloadPath = RootPath + @"UpDownload\";
  41. // 自动更新文件下载路径
  42. InstallerPublicDownloadPath = RootPath + @"UpPublicDownload\";
  43. // 即时通讯本地存储
  44. MessagePath = RootPath + @"Message\";
  45. ExePath = System.AppDomain.CurrentDomain.BaseDirectory;
  46. LogExePath = ExePath + @"Log\";
  47. INIFilePath= LocalPath.RootPath + BaseResources.Constant.INI_FILE_NAME;
  48. LocalINIFilePath = System.AppDomain.CurrentDomain.BaseDirectory + BaseResources.Constant.INI_FILE_NAME;
  49. }
  50. catch (Exception ex)
  51. {
  52. throw ex;
  53. }
  54. }
  55. #region 属性
  56. /// <summary>
  57. /// exe所在目录
  58. /// </summary>
  59. public static string ExePath
  60. {
  61. get;
  62. set;
  63. }
  64. /// <summary>
  65. /// INI文件路径(废弃)
  66. /// </summary>
  67. public static string INIFilePath
  68. {
  69. get;
  70. set;
  71. }
  72. /// <summary>
  73. /// INI文件路径
  74. /// </summary>
  75. public static string LocalINIFilePath
  76. {
  77. get;
  78. set;
  79. }
  80. /// <summary>
  81. /// exe log 所在目录
  82. /// </summary>
  83. public static string LogExePath
  84. {
  85. get;
  86. set;
  87. }
  88. /// <summary>
  89. /// 程序根目录的名称
  90. /// </summary>
  91. public static string RootPath
  92. {
  93. get;
  94. set;
  95. }
  96. /// <summary>
  97. /// 日志存放位置
  98. /// </summary>
  99. public static string LogRootPath
  100. {
  101. get;
  102. set;
  103. }
  104. /// <summary>
  105. /// 缓存存放位置
  106. /// </summary>
  107. public static string CacheRootPath
  108. {
  109. get;
  110. set;
  111. }
  112. /// <summary>
  113. /// 缓存文件名称
  114. /// </summary>
  115. public static string CacheFileName
  116. {
  117. get;
  118. set;
  119. }
  120. /// <summary>
  121. /// DataGridView设置存放位置
  122. /// </summary>
  123. public static string GridSettingRoot
  124. {
  125. get;
  126. set;
  127. }
  128. /// <summary>
  129. /// 保存DataGridView设置的文件名
  130. /// </summary>
  131. public static string GridSettingFileName
  132. {
  133. get;
  134. set;
  135. }
  136. /// <summary>
  137. /// 自动更新下载路径
  138. /// </summary>
  139. public static string InstallerDownloadPath
  140. {
  141. get;
  142. set;
  143. }
  144. public static string InstallerPublicDownloadPath
  145. {
  146. get;
  147. set;
  148. }
  149. /// <summary>
  150. /// 消息路径
  151. /// </summary>
  152. public static string MessagePath
  153. {
  154. get;
  155. set;
  156. }
  157. #endregion
  158. }
  159. }