ExplorerAccessor.cs 623 B

1234567891011121314151617181920
  1. using SHDocVw;
  2. using System;
  3. using System.IO;
  4. using System.Linq;
  5. namespace QVCopier.Utility
  6. {
  7. internal static class ExplorerAccessor
  8. {
  9. public static string[] GetOpenedWindowPath()
  10. {
  11. var paths = new ShellWindows().Cast<InternetExplorer>()
  12. .Where(p => p.FullName?.ToLower().EndsWith("explorer.exe") == true && false == string.IsNullOrWhiteSpace(p.LocationURL))
  13. .Select(p => Path.GetFullPath(Uri.UnescapeDataString(new Uri(p.LocationURL).AbsolutePath)))
  14. .Distinct()
  15. .ToArray();
  16. return paths;
  17. }
  18. }
  19. }