Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pull Request] ToolKits 更新 #212

Merged
merged 3 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions KitX.sln
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Algorithm.UnitTest",
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ToolKits", "ToolKits", "{C2B042C4-453F-4494-86AF-D1513DC5E9AA}"
ProjectSection(SolutionItems) = preProject
ToolKits\async.ps1 = ToolKits\async.ps1
ToolKits\async.sh = ToolKits\async.sh
ToolKits\clear.sh = ToolKits\clear.sh
ToolKits\publish.cs = ToolKits\publish.cs
ToolKits\start.ps1 = ToolKits\start.ps1
ToolKits\start.sh = ToolKits\start.sh
EndProjectSection
Expand All @@ -204,6 +200,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XamlMultiLanguageEditor.Win
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KitX.RepairTool", "KitX Dashboard Helper\KitX.RepairTool\KitX.RepairTool.csproj", "{457915B6-1050-448A-A371-86BAAB98A159}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ToolKits", "ToolKits", "{D18593CB-C881-4796-A2E2-EFB2195A8F86}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KitX.ToolKits.Publisher", "ToolKits\KitX.ToolKits.Publisher\KitX.ToolKits.Publisher.csproj", "{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1108,6 +1108,26 @@ Global
{457915B6-1050-448A-A371-86BAAB98A159}.Release|x64.Build.0 = Release|Any CPU
{457915B6-1050-448A-A371-86BAAB98A159}.Release|x86.ActiveCfg = Release|Any CPU
{457915B6-1050-448A-A371-86BAAB98A159}.Release|x86.Build.0 = Release|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Debug|ARM.ActiveCfg = Debug|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Debug|ARM.Build.0 = Debug|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Debug|ARM64.Build.0 = Debug|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Debug|x64.ActiveCfg = Debug|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Debug|x64.Build.0 = Debug|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Debug|x86.ActiveCfg = Debug|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Debug|x86.Build.0 = Debug|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Release|Any CPU.Build.0 = Release|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Release|ARM.ActiveCfg = Release|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Release|ARM.Build.0 = Release|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Release|ARM64.ActiveCfg = Release|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Release|ARM64.Build.0 = Release|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Release|x64.ActiveCfg = Release|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Release|x64.Build.0 = Release|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Release|x86.ActiveCfg = Release|Any CPU
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1173,6 +1193,7 @@ Global
{DFE993C1-968E-4F09-987B-EB5678CAE98C} = {CF9D7D6C-CE00-4D88-AD1C-B084BB35CA99}
{DDDBDC20-C4FA-44B7-AF71-DC2E39DF5C11} = {DFE993C1-968E-4F09-987B-EB5678CAE98C}
{457915B6-1050-448A-A371-86BAAB98A159} = {0BE49855-23A1-46C9-BA6E-1B94ECF5F213}
{1E1253F3-F24B-4085-833F-C2BEAE6C0B64} = {D18593CB-C881-4796-A2E2-EFB2195A8F86}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {09BBC227-F41B-4D10-9E38-0EEE07ED17BC}
Expand Down
10 changes: 10 additions & 0 deletions ToolKits/KitX.ToolKits.Publisher/KitX.ToolKits.Publisher.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
112 changes: 112 additions & 0 deletions ToolKits/KitX.ToolKits.Publisher/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
using System.Diagnostics;

Console.WriteLine("""
KitX.ToolKits.Publisher
Copyright (C) Crequency 2023
""");

var path = Path.GetFullPath("../../KitX Dashboard/");
var pro = "Properties/";
var pub = "PublishProfiles/";
var ab_pub_path = Path.GetFullPath($"{path}{pro}{pub}");
var files = Directory.GetFiles(ab_pub_path, "*.pubxml",
SearchOption.AllDirectories);

var finished_threads = 0;
var executing_thread_index = 0;
var update_finished_threads_lock = new object();
var single_thread_update_lock = new object();
var thread_output_colors = new Dictionary<int, ConsoleColor>();
var available_colors = new List<int>()
{
1, 2, 3, 5, 9, 10, 11, 13
};
var used_colors_count = 0;
var default_color = Console.ForegroundColor;
var random = new Random();
var get_random_color = () =>
{
var cc = available_colors[random.Next(0, available_colors.Count)];
if (used_colors_count < available_colors.Count)
{
while (thread_output_colors.Values.ToList().Contains((ConsoleColor)cc))
cc = available_colors[random.Next(0, available_colors.Count)];
}
++used_colors_count;
return (ConsoleColor)cc;
};
var tasks = new List<Action>();

foreach (var item in files)
{
var index = executing_thread_index++;
var color = get_random_color();
thread_output_colors.Add(index, color);
var filename = Path.GetFileName(item);
var print = (string msg) =>
{
Console.ForegroundColor = thread_output_colors[index];
Console.WriteLine(msg);
Console.ForegroundColor = default_color;
};
tasks.Add(() =>
{
var cmd = "dotnet";
var arg = $"" +
$"publish \"{Path.GetFullPath(path + "/KitX Dashboard.csproj")}\" " +
$"\"/p:PublishProfile={item}\"";
lock (single_thread_update_lock)
{
print($"" +
$">>> On task_{index}:\n" +
$" Task file: {filename}\n" +
$" Executing: {cmd} {arg}\n" +
$" Output:\n");
}
var process = new Process();
var psi = new ProcessStartInfo()
{
FileName = cmd,
Arguments = arg,
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true,
RedirectStandardError = true
};
//process.StartInfo.FileName = cmd;
//process.StartInfo.Arguments = arg;
//process.StartInfo.CreateNoWindow = false;
//process.StartInfo.UseShellExecute = true;
//process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
process.StartInfo = psi;
process.Start();
while (!process.StandardOutput.EndOfStream)
{
string? line = process.StandardOutput.ReadLine();
Console.ForegroundColor = default_color;
Console.WriteLine($"" +
$" {line}");
}
process.WaitForExit();

lock (update_finished_threads_lock)
{
++finished_threads;
print($"" +
$">>> Finished task_{index}, still {files.Length - finished_threads} tasks running.");
}
});
print($"" +
$">>> New task: task_{index}\t-> {filename}");
}

foreach (var task in tasks)
task.Invoke();

while (finished_threads != files.Length)
{

}

Console.WriteLine($"" +
$">>> All tasks done.");
1 change: 0 additions & 1 deletion ToolKits/async.ps1

This file was deleted.

1 change: 0 additions & 1 deletion ToolKits/async.sh

This file was deleted.

74 changes: 0 additions & 74 deletions ToolKits/clear.sh

This file was deleted.

38 changes: 0 additions & 38 deletions ToolKits/publish.cs

This file was deleted.

25 changes: 25 additions & 0 deletions ToolKits/start.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
echo "Type: $type"

if($type -eq "dashboard"){

echo " | KitX Dashboard"
echo " | KitX Dashboard Helper"
echo " | KitX File Format Helper"
Expand All @@ -14,9 +15,13 @@ if($type -eq "dashboard"){
git submodule update "KitX Dashboard Helper"
git submodule update "KitX File Format Helper"
git submodule update "KitX Rules"

echo ""
echo "To develop <dashboard> sets, you need <reference> sets too."
}

if($type -eq "mobile"){

echo " \ KitX Mobile"
echo ""
echo "executing ..."
Expand All @@ -25,6 +30,7 @@ if($type -eq "mobile"){
}

if($type -eq "loader"){

echo " | KitX Contracts"
echo " | KitX Loaders"
echo " \ KitX Rules"
Expand All @@ -37,6 +43,7 @@ if($type -eq "loader"){
}

if($type -eq "plugin"){

echo " | KitX Contracts"
echo " | KitX Loaders"
echo " | KitX Plugins"
Expand All @@ -51,11 +58,29 @@ if($type -eq "plugin"){
}

if($type -eq "installer"){

echo " \ KitX Installer"
echo ""
echo "executing ..."

git submodule update "KitX Installer"
}

if($type -eq "reference"){

echo " | Reference/Common.Activity"
echo " | Reference/Common.Algorithm"
echo " | Reference/Common.BasicHelper"
echo " | Reference/Common.ExternalConsole"
echo " \ Reference/Common.Update"
echo ""
echo "executing ..."

git submodule update "Reference/Common.Activity"
git submodule update "Reference/Common.Algorithm"
git submodule update "Reference/Common.BasicHelper"
git submodule update "Reference/Common.ExternalConsole"
git submodule update "Reference/Common.Update"
}


Loading