返回提交历史
Added
XFEExtension.NetCore.XFEConsole.Test/Program.cs
+4
-0
Added
XFEExtension.NetCore.XFEConsole.Test/XFEExtension.NetCore.XFEConsole.Test.csproj
+14
-0
Modified
XFEExtension.NetCore.XFEConsole.sln
+10
-1
Modified
XFEExtension.NetCore.XFEConsole/XFEConsole.cs
+5
-9
Modified
XFEExtension.NetCore.XFEConsole/XFEConsoleTextWriter.cs
+2
-0
Modified
XFEExtension.NetCore.XFEConsole/XFEExtension.NetCore.XFEConsole.csproj
+1
-1
XFEstudio/XFEExtension.NetCore.XFEConsole
实装新语法
33b4c49
代码差异
6 个文件
+36
-11
@@ -0,0 +1,4 @@
1
using XFEExtension.NetCore.XFEConsole;
2
3
await XFEConsole.UseXFEConsole();
4
Console.WriteLine(XFEConsole.ClientList);
@@ -0,0 +1,14 @@
1
<Project Sdk="Microsoft.NET.Sdk">
2
3
<PropertyGroup>
4
<OutputType>Exe</OutputType>
5
<TargetFramework>net8.0</TargetFramework>
6
<ImplicitUsings>enable</ImplicitUsings>
7
<Nullable>enable</Nullable>
8
</PropertyGroup>
9
10
<ItemGroup>
11
<ProjectReference Include="..\XFEExtension.NetCore.XFEConsole\XFEExtension.NetCore.XFEConsole.csproj" />
12
</ItemGroup>
13
14
</Project>
@@ -3,7 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
3
3
# Visual Studio Version 17
4
4
VisualStudioVersion = 17.11.35125.118
5
5
MinimumVisualStudioVersion = 10.0.40219.1
6
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XFEExtension.NetCore.XFEConsole", "XFEExtension.NetCore.XFEConsole\XFEExtension.NetCore.XFEConsole.csproj", "{C11CEA93-8F3C-441D-9FCE-9AA71E8C8720}"
6
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XFEExtension.NetCore.XFEConsole", "XFEExtension.NetCore.XFEConsole\XFEExtension.NetCore.XFEConsole.csproj", "{C11CEA93-8F3C-441D-9FCE-9AA71E8C8720}"
7
EndProject
8
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XFEExtension.NetCore.XFEConsole.Test", "XFEExtension.NetCore.XFEConsole.Test\XFEExtension.NetCore.XFEConsole.Test.csproj", "{0BA26A15-576B-426C-BCBA-F6AD3A7D9332}"
9
ProjectSection(ProjectDependencies) = postProject
10
{C11CEA93-8F3C-441D-9FCE-9AA71E8C8720} = {C11CEA93-8F3C-441D-9FCE-9AA71E8C8720}
11
EndProjectSection
7
12
EndProject
8
13
Global
9
14
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +20,10 @@ Global
15
20
{C11CEA93-8F3C-441D-9FCE-9AA71E8C8720}.Debug|Any CPU.Build.0 = Debug|Any CPU
16
21
{C11CEA93-8F3C-441D-9FCE-9AA71E8C8720}.Release|Any CPU.ActiveCfg = Release|Any CPU
17
22
{C11CEA93-8F3C-441D-9FCE-9AA71E8C8720}.Release|Any CPU.Build.0 = Release|Any CPU
23
{0BA26A15-576B-426C-BCBA-F6AD3A7D9332}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24
{0BA26A15-576B-426C-BCBA-F6AD3A7D9332}.Debug|Any CPU.Build.0 = Debug|Any CPU
25
{0BA26A15-576B-426C-BCBA-F6AD3A7D9332}.Release|Any CPU.ActiveCfg = Release|Any CPU
26
{0BA26A15-576B-426C-BCBA-F6AD3A7D9332}.Release|Any CPU.Build.0 = Release|Any CPU
18
27
EndGlobalSection
19
28
GlobalSection(SolutionProperties) = preSolution
20
29
HideSolutionNode = FALSE
@@ -61,15 +61,12 @@ public class XFEConsole
61
61
/// <param name="port">端口</param>
62
62
/// <param name="password">密码</param>
63
63
/// <returns>是否连接成功</returns>
64
public static async Task<bool> UseXFEConsole(int port, string password = "") => await UseXFEConsole($"ws://localhost:{port}/", AppDomain.CurrentDomain.FriendlyName, Guid.NewGuid().ToString(), password);
64
public static async Task<bool> UseXFEConsole(int port = 3280, string password = "") => await UseXFEConsole($"ws://localhost:{port}/", AppDomain.CurrentDomain.FriendlyName, Guid.NewGuid().ToString(), password);
65
65
/// <summary>
66
66
/// 设置XFE控制台
67
67
/// </summary>
68
68
/// <returns></returns>
69
public static void SetConsoleOutput()
70
{
71
Console.SetOut(new XFEConsoleTextWriter(Console.Out));
72
}
69
public static void SetConsoleOutput() => Console.SetOut(new XFEConsoleTextWriter(Console.Out));
73
70
/// <summary>
74
71
/// 连接XFE控制台
75
72
/// </summary>
@@ -101,15 +98,14 @@ public class XFEConsole
101
98
/// <returns></returns>
102
99
public static async Task WriteObject(object? obj, bool onlyProperty = false, bool onlyPublic = true, string remarkName = "分析对象")
103
100
{
104
var objectInfo = "[color red]无法分析对象:[color white]";
101
string? objectInfo;
105
102
try
106
103
{
107
objectInfo = XFEConverter.GetObjectInfo(StringConverter.ColoredObjectAnalyzer, remarkName, ObjectPlace.Main, 0, [obj], obj?.GetType(), obj, onlyProperty, onlyPublic).OutPutObject();
104
objectInfo = $"[foldblock color: white #9898e7 title: 分析对象:{obj?.GetType().Name} text: {XFEConverter.GetObjectInfo(StringConverter.ColoredObjectAnalyzer, remarkName, ObjectPlace.Main, 0, [obj], obj?.GetType(), obj, onlyProperty, onlyPublic).OutPutObject()}]";
108
105
}
109
106
catch (Exception ex)
110
107
{
111
Debug.WriteLine(ex);
112
objectInfo += ex.StackTrace;
108
objectInfo = $"[foldblock color: white #ff0000 title: 错误:{ex.Message} text: {ex}]";
113
109
}
114
110
if (ShowInDebug)
115
111
Debug.WriteLine(objectInfo);
@@ -205,6 +205,8 @@ public class XFEConsoleTextWriter(TextWriter originalTextWriter) : TextWriter
205
205
/// <inheritdoc/>
206
206
public override void WriteLine(object? value)
207
207
{
208
if (value is Exception exception)
209
XFEConsole.WriteLine($"[foldblock color: white #ff0000 title: 错误:{exception.Message} text: {exception}]").Wait();
208
210
if (XFEConsole.AutoAnalyzeObject)
209
211
XFEConsole.WriteObject(value).Wait();
210
212
else
@@ -4,7 +4,7 @@
4
4
<TargetFramework>net8.0</TargetFramework>
5
5
<ImplicitUsings>enable</ImplicitUsings>
6
6
<Nullable>enable</Nullable>
7
<Version>1.0.1</Version>
7
<Version>1.0.2</Version>
8
8
<Authors>XFEstudio</Authors>
9
9
<Company>寰宇朽力网络科技</Company>
10
10
<Description>XFEConsole是一个可以运行用户进行远程输出的调试辅助工具,需要配合XFE工具箱来使用,当然也可以根据本DLL内的架构搭建一个调试工具</Description>