diff --git a/Ink Canvas/Helpers/Plugins/BuiltIn/SuperLauncher/LauncherModels.cs b/Ink Canvas/Helpers/Plugins/BuiltIn/SuperLauncher/LauncherModels.cs index 9749f8dc..51e52ef6 100644 --- a/Ink Canvas/Helpers/Plugins/BuiltIn/SuperLauncher/LauncherModels.cs +++ b/Ink Canvas/Helpers/Plugins/BuiltIn/SuperLauncher/LauncherModels.cs @@ -163,6 +163,32 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher // 对于资源管理器,使用特定图标 if (Path.EndsWith("explorer.exe", StringComparison.OrdinalIgnoreCase)) { + try + { + // 直接从C:\Windows\explorer.exe获取图标 + string explorerPath = @"C:\Windows\explorer.exe"; + if (File.Exists(explorerPath)) + { + Icon icon = System.Drawing.Icon.ExtractAssociatedIcon(explorerPath); + if (icon != null) + { + _iconCache = Imaging.CreateBitmapSourceFromHIcon( + icon.Handle, + Int32Rect.Empty, + BitmapSizeOptions.FromEmptyOptions()); + + icon.Dispose(); + return _iconCache; + } + } + } + catch (Exception ex) + { + LogHelper.WriteLogToFile($"获取资源管理器图标时出错: {ex.Message}", LogHelper.LogType.Warning); + // 如果获取Windows图标失败,回退到默认图标 + } + + // 回退到备用图标 string explorerIconPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "Icons-Fluent", "ic_fluent_folder_24_regular.png"); if (File.Exists(explorerIconPath)) { diff --git a/Ink Canvas/Helpers/Plugins/BuiltIn/SuperLauncherPlugin.cs b/Ink Canvas/Helpers/Plugins/BuiltIn/SuperLauncherPlugin.cs index 20cc2972..7a8a6d6c 100644 --- a/Ink Canvas/Helpers/Plugins/BuiltIn/SuperLauncherPlugin.cs +++ b/Ink Canvas/Helpers/Plugins/BuiltIn/SuperLauncherPlugin.cs @@ -272,7 +272,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn new LauncherItem { Name = "资源管理器", - Path = "explorer.exe", + Path = @"C:\Windows\explorer.exe", IsVisible = true, Position = 0 } diff --git a/Ink Canvas/Helpers/Plugins/PluginBase.cs b/Ink Canvas/Helpers/Plugins/PluginBase.cs index 6fee53ab..3a0010f1 100644 --- a/Ink Canvas/Helpers/Plugins/PluginBase.cs +++ b/Ink Canvas/Helpers/Plugins/PluginBase.cs @@ -75,6 +75,23 @@ namespace Ink_Canvas.Helpers.Plugins public virtual void Initialize() { Id = GetType().FullName; + + // 添加日志,记录插件名称 + try + { + string name = Name; + LogHelper.WriteLogToFile($"初始化插件: ID={Id}, 名称={name ?? "未命名"}", LogHelper.LogType.Info); + + if (string.IsNullOrEmpty(name)) + { + LogHelper.WriteLogToFile($"警告: 插件 {Id} 的名称为空", LogHelper.LogType.Warning); + } + } + catch (Exception ex) + { + LogHelper.WriteLogToFile($"获取插件名称时出错: {ex.Message}", LogHelper.LogType.Error); + } + LogHelper.WriteLogToFile($"插件 {Name} 已初始化", LogHelper.LogType.Info); } diff --git a/Ink Canvas/Windows/PluginSettingsWindow.xaml b/Ink Canvas/Windows/PluginSettingsWindow.xaml index 05b4ed4c..d9ed9067 100644 --- a/Ink Canvas/Windows/PluginSettingsWindow.xaml +++ b/Ink Canvas/Windows/PluginSettingsWindow.xaml @@ -65,7 +65,8 @@ - + @@ -141,11 +142,11 @@