取消使用流程上下文自定义的字典数据;更改流程环境接口的输出方式

This commit is contained in:
fengjiayi
2024-11-08 17:30:51 +08:00
parent dff9a00fb6
commit 8c54b9a014
41 changed files with 448 additions and 505 deletions

View File

@@ -106,7 +106,7 @@ namespace Serein.Library.Web
var url = AddRoutesUrl(autoHostingAttribute, routeAttribute, controllerType, method);
if (url is null) continue;
Console.WriteLine(url);
SereinEnv.WriteLine(InfoType.INFO, url);
var apiType = routeAttribute.ApiType.ToString();
var config = new ApiHandleConfig(method);
@@ -248,7 +248,7 @@ namespace Serein.Library.Web
catch (Exception ex1)
{
Console.WriteLine(ex1);
SereinEnv.WriteLine(InfoType.ERROR, ex1.ToString());
}
}

View File

@@ -1,4 +1,5 @@
using System;
using Serein.Library.Utils;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Net;
@@ -54,7 +55,7 @@ namespace Serein.Library.Web
catch(Exception ex)
{
listener = null;
Console.WriteLine(ex);
SereinEnv.WriteLine(InfoType.INFO, ex.ToString());
}
//_ = Task.Run(async () =>
@@ -120,7 +121,7 @@ namespace Serein.Library.Web
// 获取用户的IP地址和端口
IPAddress ipAddress = remoteEndPoint.Address;
int port = remoteEndPoint.Port;
Console.WriteLine("外部连接:" + ipAddress.ToString() + ":" + port);
SereinEnv.WriteLine(InfoType.INFO, "外部连接:" + ipAddress.ToString() + ":" + port);
}
// 停止服务器
@@ -132,9 +133,9 @@ namespace Serein.Library.Web
listener?.Stop(); // 停止监听
listener?.Close(); // 关闭监听器
}
catch (Exception EX)
catch (Exception ex)
{
Console.WriteLine(EX);
SereinEnv.WriteLine(InfoType.ERROR, ex.ToString());
}
}

View File

@@ -1,5 +1,6 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Serein.Library.Utils;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -97,7 +98,7 @@ namespace Serein.Library.Network.WebSocketCommunication.Handle
string msgId = jsonObject.GetValue(moduleConfig.MsgIdJsonKey)?.ToString();
if (_myMsgIdHash.Contains(msgId))
{
Console.WriteLine($"[{msgId}]{theme} 消息重复");
SereinEnv.WriteLine(InfoType.WARN, $"[{msgId}]{theme} 消息重复");
return;
}
context.MsgId = msgId; // 添加 ID
@@ -118,7 +119,7 @@ namespace Serein.Library.Network.WebSocketCommunication.Handle
}
catch (Exception ex)
{
Console.WriteLine($"error in ws : {ex.Message}{Environment.NewLine}json value:{jsonObject}");
SereinEnv.WriteLine(InfoType.ERROR, $"error in ws : {ex.Message}{Environment.NewLine}json value:{jsonObject}");
}
finally
{

View File

@@ -1,4 +1,5 @@
using System;
using Serein.Library.Utils;
using System;
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
@@ -169,13 +170,13 @@ namespace Serein.Library.Network.WebSocketCommunication.Handle
return;
}
Console.WriteLine($"add websocket handle model :");
Console.WriteLine($"theme key, data key : {themeKey}, {dataKey}");
SereinEnv.WriteLine(InfoType.INFO, $"add websocket handle model :");
SereinEnv.WriteLine(InfoType.ERROR, $"theme key, data key : {themeKey}, {dataKey}");
foreach (var config in configs)
{
Console.WriteLine($"theme value : {config.ThemeValue} ");
SereinEnv.WriteLine(InfoType.ERROR, $"theme value : {config.ThemeValue} ");
var result = handleModule.AddHandleConfigs(config);
}

View File

@@ -56,17 +56,11 @@ namespace Serein.Library.Network.WebSocketCommunication
/// <summary>
/// 发送消息
/// </summary>
/// <param name="webSocket"></param>
/// <param name="message"></param>
/// <returns></returns>
public async Task SendAsync(string message)
{
//Console.WriteLine("发送消息");
//await Task.Delay(2000);
await SocketExtension.SendAsync(this._client, message); // 回复客户端
//Console.WriteLine();
//var buffer = Encoding.UTF8.GetBytes(message);
//await _client.SendAsync(new ArraySegment<byte>(buffer), WebSocketMessageType.Text, true, CancellationToken.None);
}
/// <summary>