AppDirTool.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //************************************************************************
  2. // author: yuzhengyang
  3. // date: 2018.3.27 - 2018.6.3
  4. // desc: 工具描述
  5. // Copyright (c) yuzhengyang. All rights reserved.
  6. //************************************************************************
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. namespace Azylee.Core.IOUtils.PathUtils
  12. {
  13. public class AppDirTool
  14. {
  15. public static string Get(string s, Dictionary<string, string> dictionary)
  16. {
  17. string path = s.Trim();
  18. string result = null;
  19. if (!string.IsNullOrWhiteSpace(path) && dictionary != null)
  20. {
  21. foreach (var dic in dictionary)
  22. {
  23. if (dic.Key != null && dic.Value != null && path.Contains(dic.Key))
  24. {
  25. result = path.Replace(dic.Key, dic.Value);
  26. break;
  27. }
  28. }
  29. }
  30. return result;
  31. }
  32. }
  33. }