mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-27 21:43:14 +08:00
✨ add clt types test command
This commit is contained in:
@@ -13,9 +13,11 @@ public static partial class AssemblyInfo
|
||||
/// <summary>
|
||||
/// 与应用程序关联的产品名称。
|
||||
/// </summary>
|
||||
public const string Product =
|
||||
#if APP_REVERSE_PROXY
|
||||
$"{Trademark} - Accelerator and script module sub-process";
|
||||
public const string Trademark = "Watt Toolkit";
|
||||
|
||||
public const string Title =
|
||||
#if DEBUG
|
||||
$"[Debug] {Trademark}";
|
||||
#else
|
||||
Trademark;
|
||||
#endif
|
||||
@@ -23,7 +25,7 @@ public static partial class AssemblyInfo
|
||||
/// <summary>
|
||||
/// 与应用程序关联的产品名称。
|
||||
/// </summary>
|
||||
public const string Trademark = "Watt Toolkit";
|
||||
public const string Product = Trademark;
|
||||
|
||||
/// <summary>
|
||||
/// 与该应用程序关联的公司名称。
|
||||
|
||||
@@ -13,9 +13,22 @@ using AssemblyInfo = BD.WTTS.AssemblyInfo;
|
||||
#endif
|
||||
|
||||
#if !UNIT_TEST
|
||||
#if APP_REVERSE_PROXY
|
||||
[assembly: AssemblyTitle($"{AssemblyInfo.Title}(Accelerator)")]
|
||||
#elif APP_HOST
|
||||
[assembly: AssemblyTitle($"{AssemblyInfo.Title}(AppHost)")]
|
||||
#elif DESIGNER
|
||||
[assembly: AssemblyTitle($"{AssemblyInfo.Title}(Designer)")]
|
||||
#else
|
||||
[assembly: AssemblyTitle(AssemblyInfo.Title)]
|
||||
#endif
|
||||
[assembly: AssemblyTrademark(AssemblyInfo.Trademark)]
|
||||
[assembly: AssemblyDescription(AssemblyInfo.Description)]
|
||||
#if APP_REVERSE_PROXY
|
||||
[assembly: AssemblyProduct($"{AssemblyInfo.Product} - Accelerator and script module sub-process")]
|
||||
#else
|
||||
[assembly: AssemblyProduct(AssemblyInfo.Product)]
|
||||
#endif
|
||||
[assembly: AssemblyCopyright(AssemblyInfo.Copyright)]
|
||||
[assembly: AssemblyCompany(AssemblyInfo.Company)]
|
||||
[assembly: AssemblyVersion(AssemblyInfo.Version)]
|
||||
|
||||
@@ -90,6 +90,21 @@
|
||||
<ProjectReference Include="..\BD.WTTS.Client\BD.WTTS.Client.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
|
||||
<!-- Windows Only -->
|
||||
<!-- 修复:Splat.Drawing 包存在 WPF 的依赖项 -->
|
||||
<PackageReference Include="Splat.Drawing">
|
||||
<ExcludeAssets>all</ExcludeAssets>
|
||||
</PackageReference>
|
||||
<Reference Include="Splat.Drawing">
|
||||
<HintPath>$(NugetPackageRoot)\splat.drawing\$(Version_Splat_Drawing)\lib\net7.0\Splat.Drawing.dll</HintPath>
|
||||
</Reference>
|
||||
<!-- 修复:存在 Microsoft.WindowsDesktop.App 依赖时不会将 System.Drawing.Common.dll 复制到输出目录-->
|
||||
<None Include="$(NugetPackageRoot)\system.drawing.common\$(Version_System_Drawing_Common)\runtimes\win\lib\net7.0\System.Drawing.Common.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\TFM_NET7_WITH_DESKTOP.props" />
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -100,8 +100,8 @@
|
||||
<PackageReference Include="dotnetCampus.Ipc" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" />
|
||||
<PackageReference Include="Splat.Drawing" />
|
||||
<PackageReference Include="fusillade" />
|
||||
<PackageReference Include="Splat.Drawing" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'">
|
||||
|
||||
@@ -315,6 +315,77 @@ partial class Startup // 自定义控制台命令参数
|
||||
}),
|
||||
};
|
||||
rootCommand.AddCommand(plugins);
|
||||
|
||||
// -clt types
|
||||
var types = new Command("types", "显示所有类型")
|
||||
{
|
||||
Handler = CommandHandler.Create(() =>
|
||||
{
|
||||
int exitCode = default;
|
||||
using var assemblies_stream = new FileStream(Path.Combine(IOPath.CacheDirectory, "assemblies.txt"), FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete);
|
||||
using var types_stream = new FileStream(Path.Combine(IOPath.CacheDirectory, "types.txt"), FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete);
|
||||
try
|
||||
{
|
||||
var assemblies_ = AppDomain.CurrentDomain.GetAssemblies();
|
||||
HashSet<Assembly> assemblies = new(assemblies_);
|
||||
AppDomain.CurrentDomain.AssemblyLoad += (_, args) =>
|
||||
{
|
||||
var assembly = args.LoadedAssembly;
|
||||
if (assemblies.Add(assembly))
|
||||
{
|
||||
ShowAssembly(assembly);
|
||||
}
|
||||
};
|
||||
foreach (var assembly in assemblies_)
|
||||
{
|
||||
ShowAssembly(assembly);
|
||||
}
|
||||
|
||||
void ShowAssembly(Assembly assembly)
|
||||
{
|
||||
lock (types_stream)
|
||||
{
|
||||
var assemblyName = assembly.FullName;
|
||||
if (!string.IsNullOrWhiteSpace(assemblyName))
|
||||
{
|
||||
assemblies_stream.Write(Encoding.UTF8.GetBytes(assemblyName));
|
||||
assemblies_stream.Write("\r\n"u8);
|
||||
}
|
||||
var types = assembly.GetTypes();
|
||||
foreach (var type in types)
|
||||
{
|
||||
var fullName = type.FullName;
|
||||
if (!string.IsNullOrWhiteSpace(fullName))
|
||||
{
|
||||
types_stream.Write(Encoding.UTF8.GetBytes(fullName));
|
||||
types_stream.Write("\r\n"u8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return exitCode = 200;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
return exitCode = 500;
|
||||
}
|
||||
finally
|
||||
{
|
||||
types_stream.SetLength(types_stream.Position);
|
||||
types_stream.Flush();
|
||||
types_stream.Dispose();
|
||||
assemblies_stream.SetLength(assemblies_stream.Position);
|
||||
assemblies_stream.Flush();
|
||||
assemblies_stream.Dispose();
|
||||
Console.WriteLine($"ExitCode: {exitCode}");
|
||||
#if DEBUG
|
||||
Console.ReadLine();
|
||||
#endif
|
||||
}
|
||||
}),
|
||||
};
|
||||
rootCommand.AddCommand(types);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -9,6 +9,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<IsTrimmable>true</IsTrimmable>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
|
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
|
||||
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
|
||||
|
||||
Reference in New Issue
Block a user