AppDirTool.cs 778 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Y.Utils.IOUtils.PathUtils
  6. {
  7. class AppDirTool
  8. {
  9. public static string Get(string s, Dictionary<string, string> dictionary)
  10. {
  11. string path = s.Trim();
  12. string result = null;
  13. if (!string.IsNullOrWhiteSpace(path) && dictionary != null)
  14. {
  15. foreach (var dic in dictionary)
  16. {
  17. if (dic.Key != null && dic.Value != null && path.Contains(dic.Key))
  18. {
  19. result = path.Replace(dic.Key, dic.Value);
  20. break;
  21. }
  22. }
  23. }
  24. return result;
  25. }
  26. }
  27. }