UrlUtil.cs 736 B

123456789101112131415161718192021222324252627282930
  1. // <author></author>
  2. // <date></date>
  3. // <description></description>
  4. namespace ERP.Framework.Utils
  5. {
  6. public class UrlUtil
  7. {
  8. public static bool Match(string pattern, string path)
  9. {
  10. string[] patternParts = pattern.Split('*', StringSplitOptions.RemoveEmptyEntries);
  11. int currentIndex = 0;
  12. foreach (string patternPart in patternParts)
  13. {
  14. int index = path.IndexOf(patternPart, currentIndex, StringComparison.OrdinalIgnoreCase);
  15. if (index == -1)
  16. {
  17. return false;
  18. }
  19. currentIndex = index + patternPart.Length;
  20. }
  21. return true;
  22. }
  23. }
  24. }