龙腾猫跃 4 months ago
parent
commit
7ce6a6abc0
2 changed files with 7 additions and 13 deletions
  1. 7 2
      Shared/Utils/PathUtils.cs
  2. 0 11
      Wpf/Controls/ModernTooltipService.cs

+ 7 - 2
Shared/Utils/PathUtils.cs

@@ -157,8 +157,13 @@ public static class PathUtils {
     /// 统一路径格式,以便比较。
     /// <para/>具体而言:将短路径展开,去除前导的 <c>\\?\</c>,将分隔符改为 \,去除末尾的分隔符。
     /// </summary>
-    public static string ForCompare(string pathName) 
-        => PathUtils.RemoveSlashSuffix(PathUtils.RemoveExtendedPrefix(Path.GetFullPath(pathName)).Replace("/", @"\"));
+    public static string ForCompare(string pathName) {
+        try {
+            return PathUtils.RemoveSlashSuffix(PathUtils.RemoveExtendedPrefix(Path.GetFullPath(pathName)).Replace("/", @"\"));
+        } catch (ArgumentException ex) {
+            throw new ArgumentException($"路径不正确:{pathName}", ex);
+        }
+    }
 
     /// <summary>
     /// 将路径转换为兼容各种 Windows API 的格式。

+ 0 - 11
Wpf/Controls/ModernTooltipService.cs

@@ -124,17 +124,6 @@ public static class ModernTooltipService {
 
     private static void OnMouseLeave(object sender, MouseEventArgs e) {
         if (sender is not FrameworkElement owner || !ReferenceEquals(owner, currentOwner)) return;
-        if (sender is TextBox box) {
-            Logger.Warn("MOUSELEAVE: " + (
-            $"Leave: IsMouseOver={box.IsMouseOver}, " +
-            $"Captured={Mouse.Captured}, " +
-            $"DirectlyOver={Mouse.DirectlyOver}, " +
-            $"OriginalSource={e.OriginalSource}"), LogBehavior.None);
-        }
-        Logger.Warn("MOUSELEAVE: " + sender.GetType().Name + ", " +
-            $"Captured={Mouse.Captured}, " +
-            $"DirectlyOver={Mouse.DirectlyOver}, " +
-            $"OriginalSource={e.OriginalSource}", LogBehavior.None);
 
         if (!(owner.IsEnabled || !ToolTipService.GetShowOnDisabled(owner) || !IsPointInside(owner, Mouse.GetPosition(owner)))) return;