diff --git a/.gitmodules b/.gitmodules index fa0c9ae..806d19a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,12 @@ [submodule "Reference/XamlMultiLanguageEditor"] path = Reference/XamlMultiLanguageEditor url = git@github.com:Dynesshely/XamlMultiLanguageEditor.git +[submodule "Cheese"] + path = Cheese + url = git@github.com:Crequency/Cheese.git +[submodule "KitX Loaders"] + path = KitX Loaders + url = git@github.com:Crequency/KitX-Loaders.git +[submodule "KitX Plugins"] + path = KitX Plugins + url = git@github.com:Crequency/KitX-Plugins.git diff --git a/Cheese b/Cheese new file mode 160000 index 0000000..be7f364 --- /dev/null +++ b/Cheese @@ -0,0 +1 @@ +Subproject commit be7f364ef7071b10a91214b3bdbd9bf14ed6a5ca diff --git a/KitX Loaders b/KitX Loaders new file mode 160000 index 0000000..ff71cbe --- /dev/null +++ b/KitX Loaders @@ -0,0 +1 @@ +Subproject commit ff71cbe717f03ad6cb66849086eae753093d19f4 diff --git a/KitX Plugins b/KitX Plugins new file mode 160000 index 0000000..5b5aca9 --- /dev/null +++ b/KitX Plugins @@ -0,0 +1 @@ +Subproject commit 5b5aca9ba5f70179ce9cc4ee8c2f89ce7c22c71a diff --git a/KitX.KXP.Tool/KitX-Background-ani.png b/KitX.KXP.Tool/KitX-Background-ani.png deleted file mode 100644 index 7abdbc3..0000000 Binary files a/KitX.KXP.Tool/KitX-Background-ani.png and /dev/null differ diff --git a/KitX.KXP.Tool/KitX.KXP.Tool.csproj b/KitX.KXP.Tool/KitX.KXP.Tool.csproj deleted file mode 100644 index cff8bff..0000000 --- a/KitX.KXP.Tool/KitX.KXP.Tool.csproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - Exe - net7.0 - enable - enable - - - - True - Dynesshely - Crequency - KitX-Background-ani.png - True - kxpmaker - AGPL-3.0-only - True - https://github.com/Crequency/KitX/ - https://github.com/Crequency/KitX-Tools/ - README.md - kitx;kitx-tool;kxp;maker;packer;kxpmaker - - - - $(Version) - $(Version) - 1.2.$([System.DateTime]::UtcNow.Date.Subtract($([System.DateTime]::Parse("2005-06-06"))).TotalDays).$([System.Math]::Floor($([System.DateTime]::UtcNow.TimeOfDay.TotalMinutes))) - - - - - - - - - - - - - - True - \ - - - True - \ - - - - diff --git a/KitX.KXP.Tool/Options.cs b/KitX.KXP.Tool/Options.cs deleted file mode 100644 index 4f43797..0000000 --- a/KitX.KXP.Tool/Options.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CommandLine; - -namespace KitX.KXP.Tool; - -public class OptionsBase -{ - [Option('v', "verbose", Required = false, HelpText = "Set output to verbose messages.")] - public bool Verbose { get; set; } -} - -public class Options : OptionsBase -{ - -} - -[Verb("pack", isDefault: true, HelpText = "Pack plugin files into `.kxp` file.")] -public class PackOptions : OptionsBase -{ - - [Option('s', "source", Required = true, HelpText = "Source files path.")] - public string? SourcePath { get; set; } - - [Option('o', "output", HelpText = "Output path of `.kxp` file.")] - public string OutputPath { get; set; } = "./"; - - [Option('n', "output-file-name", HelpText = "Output file name.")] - public string? OutputFileName { get; set; } - - [Option('l', "loader", HelpText = "Loader struct file path.")] - public string? LoaderStructPath { get; set; } - - [Option('p', "plugin", HelpText = "Plugin struct file path.")] - public string? PluginStructPath { get; set; } - - [Option('i', "ignore", Separator = ',', HelpText = "File extensions to ignore.")] - public IEnumerable? IgnoredFileExtensions { get; set; } -} diff --git a/KitX.KXP.Tool/Program.cs b/KitX.KXP.Tool/Program.cs deleted file mode 100644 index 71055f2..0000000 --- a/KitX.KXP.Tool/Program.cs +++ /dev/null @@ -1,85 +0,0 @@ -using CommandLine; -using Common.BasicHelper.Utils.Extensions; -using KitX.KXP.Tool; -using System.Text; -using Encoder = KitX.Formats.KXP.Encoder; - -Parser.Default.ParseArguments(args) - .WithParsed(options => - { - options.SourcePath ??= "./".GetFullPath(); - options.SourcePath = options.SourcePath.GetFullPath(); - options.OutputPath = options.OutputPath.GetFullPath(); - options.OutputFileName ??= new DirectoryInfo(options.SourcePath).Name ?? "Plugin"; - options.LoaderStructPath ??= $"{options.SourcePath}/LoaderStruct.json".GetFullPath(); - options.LoaderStructPath = options.LoaderStructPath.GetFullPath(); - options.PluginStructPath ??= $"{options.SourcePath}/PluginStruct.json".GetFullPath(); - options.PluginStructPath = options.PluginStructPath.GetFullPath(); - options.IgnoredFileExtensions ??= new List(); - - if (options.Verbose) - { - var ext_sb = new StringBuilder(); - foreach (var item in options.IgnoredFileExtensions) - ext_sb.Append($"{item}, "); - var ignoredFileExtensions = ext_sb - .ToString()[..(ext_sb.Length - 2 > 0 ? ext_sb.Length - 2 : 0)]; - - Console.WriteLine( - $""" - {nameof(options.SourcePath)}: {options.SourcePath} - {nameof(options.OutputPath)}: {options.OutputPath} - {nameof(options.OutputFileName)}: {options.OutputFileName} - {nameof(options.PluginStructPath)}: {options.PluginStructPath} - {nameof(options.LoaderStructPath)}: {options.LoaderStructPath} - {nameof(options.IgnoredFileExtensions)}: {ignoredFileExtensions} - """ - ); - } - - var files = new List(); - var sb = new StringBuilder(); - var directories = new Queue(); - - var getAllFiles = (string path) => - { - var info = new DirectoryInfo(path); - foreach (var item in info.GetFiles()) - { - if (options.IgnoredFileExtensions.Contains(Path.GetExtension(item.FullName))) - sb.AppendLine($"Ignored file: {item.FullName}"); - else - { - files.Add(item.FullName); - sb.AppendLine($"Found file: {item.FullName}"); - } - } - foreach (var item in info.GetDirectories()) - directories.Enqueue(item.FullName); - }; - - getAllFiles(options.SourcePath); - - while (directories.Count > 0) - getAllFiles(directories.Dequeue()); - - if (options.Verbose) - Console.WriteLine(sb.ToString()); - - var encoder = new Encoder( - files, - File.ReadAllText(options.LoaderStructPath), - File.ReadAllText(options.PluginStructPath), - new() - { - Verbose = options.Verbose - } - ); - - encoder.Encode( - options.SourcePath, - options.OutputPath, - options.OutputFileName - ); - - }); diff --git a/KitX.KXP.Tool/README.md b/KitX.KXP.Tool/README.md deleted file mode 100644 index 96b980a..0000000 --- a/KitX.KXP.Tool/README.md +++ /dev/null @@ -1,101 +0,0 @@ -# About - -This is a dotnet tool for `KitX Project`. - -This tool is used to pack `KitX Plugin` files into `.kxp` format file for `KitX Dashboard`. - -# Usage - -## Requirements - -You need install dotnet sdk first ! (6.0+ recommended) - -## Install - -```shell -# Use dotnet tool command to install. -dotnet tool install --global KitX.KXP.Tool - -# After install, you can use `kxpmaker` command to visit it. -kxpmaker --version -``` - -## Help - -```shell -# Use `--help` global argument to get help doc. -kxpmaker --help -``` - -Output would like be: - -```text -KitX.KXP.Tool 1.2.6543.440 -Copyright (C) 2023 Crequency - - pack (Default Verb) Pack plugin files into `.kxp` file. - - help Display more information on a specific command. - - version Display version information. - -``` - -If you want to get help doc for `pack` command, you can use: - -```shell -kxpmaker pack --help -``` - -## Pack - -We can take a look output of `kxpmaker pack --help` first. - -It would like be: - -```text -KitX.KXP.Tool 1.2.6543.440 -Copyright (C) 2023 Crequency - -ERROR(S): - Required option 's, source' is missing. - - -s, --source Required. Source files path. - - -o, --output Output path of `.kxp` file. - - -n, --output-file-name Output file name. - - -l, --loader Loader struct file path. - - -p, --plugin Plugin struct file path. - - -i, --ignore File extensions to ignore. - - -v, --verbose Set output to verbose messages. - - --help Display this help screen. - - --version Display version information. - -``` - -Then we can use `kxpmaker` command as belowed to pack plugin files. - -```shell -# Put all plugin files into `./plugin/` directory for example. -mkdir plugin - -# Use `ksmaker` to generate `PluginStruct.json` and `LoaderStruct.json` files if you do not have them. -ksmaker -o ./plugin/ - -# Edit generated files to custom them, use `vim` for example. -vim ./plugin/PluginStruct.json -vim ./plugin/LoaderStruct.json - -# Pack your files. -# In default, output file name would be directory name, -# for example, belowed command would output to `plugin.kxp` file, -# you can also use `-n` argument to custom output file name. -kxpmaker -s ./plugin/ -``` diff --git a/KitX.Struct.Producer/KitX-Background-ani.png b/KitX.Struct.Producer/KitX-Background-ani.png deleted file mode 100644 index 7abdbc3..0000000 Binary files a/KitX.Struct.Producer/KitX-Background-ani.png and /dev/null differ diff --git a/KitX.Struct.Producer/KitX.Struct.Producer.csproj b/KitX.Struct.Producer/KitX.Struct.Producer.csproj deleted file mode 100644 index 55f1a86..0000000 --- a/KitX.Struct.Producer/KitX.Struct.Producer.csproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - Exe - net7.0 - enable - enable - - - - True - Dynesshely - Crequency - KitX-Background-ani.png - True - ksmaker - AGPL-3.0-only - True - https://github.com/Crequency/KitX/ - https://github.com/Crequency/KitX-Tools/ - README.md - kitx;kitx-tool;ks;maker;generater;ksmaker - - - - $(Version) - $(Version) - 1.2.$([System.DateTime]::UtcNow.Date.Subtract($([System.DateTime]::Parse("2005-06-06"))).TotalDays).$([System.Math]::Floor($([System.DateTime]::UtcNow.TimeOfDay.TotalMinutes))) - - - - - - - - - - - - - - \ - True - - - True - \ - - - - diff --git a/KitX.Struct.Producer/Options.cs b/KitX.Struct.Producer/Options.cs deleted file mode 100644 index 82ab28f..0000000 --- a/KitX.Struct.Producer/Options.cs +++ /dev/null @@ -1,35 +0,0 @@ -using CommandLine; - -namespace KitX.Struct.Producer; - -public class OptionsBase -{ - [Option('v', "verbose", Required = false, HelpText = "Set output to verbose messages.")] - public bool Verbose { get; set; } -} - -public class Options : OptionsBase -{ - -} - -[Verb( - "generate", - aliases: new string[] { "gen" }, - isDefault: true, - HelpText = "Generate KitX (Loader/Plugin) Struct." -)] -public class GenerateOptions : OptionsBase -{ - [Option('a', "all", Group = "templates", Default = true, HelpText = "Generate All.")] - public bool GenerateAll { get; set; } - - [Option('l', "loader", Group = "templates", HelpText = "Generate Loader Struct.")] - public bool GenerateLoaderStruct { get; set; } - - [Option('p', "plugin", Group = "templates", HelpText = "Generate Plugin Struct.")] - public bool GeneratePluginStruct { get; set; } - - [Option('o', "output", Required = false, HelpText = "Output path.")] - public string OutputPath { get; set; } = "./"; -} diff --git a/KitX.Struct.Producer/Producer.cs b/KitX.Struct.Producer/Producer.cs deleted file mode 100644 index ce20de5..0000000 --- a/KitX.Struct.Producer/Producer.cs +++ /dev/null @@ -1,114 +0,0 @@ -using KitX.Web.Rules; -using System.Text.Json; - -namespace KitX.Struct.Producer; - -internal class Producer -{ - public static void ProduceDefaultPluginStruct(string path) - { - var options = new JsonSerializerOptions() - { - WriteIndented = true, - IncludeFields = true, - }; - var ps = new PluginStruct() - { - Name = "Plugin.Name", - Version = "v1.0.0", - DisplayName = new() - { - { "zh-cn", "显示名称" }, - { "en-us", "Display Name" } - }, - AuthorName = "AuthorName", - PublisherName = "PublisherName", - AuthorLink = "https://blog.catrol.cn", - PublisherLink = "https://www.catrol.cn", - SimpleDescription = new() - { - { "zh-cn", "简单描述" }, - { "en-us", "SimpleDescription" } - }, - ComplexDescription = new() - { - { "zh-cn", "复杂描述" }, - { "en-us", "ComplexDescription" } - }, - TotalDescriptionInMarkdown = new() - { - { "zh-cn", "Markdown 语法完整描述" }, - { "en-us", "TotalDescriptionInMarkdown" } - }, - IconInBase64 = "Base64 Format Icon", - PublishDate = DateTime.Now, - LastUpdateDate = DateTime.Now, - IsMarketVersion = false, - Tags = new(), - Functions = new() - { - new() - { - Name = "FunctionName", - DisplayNames = new() - { - { "zh-cn", "功能显示名称" }, - { "en-us", "DisplayNames" } - }, - Parameters = new() - { - { - "ParameterName", - new() - { - { "zh-cn", "参数显示名称" }, - { "en-us", "Parameter Display Name" } - } - } - }, - ParametersType = new() - { - "string" - }, - HasAppendParameters = false, - ReturnValueType = "void" - } - }, - RootStartupFileName = "RootStartupFileName" - }; - File.WriteAllText( - Path.GetFullPath($"{path}/PluginStruct.json"), - JsonSerializer.Serialize(ps, options) - ); - } - - public static void ProduceDefaultLoaderStruct(string path) - { - var options = new JsonSerializerOptions() - { - WriteIndented = true, - IncludeFields = true, - }; - var ls = new LoaderStruct() - { - SelfLoad = false, - LoaderName = "LoaderName", - LoaderVersion = "v1.0.0", - LoaderLanguage = "CSharp", - LoaderFramework = "Avalonia", - LoaderRunType = LoaderStruct.RunType.Desktop, - SupportOS = new() - { - OperatingSystems.Windows, OperatingSystems.MacOS, OperatingSystems.Linux - }, - Tags = new() - { - { "LoaderStartupArguments", "" } - } - }; - File.WriteAllText( - Path.GetFullPath($"{path}/LoaderStruct.json"), - JsonSerializer.Serialize(ls, options) - ); - } -} diff --git a/KitX.Struct.Producer/Program.cs b/KitX.Struct.Producer/Program.cs deleted file mode 100644 index f4d3284..0000000 --- a/KitX.Struct.Producer/Program.cs +++ /dev/null @@ -1,36 +0,0 @@ -using CommandLine; -using KitX.Struct.Producer; - -var globalOptions = new Options(); - -Parser.Default.ParseArguments(args) - .WithParsed(options => globalOptions = options) - .WithParsed(options => - { - var path = options.OutputPath; - - if (!Directory.Exists(path)) - throw new ArgumentException($"Path {path} not exists."); - - if (options.Verbose) - { - Console.WriteLine($"{nameof(options.GenerateAll)}: {options.GenerateAll}"); - Console.WriteLine( - $"{nameof(options.GeneratePluginStruct)}: {options.GeneratePluginStruct}" - ); - Console.WriteLine( - $"{nameof(options.GenerateLoaderStruct)}: {options.GenerateLoaderStruct}" - ); - } - - if (options.GeneratePluginStruct || options.GenerateLoaderStruct) - options.GenerateAll = false; - - if (options.GenerateAll || options.GeneratePluginStruct) - Producer.ProduceDefaultPluginStruct(path); - - if (options.GenerateAll || options.GenerateLoaderStruct) - Producer.ProduceDefaultLoaderStruct(path); - - Environment.Exit(0); - }); diff --git a/KitX.Struct.Producer/README.md b/KitX.Struct.Producer/README.md deleted file mode 100644 index b4ab7af..0000000 --- a/KitX.Struct.Producer/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# About - -This is a dotnet tool for `KitX Project`. - -This tool is used to generate `PluginStruct.json` and `LoaderStruct.json` files for `KitX Plugin`. - -# Usage - -## Requirements - -You need install dotnet sdk first ! (6.0+ recommended) - -## Install - -```shell -# Use dotnet tool command to install. -dotnet tool install --global KitX.Struct.Producer - -# After install, you can use `ksmaker` command to visit it. -ksmaker --version -``` - -## Help - -```shell -# Use `--help` global argument to get help doc. -ksmaker --help -``` - -Output would like be: - -```text -KitX.Struct.Producer 1.2.6543.440 -Copyright (C) 2023 Crequency - - generate, gen (Default Verb) Generate KitX (Loader/Plugin) Struct. - - help Display more information on a specific command. - - version Display version information. - -``` - -If you want to get help doc for `generate` command, you can use: - -```shell -ksmaker gen --help -``` - -## Generate - -We can take a look output of `ksmaker gen --help` first. - -It would like be: - -```text -KitX.Struct.Producer 1.2.6543.440 -Copyright (C) 2023 Crequency - - -a, --all (Group: templates) (Default: true) Generate All. - - -l, --loader (Group: templates) Generate Loader Struct. - - -p, --plugin (Group: templates) Generate Plugin Struct. - - -o, --output Output path. - - -v, --verbose Set output to verbose messages. - - --help Display this help screen. - - --version Display version information. - -``` - -Then we can use `ksmaker gen` command to generate struct files. - -In default, it would generate `PluginStruct.json` and `LoaderStruct.json` files in current directory. - -You can use `-o` argument to set output path. - -If you pass `-l` argument, it would generate `LoaderStruct.json` file only. - -If you pass `-p` argument, it would generate `PluginStruct.json` file only. - -If you pass `-a` argument, it would generate `PluginStruct.json` and `LoaderStruct.json` files, this option is default set to true. - diff --git a/README.md b/README.md index 0068756..03ad486 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ -# KitX Tools +# KitX SDK +This repo is the software development kits repo for KitX. +Including: + +- `Cheese`, auxiliary tools for KitX development. +- `KitX Loaders`, the loaders for KitX. +- `KitX Plugins`, the plugins for KitX. diff --git a/Reference/XamlMultiLanguageEditor b/Reference/XamlMultiLanguageEditor index 2a7f9cd..e9bba03 160000 --- a/Reference/XamlMultiLanguageEditor +++ b/Reference/XamlMultiLanguageEditor @@ -1 +1 @@ -Subproject commit 2a7f9cd92b4047893f1fc4ef1e608cad68e8e5de +Subproject commit e9bba034a5e20989426487c6c8e8fbc545155104