diff --git a/Core/ViewModel/SearchWindowViewModel.cs b/Core/ViewModel/SearchWindowViewModel.cs index fa1adfb..5a9b082 100644 --- a/Core/ViewModel/SearchWindowViewModel.cs +++ b/Core/ViewModel/SearchWindowViewModel.cs @@ -119,28 +119,34 @@ public void CheckClipboard(bool loadLast = false) } var data = Clipboard.GetDataObject()!; - if (data.GetDataPresent(DataFormats.Text)) + try { - var text = (string)data.GetData(DataFormats.Text)!; - if (text.StartsWith("\"")) + if (data.GetDataPresent(DataFormats.Text)) { - text = text.Replace("\"", ""); - } + var text = (string)data.GetData(DataFormats.Text)!; + if (text.StartsWith("\"")) + { + text = text.Replace("\"", ""); + } - //检测路径 - if (text.Contains("\\") || text.Contains("/")) - { - Log.Debug("检测路径"); - Dictionary a = new(); - AppTools.AppSolverA(a, text).Wait(); - foreach (var (key, value) in a) + //检测路径 + if (text.Contains("\\") || text.Contains("/")) { - value.FileName = $"打开文件: {value.FileName} ?"; - Items.Insert(0, value); - GetIconInItemsAsync(value); + Log.Debug("检测路径"); + Dictionary a = new(); + AppTools.AppSolverA(a, text).Wait(); + foreach (var (key, value) in a) + { + value.FileName = $"打开文件: {value.FileName} ?"; + Items.Insert(0, value); + GetIconInItemsAsync(value); + } } } } + catch (Exception e) + { + } if (((IClipboardService)ServiceManager.Services!.GetService(typeof(IClipboardService))!).IsBitmap()) @@ -456,7 +462,7 @@ partial void OnSearchChanged(string? value) } } - var sortedDict = nowHasLastOpens.AsParallel().OrderByDescending(p => p.Value) + var sortedDict = nowHasLastOpens.OrderByDescending(p => p.Value) .ToDictionary(p => p.Key, p => p.Value); foreach (var (searchViewItem, i) in sortedDict) { diff --git a/Kitopia.sln b/Kitopia.sln index a21114a..adf9673 100644 --- a/Kitopia.sln +++ b/Kitopia.sln @@ -8,7 +8,6 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj", "{48AA7450-F61F-4D21-8B04-1649B1DED462}" ProjectSection(ProjectDependencies) = postProject {B27A1A07-DFEF-4802-99C6-A11AB41719CF} = {B27A1A07-DFEF-4802-99C6-A11AB41719CF} - {0F8C4EDA-81CD-409A-A8FC-D13B22334429} = {0F8C4EDA-81CD-409A-A8FC-D13B22334429} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject1", "TestProject1\TestProject1.csproj", "{12CEA1A5-F9A7-4272-A061-27FD9F7BE905}" diff --git a/uToolkitopia/Services/SearchItemTool.cs b/uToolkitopia/Services/SearchItemTool.cs index fcc98bd..7a1a1b3 100644 --- a/uToolkitopia/Services/SearchItemTool.cs +++ b/uToolkitopia/Services/SearchItemTool.cs @@ -73,6 +73,7 @@ public void OpenSearchItem(SearchViewItem item) case FileType.PDF文档: case FileType.图像: case FileType.文件: + case FileType.自定义情景: { if (ConfigManger.Config.lastOpens.ContainsKey(item.OnlyKey)) {