ConfigHelper.cs 370 B

12345678910111213141516171819202122
  1. using System;
  2. using System.IO;
  3. namespace Model
  4. {
  5. public static class ConfigHelper
  6. {
  7. public static string GetText(string key)
  8. {
  9. string path = $@"../Config/{key}.txt";
  10. try
  11. {
  12. string configStr = File.ReadAllText(path);
  13. return configStr;
  14. }
  15. catch (Exception)
  16. {
  17. throw new Exception($"load config file fail, path: {path}");
  18. }
  19. }
  20. }
  21. }