diff --git a/TestPlugin.CSharp/Controller.cs b/TestPlugin.CSharp/Controller.cs index 535d74f..4fd54b0 100644 --- a/TestPlugin.CSharp/Controller.cs +++ b/TestPlugin.CSharp/Controller.cs @@ -1,5 +1,6 @@ using KitX.Contract.CSharp; -using KitX.Web.Rules; +using KitX.Shared.Plugin; +using KitX.Shared.WebCommand; using System.Text.Json; namespace TestPlugin.CSharp; @@ -30,7 +31,7 @@ public void Execute(Command cmd) public List GetFunctions() { - return new(); + return []; } public void SetSendCommandAction(Action action) => sendCommandAction = action; @@ -44,4 +45,9 @@ public void SetWorkPath(string path) { Console.WriteLine($"Work path: {path}"); } + + public void SetCommandsSendBuffer(ref Queue commands) + { + throw new NotImplementedException(); + } } diff --git a/TestPlugin.CSharp/TestPlugin.CSharp.csproj b/TestPlugin.CSharp/TestPlugin.CSharp.csproj index 91f85b0..a533f98 100644 --- a/TestPlugin.CSharp/TestPlugin.CSharp.csproj +++ b/TestPlugin.CSharp/TestPlugin.CSharp.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 enable enable Preview @@ -19,7 +19,7 @@ - + diff --git a/TestPlugin.WPF.Core/Assets/Descr/zh-cn.md b/TestPlugin.WPF.Core/Assets/Descr/zh-cn.md deleted file mode 100644 index 4f4e536..0000000 --- a/TestPlugin.WPF.Core/Assets/Descr/zh-cn.md +++ /dev/null @@ -1,2 +0,0 @@ -# Markdown File - diff --git a/TestPlugin.WPF.Core/Controller.cs b/TestPlugin.WPF.Core/Controller.cs index d5040fb..d4cab33 100644 --- a/TestPlugin.WPF.Core/Controller.cs +++ b/TestPlugin.WPF.Core/Controller.cs @@ -1,82 +1,41 @@ using KitX.Contract.CSharp; -using KitX.Web.Rules; +using KitX.Shared.WebCommand; +using KitX.Shared.WebCommand.Details; using System; -using System.Collections.Generic; using System.Windows; -namespace TestPlugin.WPF.Core -{ - public class Controller : IController - { - private readonly MainWindow mainwin; - - public Controller(MainWindow mainwin) - { - this.mainwin = mainwin; - } - - public void End() - { - mainwin.Close(); - } +namespace TestPlugin.WPF.Core; - public void Pause() - { - mainwin.Hide(); - } +public class Controller(MainWindow mainwin) : IController +{ + private readonly MainWindow mainwin = mainwin; - public void Start() - { - mainwin.Show(); - } + public PluginWorkingDetail? WorkingDetail { get; set; } - public List GetFunctions() - { - return new List() - { - new Function() - { - DisplayNames = new Dictionary() - { - { "zh-cn", "你好, 世界!" }, - { "en-us", "Hello, World!" } - }, - Parameters = new Dictionary>() - { - { - "par1", - new Dictionary() - { - { "zh-cn", "参数1" }, - { "en-us", "Parameter1" } - } - } - }, - ParametersType = new List() - { - "void" - }, - HasAppendParameters = false, - ReturnValueType = "void" - } - }; - } + public void End() + { + mainwin.Close(); + } - public void Execute(Command command) - { + public void Pause() + { + mainwin.Hide(); + } - } + public void Start() + { + mainwin.Show(); + } - public void SetRootPath(string path) + public void Execute(Command command) + { + if (command.FunctionName.Equals("HelloKitX")) { - MessageBox.Show($"SetRootPath({path})"); + MessageBox.Show("Hello KitX !"); } + } - public void SetSendCommandAction(Action action) => mainwin.sendCommandAction = action; + public void SetWorkingDetail(PluginWorkingDetail workingDetail) => WorkingDetail = workingDetail; - public void SetWorkPath(string path) - { - MessageBox.Show($"SetWorkPath({path})"); - } - } + public void SetSendCommandAction(Action action) => mainwin.sendCommandAction = action; } diff --git a/TestPlugin.WPF.Core/MainWindow.xaml b/TestPlugin.WPF.Core/MainWindow.xaml index 2b270d0..ba2d5d7 100644 --- a/TestPlugin.WPF.Core/MainWindow.xaml +++ b/TestPlugin.WPF.Core/MainWindow.xaml @@ -2,12 +2,18 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:TestPlugin.WPF.Core" - mc:Ignorable="d" SizeToContent="WidthAndHeight" - Title="TestPlugin.WPF.Core - MainWindow" Background="#FF3873D9"> + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + Title="TestPlugin.WPF.Core - MainWindow" + Background="#FF3873D9" + SizeToContent="WidthAndHeight" + mc:Ignorable="d"> - + diff --git a/TestPlugin.WPF.Core/MainWindow.xaml.cs b/TestPlugin.WPF.Core/MainWindow.xaml.cs index c00539e..322eab4 100644 --- a/TestPlugin.WPF.Core/MainWindow.xaml.cs +++ b/TestPlugin.WPF.Core/MainWindow.xaml.cs @@ -1,156 +1,100 @@ using KitX.Contract.CSharp; -using KitX.Web.Rules; +using KitX.Shared.Plugin; +using KitX.Shared.WebCommand; using System; -using System.Collections.Generic; +using System.Reflection; using System.Windows; -#pragma warning disable CS8603 // 可能返回 null 引用。 +namespace TestPlugin.WPF.Core; -namespace TestPlugin.WPF.Core +public partial class MainWindow : Window, IIdentityInterface { - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : Window, IIdentityInterface - { - private readonly Controller controller; - - internal Action? sendCommandAction; + private readonly Controller controller; - public MainWindow() - { - InitializeComponent(); - controller = new(this); + internal Action? sendCommandAction; - Closed += (_, _) => Environment.Exit(0); - } + public MainWindow() + { + InitializeComponent(); - /// - /// 获取插件名称 - /// - /// 插件名称 - public string GetName() => "插件名称"; + controller = new(this); - /// - /// 获取插件版本 - /// - /// 插件版本 - public string GetVersion() => "插件版本"; + Closed += (_, _) => Environment.Exit(0); + } - /// - /// 获取显示名称 - /// - /// 显示名称 - public Dictionary GetDisplayName() => new() + public PluginInfo GetPluginInfo() => new() + { + Name = "TestPlugin.WPF.Core", + DisplayName = new() { - { "zh-cn", "显示名称" }, - { "zh-cnt", "顯示名稱" }, - { "en-us", "Display Name" }, - { "ja-jp", "番組名" } - }; - - /// - /// 获取作者名称 - /// - /// 作者名称 - public string GetAuthorName() => "作者名称"; - - /// - /// 获取发行者名称 - /// - /// 发行者名称 - public string GetPublisherName() => "发行者名称"; - - /// - /// 获取作者链接 - /// - /// 作者链接 - public string GetAuthorLink() => "作者链接"; - - /// - /// 获取发行者链接 - /// - /// 发行者链接 - public string GetPublisherLink() => "发行者链接"; - - /// - /// 获取简单描述 - /// - /// 简单描述 - public Dictionary GetSimpleDescription() => new() + { "zh-cn", "TestPlugin.WPF.Core" }, + { "en-us", "TestPlugin.WPF.Core" }, + }, + Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "", + AuthorLink = "https://github.com/Crequency/KitX/", + AuthorName = "Crequency", + PublisherLink = "https://github.com/Crequency/", + PublisherName = "Crequency", + PublishDate = DateTime.Now, + LastUpdateDate = DateTime.Now, + SimpleDescription = new() { - { "zh-cn", "简单描述" }, - { "zh-cnt", "簡單描述" }, - { "en-us", "Simple Description" }, - { "ja-jp", "簡単な説明" } - }; - - /// - /// 获取复杂描述 - /// - /// 复杂描述 - public Dictionary GetComplexDescription() => new() + { "zh-cn", "TestPlugin.WPF.Core" }, + { "en-us", "TestPlugin.WPF.Core" }, + }, + ComplexDescription = new() { - { "zh-cn", "复杂描述" }, - { "zh-cnt", "複雜描述" }, - { "en-us", "Complex Description" }, - { "ja-jp", "複雑な説明" } - }; - - /// - /// 获取 MarkDown 语法的完整介绍 - /// - /// 完整介绍 - public Dictionary GetTotalDescriptionInMarkdown() => new() + { "zh-cn", "用于测试于验证 WPF.Core 框架下的插件可行性" }, + { "en-us", "Used to test and verify the feasibility of plug-ins under the WPF.Core framework" }, + }, + TotalDescriptionInMarkdown = new() { - { "zh-cn", "完整描述" }, - { "zh-cnt", "完整描述" }, - { "en-us", "Total Description" }, - { "ja-jp", "完全な説明" } - }; - - /// - /// 获取 Base64 编码的图标 - /// - /// Base64 编码的图标 - public string GetIconInBase64() => "图标"; - - /// - /// 获取发行日期 - /// - /// 发行日期 - public DateTime GetPublishDate() => DateTime.Now; - - /// - /// 获取最近更新日期 - /// - /// 最近更新日期 - public DateTime GetLastUpdateDate() => DateTime.Now; - - /// - /// 获取控制器 - /// - /// 控制器 - public IController GetController() => controller; - - /// - /// 指示是否是市场版本 - /// - /// 是否是市场版本 - public bool IsMarketVersion() => false; + { + "zh-cn", + """ + # 你好! + ```cpp + void helloWorld(string greet) { + std::cout << "Hello, World!"; + } + ``` + """ + }, + { + "en-us", + """ + # Hi, there! + ```cpp + void helloWorld(string greet) { + std::cout << "Hello, World!"; + } + ``` + """ + }, + }, + IconInBase64 = "", + IsMarketVersion = false, + RootStartupFileName = "TestPlugin.WPF.Core.dll", + Functions = [ + new Function() + { + Name = "HelloKitX", + DisplayNames = new() + { + { "zh-cn", "你好 KitX !" }, + { "en-us", "Hello KitX !" }, + }, + ReturnValueType = "void", + Parameters = [], + }, + ], + Tags = new() + { + { "IsTestPlugin", "true" } + }, + }; - /// - /// 获取市场版本插件协议 - /// - /// 市场版本插件协议 - public IMarketPluginContract GetMarketPluginContract() => null; + public IController GetController() => controller; - /// - /// 获取根启动文件名称 - /// - /// 根启动文件名称 - public string GetRootStartupFileName() => "TestPlugin.WPF.Core.dll"; - } + public IMarketPluginContract GetMarketPluginContract() => null!; } - -#pragma warning restore CS8603 // 可能返回 null 引用。 diff --git a/TestPlugin.WPF.Core/PluginStruct.json b/TestPlugin.WPF.Core/PluginStruct.json index 92e1039..9e92de2 100644 --- a/TestPlugin.WPF.Core/PluginStruct.json +++ b/TestPlugin.WPF.Core/PluginStruct.json @@ -1,50 +1,53 @@ -{ +{ "Name": "TestPlugin.WPF.Core", - "Version": "v1.0.0", "DisplayName": { - "zh-cn": "WPF.Core 测试插件", + "zh-cn": "TestPlugin.WPF.Core", "en-us": "TestPlugin.WPF.Core" }, - "AuthorName": "Dynesshely", + "Version": "1.0.0.307", + "AuthorLink": "https://github.com/Crequency/KitX/", + "AuthorName": "Crequency", + "PublisherLink": "https://github.com/Crequency/", "PublisherName": "Crequency", - "AuthorLink": "https://blog.catrol.cn", - "PublisherLink": "https://www.catrol.cn", + "PublishDate": "2024-02-20T23:40:00.5475765+08:00", + "LastUpdateDate": "2024-02-20T23:40:00.5475782+08:00", "SimpleDescription": { - "zh-cn": "用于测试于验证 WPF.Core 框架下的插件可行性", - "en-us": "Used to test and verify the feasibility of plug-ins under the WPF.Core framework" + "zh-cn": "TestPlugin.WPF.Core", + "en-us": "TestPlugin.WPF.Core" }, "ComplexDescription": { - "zh-cn": "\u590D\u6742\u63CF\u8FF0", - "en-us": "ComplexDescription" + "zh-cn": "\u7528\u4E8E\u6D4B\u8BD5\u4E8E\u9A8C\u8BC1 WPF.Core \u6846\u67B6\u4E0B\u7684\u63D2\u4EF6\u53EF\u884C\u6027", + "en-us": "Used to test and verify the feasibility of plug-ins under the WPF.Core framework" }, "TotalDescriptionInMarkdown": { - "zh-cn": "# Hi, there! \r\n ```cpp \r\n void helloWorld() { std::cout << \"Hello, World!\"; } \r\n ```", - "en-us": "# 你好! \r\n ```cpp \r\n void helloWorld() { std::cout << \"Hello, World!\"; } \r\n ```" + "zh-cn": "# \u4F60\u597D!\r\n\u0060\u0060\u0060cpp\r\nvoid helloWorld(string greet) {\r\n std::cout \u003C\u003C \u0022Hello, World!\u0022;\r\n}\r\n\u0060\u0060\u0060", + "en-us": "# Hi, there!\r\n\u0060\u0060\u0060cpp\r\nvoid helloWorld(string greet) {\r\n std::cout \u003C\u003C \u0022Hello, World!\u0022;\r\n}\r\n\u0060\u0060\u0060" }, - "IconInBase64": "Base64 Format Icon", - "PublishDate": "2022-12-03T12:02:24.8238944+08:00", - "LastUpdateDate": "2022-12-03T12:02:24.8261798+08:00", + "IconInBase64": "", "IsMarketVersion": false, + "RootStartupFileName": "TestPlugin.WPF.Core.dll", + "Functions": [ + { + "Name": "HelloKitX", + "DisplayNames": { + "zh-cn": "\u4F60\u597D KitX !", + "en-us": "Hello KitX !" + }, + "ReturnValueType": "void", + "Parameters": [ + { + "Name": "greet", + "DisplayNames": { + "zh-cn": "\u95EE\u5019\u8BED", + "en-us": "GreetingText" + }, + "Type": "string", + "IsAppendable": false + } + ] + } + ], "Tags": { - "tagTest": "test" - }, - "Functions": [{ - "Name": "print", - "DisplayNames": { - "zh-cn": "打印字符串", - "en-us": "PrintString" - }, - "Parameters": { - "ParameterName": { - "zh-cn": "字符串", - "en-us": "String" - } - }, - "ParametersType": [ - "string" - ], - "HasAppendParameters": false, - "ReturnValueType": "void" - }], - "RootStartupFileName": "TestPlugin.WPF.Core.dll" -} \ No newline at end of file + "IsTestPlugin": "true" + } +} diff --git a/TestPlugin.WPF.Core/TestPlugin.WPF.Core.csproj b/TestPlugin.WPF.Core/TestPlugin.WPF.Core.csproj index ae1738a..3082fad 100644 --- a/TestPlugin.WPF.Core/TestPlugin.WPF.Core.csproj +++ b/TestPlugin.WPF.Core/TestPlugin.WPF.Core.csproj @@ -2,7 +2,7 @@ Library - net7.0-windows + net8.0-windows enable true @@ -12,13 +12,11 @@ - + + - - Never - Always diff --git a/TestPlugin.Winform.Core/Controller.cs b/TestPlugin.Winform.Core/Controller.cs index fad2c20..c4348b7 100644 --- a/TestPlugin.Winform.Core/Controller.cs +++ b/TestPlugin.Winform.Core/Controller.cs @@ -1,5 +1,6 @@ using KitX.Contract.CSharp; -using KitX.Web.Rules; +using KitX.Shared.Plugin; +using KitX.Shared.WebCommand; using System.Text.Json; namespace TestPlugin.Winform.Core; @@ -46,4 +47,9 @@ public void SetWorkPath(string path) { Console.WriteLine($"Work path: {path}"); } + + public void SetCommandsSendBuffer(ref Queue commands) + { + throw new NotImplementedException(); + } } diff --git a/TestPlugin.Winform.Core/TestPlugin.Winform.Core.csproj b/TestPlugin.Winform.Core/TestPlugin.Winform.Core.csproj index bf22df0..7128591 100644 --- a/TestPlugin.Winform.Core/TestPlugin.Winform.Core.csproj +++ b/TestPlugin.Winform.Core/TestPlugin.Winform.Core.csproj @@ -2,7 +2,7 @@ WinExe - net7.0-windows + net8.0-windows enable true enable @@ -13,7 +13,7 @@ - + \ No newline at end of file