Skip to content

Commit

Permalink
🔧 Fix(Plugins): Fixed two not debugged plugins.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dynesshely committed Feb 25, 2024
1 parent 02d9b24 commit 5b5aca9
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 116 deletions.
22 changes: 6 additions & 16 deletions TestPlugin.CSharp/Controller.cs
Original file line number Diff line number Diff line change
@@ -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<Command>? sendCommandAction;
private Action<Request>? sendCommandAction;

public void Start()
{
Expand All @@ -34,20 +35,9 @@ public List<Function> GetFunctions()
return [];
}

public void SetSendCommandAction(Action<Command> action) => sendCommandAction = action;
public void SetSendCommandAction(Action<Request> 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<Command> commands)
{
throw new NotImplementedException();
}
public void SetWorkingDetail(PluginWorkingDetail workingDetail) => Console.WriteLine(
$"WorkingDetail: {JsonSerializer.Serialize(workingDetail)}"
);
}
70 changes: 31 additions & 39 deletions TestPlugin.CSharp/IdentityInterface.cs
Original file line number Diff line number Diff line change
@@ -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<string, string> 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<string, string> 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<string, string> 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<string, string> GetTotalDescriptionInMarkdown() => new()
},
TotalDescriptionInMarkdown = new()
{
{
"zh-cn",
Expand All @@ -48,7 +46,7 @@ 使用 KitX.Loader.CSharp 作为加载器
"""
},
{
"zh-cnt",
"zh-tw",
"""
# 關於
這是一個適用於 C# 的 KitX 測試用插件
Expand All @@ -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 = []
};
}
1 change: 1 addition & 0 deletions TestPlugin.CSharp/TestPlugin.CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

<ItemGroup>
<ProjectReference Include="..\..\..\KitX Standard\KitX Contracts\KitX.Contract.CSharp\KitX.Contract.CSharp.csproj" />
<ProjectReference Include="..\..\..\KitX Standard\KitX.Shared\KitX.Shared.csproj" />
</ItemGroup>

</Project>
28 changes: 6 additions & 22 deletions TestPlugin.Winform.Core/Controller.cs
Original file line number Diff line number Diff line change
@@ -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<Command>? sendCommandAction;
private Action<Request>? sendCommandAction;

public void Start()
{
Expand All @@ -31,25 +31,9 @@ public void Execute(Command cmd)
Console.WriteLine($"Execute: {JsonSerializer.Serialize(cmd)}");
}

public List<Function> GetFunctions()
{
return new();
}

public void SetSendCommandAction(Action<Command> action) => sendCommandAction = action;

public void SetRootPath(string path)
{
Console.WriteLine($"Root path: {path}");
}
public void SetSendCommandAction(Action<Request> action) => sendCommandAction = action;

public void SetWorkPath(string path)
{
Console.WriteLine($"Work path: {path}");
}

public void SetCommandsSendBuffer(ref Queue<Command> commands)
{
throw new NotImplementedException();
}
public void SetWorkingDetail(PluginWorkingDetail workingDetail) => MessageBox.Show(
JsonSerializer.Serialize(workingDetail)
);
}
69 changes: 30 additions & 39 deletions TestPlugin.Winform.Core/IdentityInterface.cs
Original file line number Diff line number Diff line change
@@ -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<string, string> 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<string, string> GetSimpleDescription() => new()
},
SimpleDescription = new()
{
{ "zh-cn", "KitX 测试用插件" },
{ "zh-cnt", "KitX 測試用插件" },
{ "zh-tw", "KitX 測試用插件" },
{ "en-us", "KitX Test Plugin" },
};

public Dictionary<string, string> 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<string, string> 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",
};
}
1 change: 1 addition & 0 deletions TestPlugin.Winform.Core/TestPlugin.Winform.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

<ItemGroup>
<ProjectReference Include="..\..\..\KitX Standard\KitX Contracts\KitX.Contract.CSharp\KitX.Contract.CSharp.csproj" />
<ProjectReference Include="..\..\..\KitX Standard\KitX.Shared\KitX.Shared.csproj" />
</ItemGroup>

</Project>

0 comments on commit 5b5aca9

Please sign in to comment.