Skip to content

Commit

Permalink
修复 当情景第一个节点出现循环时无法调出循环
Browse files Browse the repository at this point in the history
新增 官方插件KitopiaEX
新增 情景支持选择本地搜索项目
插件新增 打开/运行本地搜索项目
移除 插件PluginDemo
  • Loading branch information
MakesYT committed Oct 22, 2023
1 parent 26ca6d5 commit 002af45
Show file tree
Hide file tree
Showing 27 changed files with 593 additions and 282 deletions.
9 changes: 6 additions & 3 deletions Core/SDKs/CustomScenario/CustomScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ private void StartRun(bool notRealTime)
var firstNodes = connectionItem.Target.Source;
try
{
_tasks.Add(firstNodes, null);
ParsePointItem(firstNodes, false, notRealTime);
}
catch (Exception e)
Expand Down Expand Up @@ -232,10 +233,11 @@ private void ParsePointItem(PointItem nowPointItem, bool onlyForward, bool notRe
{
ParsePointItem(sourceSource, true, notRealTime);
});
task.Start();

// Log.Debug(sourceSource.Title);
_tasks.Add(sourceSource, task);
sourceDataTask.Add(task);
task.Start();
}
}
}
Expand All @@ -262,7 +264,7 @@ private void ParsePointItem(PointItem nowPointItem, bool onlyForward, bool notRe
}
}

//源数据全部生成

if (!valid)
{
goto finnish;
Expand Down Expand Up @@ -489,8 +491,9 @@ private void ParsePointItem(PointItem nowPointItem, bool onlyForward, bool notRe
{
ParsePointItem(nextPointItem, false, notRealTime);
});
task.Start();

_tasks.Add(nextPointItem, task);
task.Start();
}
}
}
Expand Down
28 changes: 28 additions & 0 deletions Core/SDKs/CustomScenario/CustomScenarioManger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using Core.SDKs.CustomScenario;
using Core.SDKs.Services.Plugin;
using Core.ViewModel;
using log4net;
using Newtonsoft.Json;

Expand Down Expand Up @@ -91,6 +92,9 @@ public static void Init()
throw new CustomScenarioLoadFromJsonException(nodePlugin, node.MerthodName);
}
//
deserializeObject.IsRunning = false;
CustomScenarios.Add(deserializeObject);
}
Expand Down Expand Up @@ -129,6 +133,30 @@ public static void Save(SDKs.CustomScenario.CustomScenario scenario)
CustomScenarios.Add(scenario);
}

if (scenario.ExecutionManual)
{
if (scenario.Keys.Any())
{
var viewItem1 = new SearchViewItem()
{
FileName = "执行自定义情景:" + scenario.Name,
FileType = FileType.自定义情景,
OnlyKey = $"CustomScenario:{scenario.UUID}",
Keys = scenario.Keys.ToHashSet(),
Icon = null,
IconSymbol = 0xF78B,
IsVisible = true
};
((SearchWindowViewModel)ServiceManager.Services.GetService(typeof(SearchWindowViewModel))!)
._collection.TryAdd($"CustomScenario:{scenario.UUID}", viewItem1);
}
else
{
((SearchWindowViewModel)ServiceManager.Services.GetService(typeof(SearchWindowViewModel))!)
._collection.Remove($"CustomScenario:{scenario.UUID}");
}
}

var configF = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + $"customScenarios\\{scenario.UUID}.json");

var setting = new JsonSerializerSettings();
Expand Down
4 changes: 3 additions & 1 deletion Core/SDKs/Services/Plugin/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Windows;
using Core.SDKs.Services.Config;
using log4net;
using PluginCore;

#endregion

Expand All @@ -18,6 +19,7 @@ public static void Init()
{
ThreadPool.QueueUserWorkItem((e) =>
{
Kitopia.ISearchItemTool = (ISearchItemTool)ServiceManager.Services.GetService(typeof(ISearchItemTool))!;
var pluginsDirectoryInfo = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "plugins");
if (!pluginsDirectoryInfo.Exists)
{
Expand Down Expand Up @@ -57,7 +59,7 @@ public static void Init()
Log.Debug("Debug加载测试插件");
var pluginInfoEx1 = Plugin.GetPluginInfoEx(
@"D:\WPF.net\uToolkitopia\PluginDemo\bin\Debug\net7.0-windows\PluginDemo.dll",
@"D:\WPF.net\uToolkitopia\KitopiaEx\bin\Debug\net7.0-windows\KitopiaEx.dll",
out var alcWeakRef1);
Expand Down
31 changes: 22 additions & 9 deletions Core/SDKs/Tools/AppTools.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#region

using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
Expand Down Expand Up @@ -162,17 +161,32 @@ public static void GetAllApps(Dictionary<string, SearchViewItem> collection,
bool logging = false)
{
log.Debug("索引全部软件及收藏项目");
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
foreach (var customScenario in CustomScenarioManger.CustomScenarios)
{
if (customScenario.ExecutionManual)
{
if (customScenario.Keys.Any())
{
var viewItem1 = new SearchViewItem()
{
FileName = "执行自定义情景:" + customScenario.Name,
FileType = FileType.自定义情景,
OnlyKey = $"CustomScenario:{customScenario.UUID}",
Keys = customScenario.Keys.ToHashSet(),
Icon = null,
IconSymbol = 0xF78B,
IsVisible = true
};

collection.TryAdd($"CustomScenario:{customScenario.UUID}", viewItem1);
}
}
}


UwpTools.GetAll(collection);
stopwatch.Stop();

log.Debug($"索引UWP软件耗时{stopwatch.ElapsedMilliseconds}ms");

stopwatch.Reset();
stopwatch.Start();
// 创建一个空的文件路径集合
List<string> filePaths = new();

Expand Down Expand Up @@ -221,8 +235,7 @@ public static void GetAllApps(Dictionary<string, SearchViewItem> collection,
{
}

stopwatch.Stop();
log.Debug($"索引软件耗时{stopwatch.ElapsedMilliseconds}ms");

//AutoStartEverything(collection);
if (ErrorLnkList.Any())
{
Expand Down
38 changes: 36 additions & 2 deletions Core/SDKs/Tools/BaseNodeMethodsGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class BaseNodeMethodsGen
{ "字符串", typeof(string) },
{ "布尔", typeof(bool) },
{ "整型", typeof(int) },
{ "双精度浮点数", typeof(double) }
{ "双精度浮点数", typeof(double) },
};

public static Dictionary<string, string> _i18n = new()
Expand All @@ -26,7 +26,7 @@ public class BaseNodeMethodsGen
{ "System.Int32", "整数" },
{ "System.Double", "浮点" },
{ "System.Object", "任意" },
{ "PluginCore.NodeConnectorClass", "节点" }
{ "PluginCore.NodeConnectorClass", "节点" },
};

public static string GetI18N(string key)
Expand Down Expand Up @@ -78,6 +78,40 @@ public static void GenBaseNodeMethods(BindingList<BindingList<object>> nodeMetho
nodes.Add(String);
} //基本数值类型

//SearchItem
var point = new PointItem()
{
Plugin = "Kitopia",
MerthodName = "本地项目",
Title = "本地项目"
};
ObservableCollection<ConnectorItem> pointOutItems = new()
{
new ConnectorItem()
{
Source = point,
Type = typeof(string),
Title = "本地项目",
TypeName = "字符串",
IsOut = true
}
};
point.Output = pointOutItems;
ObservableCollection<ConnectorItem> pointInItems = new()
{
new ConnectorItem()
{
Source = point,
Type = typeof(string),
RealType = typeof(SearchViewItem),
InputObject = "",
Title = "本地项目",
TypeName = "字符串",
IsSelf = true
}
};
point.Input = pointInItems;
nodes.Add(point);
//if
{
var String = new PointItem()
Expand Down
2 changes: 1 addition & 1 deletion Core/SDKs/Tools/Math.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Core.SDKs.Tools;

public class Math
public static class Math
{
private static readonly ILog log = LogManager.GetLogger(nameof(Math));

Expand Down
Loading

0 comments on commit 002af45

Please sign in to comment.