IPaths.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. using System;
  2. namespace Wayne.Lib.IO
  3. {
  4. /// <summary>
  5. /// Interface.
  6. /// </summary>
  7. public interface IPaths
  8. {
  9. #region Properties
  10. /// <summary>
  11. /// The root path used by Wayne applications.
  12. /// </summary>
  13. string Root { get; }
  14. /// <summary>
  15. /// The base path to all config files.
  16. /// </summary>
  17. string Config { get; }
  18. /// <summary>
  19. /// The base path to all transaction files.
  20. /// </summary>
  21. string Transactions { get; }
  22. /// <summary>
  23. /// The base path to all log files.
  24. /// </summary>
  25. string Log { get; }
  26. /// <summary>
  27. /// The complete path (including the file name) to the executable.
  28. /// </summary>
  29. string ExecutablePath { get; }
  30. /// <summary>
  31. /// The directory path to the executable.
  32. /// </summary>
  33. string ExecutableDirectory { get; }
  34. /// <summary>
  35. /// The base path to data files.
  36. /// </summary>
  37. string Data { get; }
  38. #endregion
  39. #region Methods
  40. /// <summary>
  41. /// Combines the Root path and the given subPath.
  42. /// </summary>
  43. /// <param name="subPath">The sub path (under the main path).</param>
  44. /// <returns></returns>
  45. string Combine(string subPath);
  46. /// <summary>
  47. /// Combines the Root path and the given subPath and file name.
  48. /// </summary>
  49. /// <param name="subPath">The sub path (under the main path).</param>
  50. /// <param name="subPath2">An additional sub path (or the name of a file).</param>
  51. /// <returns></returns>
  52. string Combine(string subPath, string subPath2);
  53. /// <summary>
  54. /// Returns the config path to the given config name.
  55. /// </summary>
  56. /// <param name="configName">The name of the config.</param>
  57. /// <returns></returns>
  58. string GetConfigPath(string configName);
  59. /// <summary>
  60. /// Returns the config path to the given config name.
  61. /// </summary>
  62. /// <param name="configName">The name of the config.</param>
  63. /// <param name="fileName">The name of a config file.</param>
  64. /// <returns></returns>
  65. string GetConfigPath(string configName, string fileName);
  66. /// <summary>
  67. /// Returns the transaction file path to the given terminal type.
  68. /// </summary>
  69. /// <param name="terminalType">The name of the terminal type.</param>
  70. /// <returns></returns>
  71. string GetTransactionsPath(string terminalType);
  72. /// <summary>
  73. /// Returns the transaction file path to the given terminal type.
  74. /// </summary>
  75. /// <param name="terminalType">The name of the terminal type.</param>
  76. /// <param name="subState">The name of the sub state.</param>
  77. /// <returns></returns>
  78. string GetTransactionsPath(string terminalType, string subState);
  79. /// <summary>
  80. /// Replaces the extension of a file (e.g. from C:\MyFile.aaa to C:\MyFile.bbb)
  81. /// </summary>
  82. /// <param name="fileName"></param>
  83. /// <param name="newExtension"></param>
  84. /// <returns></returns>
  85. string ReplaceExtension(string fileName, string newExtension);
  86. #endregion
  87. #region Parse
  88. /// <summary>
  89. /// Parses the path to replace any %...% variables with the current actual path.
  90. /// </summary>
  91. /// <param name="path"></param>
  92. /// <returns></returns>
  93. string Parse(string path);
  94. /// <summary>
  95. /// Checks if file exists
  96. /// </summary>
  97. /// <param name="fileName"></param>
  98. /// <returns></returns>
  99. [Obsolete("Use the DirectoryExists() in FileSupport instead!")]
  100. bool FileExists(string fileName);
  101. /// <summary>
  102. /// Checks if directory exists
  103. /// </summary>
  104. /// <param name="path"></param>
  105. /// <returns></returns>
  106. [Obsolete("Use the DirectoryExists() in FileSupport instead!")]
  107. bool DirectoryExists(string path);
  108. /// <summary>
  109. /// Ensures the directory exists by trying to create it if it does not exist already.
  110. /// </summary>
  111. /// <param name="path"></param>
  112. /// <returns></returns>
  113. [Obsolete("Use the DirectoryExists() in FileSupport instead!")]
  114. bool EnsureDirectoryExists(string path);
  115. #endregion
  116. }
  117. }