diff --git a/TestPlugin.CSharp/Controller.cs b/TestPlugin.CSharp/Controller.cs index 4fd54b0..b264a78 100644 --- a/TestPlugin.CSharp/Controller.cs +++ b/TestPlugin.CSharp/Controller.cs @@ -1,13 +1,14 @@ using KitX.Contract.CSharp; using KitX.Shared.Plugin; using KitX.Shared.WebCommand; +using KitX.Shared.WebCommand.Details; using System.Text.Json; namespace TestPlugin.CSharp; public class Controller : IController { - private Action? sendCommandAction; + private Action? sendCommandAction; public void Start() { @@ -34,20 +35,9 @@ public List GetFunctions() return []; } - public void SetSendCommandAction(Action action) => sendCommandAction = action; + public void SetSendCommandAction(Action action) => sendCommandAction = action; - public void SetRootPath(string path) - { - Console.WriteLine($"Root path: {path}"); - } - - public void SetWorkPath(string path) - { - Console.WriteLine($"Work path: {path}"); - } - - public void SetCommandsSendBuffer(ref Queue commands) - { - throw new NotImplementedException(); - } + public void SetWorkingDetail(PluginWorkingDetail workingDetail) => Console.WriteLine( + $"WorkingDetail: {JsonSerializer.Serialize(workingDetail)}" + ); } diff --git a/TestPlugin.CSharp/IdentityInterface.cs b/TestPlugin.CSharp/IdentityInterface.cs index 48c14cc..e436eec 100644 --- a/TestPlugin.CSharp/IdentityInterface.cs +++ b/TestPlugin.CSharp/IdentityInterface.cs @@ -1,43 +1,41 @@ using KitX.Contract.CSharp; +using KitX.Shared.Plugin; namespace TestPlugin.CSharp; public class IdentityInterface : IIdentityInterface { - public string GetName() => "TestPlugin.CSharp"; + public IController GetController() => new Controller(); - public string GetVersion() => "v0.1.0"; + public IMarketPluginContract GetMarketPluginContract() => null!; - public Dictionary GetDisplayName() => new() + public PluginInfo GetPluginInfo() => new() + { + Name = "TestPlugin.CSharp", + Version = "v0.1.0", + DisplayName = new() { { "zh-cn", "适用于 C# 的 KitX 测试用插件" }, - { "zh-cnt", "適用於 C# 的 KitX 測試用插件" }, + { "zh-tw", "適用於 C# 的 KitX 測試用插件" }, { "en-us", "KitX Testing Plugin for C#" }, - }; - - public string GetAuthorName() => "Dynesshely"; - - public string GetPublisherName() => "Crequency"; - - public string GetAuthorLink() => "https://blog.catrol.cn"; - - public string GetPublisherLink() => "https://catrol.cn"; - - public Dictionary GetSimpleDescription() => new() + }, + AuthorName = "Dynesshely", + AuthorLink = "https://blog.catrol.cn", + PublisherName = "Crequency", + PublisherLink = "https://catrol.cn", + SimpleDescription = new() { { "zh-cn", "KitX 测试用插件" }, - { "zh-cnt", "KitX 測試用插件" }, + { "zh-tw", "KitX 測試用插件" }, { "en-us", "KitX Test Plugin" }, - }; - - public Dictionary GetComplexDescription() => new() + }, + ComplexDescription = new() { { "zh-cn", "KitX 测试用插件, 使用 KitX.Loader.CSharp 作为加载器." }, - { "zh-cnt", "KitX 測試用插件, 使用 KitX.Loader.CSharp 作爲加載器." }, + { "zh-tw", "KitX 測試用插件, 使用 KitX.Loader.CSharp 作爲加載器." }, { "en-us", "KitX Test Plugin, use KitX.Loader.CSharp as loader." }, - }; - - public Dictionary GetTotalDescriptionInMarkdown() => new() + }, + TotalDescriptionInMarkdown = new() { { "zh-cn", @@ -48,7 +46,7 @@ 使用 KitX.Loader.CSharp 作为加载器 """ }, { - "zh-cnt", + "zh-tw", """ # 關於 這是一個適用於 C# 的 KitX 測試用插件 @@ -63,19 +61,13 @@ 使用 KitX.Loader.CSharp 作爲加載器 Use KitX.Loader.CSharp as loader """ }, - }; - - public string GetIconInBase64() => "图标"; - - public DateTime GetPublishDate() => DateTime.Now; - - public DateTime GetLastUpdateDate() => DateTime.Now; - - public IController GetController() => new Controller(); - - public bool IsMarketVersion() => false; - - public IMarketPluginContract GetMarketPluginContract() => null; - - public string GetRootStartupFileName() => "TestPlugin.CSharp.dll"; + }, + IconInBase64 = "Icon", + PublishDate = DateTime.Now, + LastUpdateDate = DateTime.Now, + IsMarketVersion = false, + RootStartupFileName = "TestPlugin.CSharp.dll", + Tags = [], + Functions = [] + }; } diff --git a/TestPlugin.CSharp/TestPlugin.CSharp.csproj b/TestPlugin.CSharp/TestPlugin.CSharp.csproj index a533f98..3f24b18 100644 --- a/TestPlugin.CSharp/TestPlugin.CSharp.csproj +++ b/TestPlugin.CSharp/TestPlugin.CSharp.csproj @@ -20,6 +20,7 @@ + diff --git a/TestPlugin.Winform.Core/Controller.cs b/TestPlugin.Winform.Core/Controller.cs index c4348b7..222b5b1 100644 --- a/TestPlugin.Winform.Core/Controller.cs +++ b/TestPlugin.Winform.Core/Controller.cs @@ -1,13 +1,13 @@ using KitX.Contract.CSharp; -using KitX.Shared.Plugin; using KitX.Shared.WebCommand; +using KitX.Shared.WebCommand.Details; using System.Text.Json; namespace TestPlugin.Winform.Core; public class Controller : IController { - private Action? sendCommandAction; + private Action? sendCommandAction; public void Start() { @@ -31,25 +31,9 @@ public void Execute(Command cmd) Console.WriteLine($"Execute: {JsonSerializer.Serialize(cmd)}"); } - public List GetFunctions() - { - return new(); - } - - public void SetSendCommandAction(Action action) => sendCommandAction = action; - - public void SetRootPath(string path) - { - Console.WriteLine($"Root path: {path}"); - } + public void SetSendCommandAction(Action action) => sendCommandAction = action; - public void SetWorkPath(string path) - { - Console.WriteLine($"Work path: {path}"); - } - - public void SetCommandsSendBuffer(ref Queue commands) - { - throw new NotImplementedException(); - } + public void SetWorkingDetail(PluginWorkingDetail workingDetail) => MessageBox.Show( + JsonSerializer.Serialize(workingDetail) + ); } diff --git a/TestPlugin.Winform.Core/IdentityInterface.cs b/TestPlugin.Winform.Core/IdentityInterface.cs index 6993196..df74135 100644 --- a/TestPlugin.Winform.Core/IdentityInterface.cs +++ b/TestPlugin.Winform.Core/IdentityInterface.cs @@ -1,60 +1,51 @@ using KitX.Contract.CSharp; +using KitX.Shared.Plugin; namespace TestPlugin.Winform.Core; public class IdentityInterface : IIdentityInterface { - public string GetName() => "TestPlugin.Winform.Core"; - - public string GetVersion() => "v0.1.0"; + public IController GetController() => new Controller(); - public Dictionary GetDisplayName() => new() + public IMarketPluginContract GetMarketPluginContract() => null!; + + public PluginInfo GetPluginInfo() => new() + { + Name = "TestPlugin.Winform.Core", + Version = "v0.1.0", + AuthorName = "Dynesshely", + AuthorLink = "https://blog.catrol.cn", + PublisherName = "Crequency", + PublisherLink = "https://catrol.cn", + DisplayName = new() { { "zh-cn", "适用于 C# Winform 框架的 KitX 测试用插件" }, - { "zh-cnt", "適用於 C# Winform 框架的 KitX 測試用插件" }, + { "zh-tw", "適用於 C# Winform 框架的 KitX 測試用插件" }, { "en-us", "KitX Testing Plugin for C# with Winform framework" }, - }; - - public string GetAuthorName() => "Dynesshely"; - - public string GetPublisherName() => "Crequency"; - public string GetAuthorLink() => "https://blog.catrol.cn"; - - public string GetPublisherLink() => "https://catrol.cn"; - - public Dictionary GetSimpleDescription() => new() + }, + SimpleDescription = new() { { "zh-cn", "KitX 测试用插件" }, - { "zh-cnt", "KitX 測試用插件" }, + { "zh-tw", "KitX 測試用插件" }, { "en-us", "KitX Test Plugin" }, - }; - - public Dictionary GetComplexDescription() => new() + }, + ComplexDescription = new() { { "zh-cn", "KitX 测试用插件, 使用 KitX.Loader.Winform.Core 作为加载器." }, - { "zh-cnt", "KitX 測試用插件, 使用 KitX.Loader.Winform.Core 作爲加載器." }, + { "zh-tw", "KitX 測試用插件, 使用 KitX.Loader.Winform.Core 作爲加載器." }, { "en-us", "KitX Test Plugin, use KitX.Loader.Winform.Core as loader." }, - }; - - public Dictionary GetTotalDescriptionInMarkdown() => new() + }, + TotalDescriptionInMarkdown = new() { { "zh-cn", "Nope" }, - { "zh-cnt", "Nope" }, + { "zh-tw", "Nope" }, { "en-us", "Nope" }, - }; - - public string GetIconInBase64() => "图标"; - - public DateTime GetPublishDate() => DateTime.Now; - - public DateTime GetLastUpdateDate() => DateTime.Now; - - public IController GetController() => new Controller(); - - public bool IsMarketVersion() => false; - - public IMarketPluginContract GetMarketPluginContract() => null; - - public string GetRootStartupFileName() => "TestPlugin.Winform.Core.dll"; + }, + IconInBase64 = "Icon", + PublishDate = DateTime.Now, + LastUpdateDate = DateTime.Now, + IsMarketVersion = false, + RootStartupFileName = "TestPlugin.Winform.Core.dll", + }; } diff --git a/TestPlugin.Winform.Core/TestPlugin.Winform.Core.csproj b/TestPlugin.Winform.Core/TestPlugin.Winform.Core.csproj index 7128591..68c8278 100644 --- a/TestPlugin.Winform.Core/TestPlugin.Winform.Core.csproj +++ b/TestPlugin.Winform.Core/TestPlugin.Winform.Core.csproj @@ -14,6 +14,7 @@ + \ No newline at end of file