update touchsocket

This commit is contained in:
Kimdiego2098
2023-11-03 11:27:12 +08:00
parent 3fc3c5296f
commit e6b8ff3f91
6 changed files with 19 additions and 19 deletions

View File

@@ -40,9 +40,9 @@ namespace ThingsGateway.Foundation.Core
this.BuildConfig(config);
this.PluginsManager.Raise(nameof(ILoadingConfigPlugin.OnLoadingConfig), this, new ConfigEventArgs(config));
this.PluginsManager?.Raise(nameof(ILoadingConfigPlugin.OnLoadingConfig), this, new ConfigEventArgs(config));
this.LoadConfig(this.Config);
this.PluginsManager.Raise(nameof(ILoadedConfigPlugin.OnLoadedConfig), this, new ConfigEventArgs(config));
this.PluginsManager?.Raise(nameof(ILoadedConfigPlugin.OnLoadedConfig), this, new ConfigEventArgs(config));
}
/// <summary>

View File

@@ -289,7 +289,7 @@ namespace ThingsGateway.Foundation.Dmtp
var message = (DmtpMessage)requestInfo;
if (!this.m_dmtpActor.InputReceivedData(message).GetFalseAwaitResult())
{
this.PluginsManager.Raise(nameof(IDmtpReceivedPlugin.OnDmtpReceived), this, new DmtpMessageEventArgs(message));
this.PluginsManager?.Raise(nameof(IDmtpReceivedPlugin.OnDmtpReceived), this, new DmtpMessageEventArgs(message));
}
}

View File

@@ -427,14 +427,14 @@ namespace ThingsGateway.Foundation.Sockets
}
this.m_serverState = ServerState.Running;
this.PluginsManager.Raise(nameof(IServerStartedPlugin.OnServerStarted), this, new ServiceStateEventArgs(this.m_serverState, default));
this.PluginsManager?.Raise(nameof(IServerStartedPlugin.OnServerStarted), this, new ServiceStateEventArgs(this.m_serverState, default));
return this;
}
catch (Exception ex)
{
this.m_serverState = ServerState.Exception;
this.PluginsManager.Raise(nameof(IServerStartedPlugin.OnServerStarted), this, new ServiceStateEventArgs(this.m_serverState, ex) { Message = ex.Message });
this.PluginsManager?.Raise(nameof(IServerStartedPlugin.OnServerStarted), this, new ServiceStateEventArgs(this.m_serverState, ex) { Message = ex.Message });
throw;
}
}
@@ -472,7 +472,7 @@ namespace ThingsGateway.Foundation.Sockets
this.Clear();
this.m_serverState = ServerState.Stopped;
this.PluginsManager.Raise(nameof(IServerStopedPlugin.OnServerStoped), this, new ServiceStateEventArgs(this.m_serverState, default));
this.PluginsManager?.Raise(nameof(IServerStopedPlugin.OnServerStoped), this, new ServiceStateEventArgs(this.m_serverState, default));
return this;
}
@@ -524,7 +524,7 @@ namespace ThingsGateway.Foundation.Sockets
this.Clear();
this.m_serverState = ServerState.Disposed;
this.PluginsManager.Raise(nameof(IServerStopedPlugin.OnServerStoped), this, new ServiceStateEventArgs(this.m_serverState, default));
this.PluginsManager?.Raise(nameof(IServerStopedPlugin.OnServerStoped), this, new ServiceStateEventArgs(this.m_serverState, default));
this.PluginsManager?.SafeDispose();
}

View File

@@ -234,13 +234,13 @@ namespace ThingsGateway.Foundation.Sockets
this.ServerState = ServerState.Running;
this.PluginsManager.Raise(nameof(IServerStartedPlugin.OnServerStarted), this, new ServiceStateEventArgs(this.ServerState, default));
this.PluginsManager?.Raise(nameof(IServerStartedPlugin.OnServerStarted), this, new ServiceStateEventArgs(this.ServerState, default));
return this;
}
catch (Exception ex)
{
this.ServerState = ServerState.Exception;
this.PluginsManager.Raise(nameof(IServerStartedPlugin.OnServerStarted), this, new ServiceStateEventArgs(this.ServerState, ex) { Message = ex.ToString() });
this.PluginsManager?.Raise(nameof(IServerStartedPlugin.OnServerStarted), this, new ServiceStateEventArgs(this.ServerState, ex) { Message = ex.ToString() });
throw;
}
}
@@ -259,7 +259,7 @@ namespace ThingsGateway.Foundation.Sockets
}
this.m_socketAsyncs.Clear();
this.PluginsManager.Raise(nameof(IServerStartedPlugin.OnServerStarted), this, new ServiceStateEventArgs(this.ServerState, default));
this.PluginsManager?.Raise(nameof(IServerStartedPlugin.OnServerStarted), this, new ServiceStateEventArgs(this.ServerState, default));
return this;
}
@@ -282,7 +282,7 @@ namespace ThingsGateway.Foundation.Sockets
}
this.m_socketAsyncs.Clear();
this.PluginsManager.Raise(nameof(IServerStartedPlugin.OnServerStarted), this, new ServiceStateEventArgs(this.ServerState, default));
this.PluginsManager?.Raise(nameof(IServerStartedPlugin.OnServerStarted), this, new ServiceStateEventArgs(this.ServerState, default));
}
}
base.Dispose(disposing);

View File

@@ -86,11 +86,11 @@ namespace ThingsGateway.Foundation.WebApi
break;
}
this.PluginsManager.Raise(nameof(IWebApiPlugin.OnRequest), this, new WebApiEventArgs(request, default));
this.PluginsManager?.Raise(nameof(IWebApiPlugin.OnRequest), this, new WebApiEventArgs(request, default));
var response = this.RequestContent(request, false, invokeOption.Timeout, invokeOption.Token);
this.PluginsManager.Raise(nameof(IWebApiPlugin.OnResponse), this, new WebApiEventArgs(request, response));
this.PluginsManager?.Raise(nameof(IWebApiPlugin.OnResponse), this, new WebApiEventArgs(request, response));
if (invokeOption.FeedbackType != FeedbackType.WaitInvoke)
{
@@ -152,9 +152,9 @@ namespace ThingsGateway.Foundation.WebApi
break;
}
this.PluginsManager.Raise(nameof(IWebApiPlugin.OnRequest), this, new WebApiEventArgs(request, default));
this.PluginsManager?.Raise(nameof(IWebApiPlugin.OnRequest), this, new WebApiEventArgs(request, default));
var response = this.RequestContent(request, false, invokeOption.Timeout, invokeOption.Token);
this.PluginsManager.Raise(nameof(IWebApiPlugin.OnResponse), this, new WebApiEventArgs(request, response));
this.PluginsManager?.Raise(nameof(IWebApiPlugin.OnResponse), this, new WebApiEventArgs(request, response));
if (invokeOption.FeedbackType != FeedbackType.WaitInvoke)
{

View File

@@ -85,7 +85,7 @@ namespace ThingsGateway.Foundation.WebApi
break;
}
this.PluginsManager.Raise(nameof(IWebApiPlugin.OnRequest), this, new WebApiEventArgs(request, default));
this.PluginsManager?.Raise(nameof(IWebApiPlugin.OnRequest), this, new WebApiEventArgs(request, default));
using (var tokenSource = new CancellationTokenSource(invokeOption.Timeout))
{
@@ -95,7 +95,7 @@ namespace ThingsGateway.Foundation.WebApi
}
var response = this.HttpClient.SendAsync(request, tokenSource.Token).GetAwaiter().GetResult();
this.PluginsManager.Raise(nameof(IWebApiPlugin.OnResponse), this, new WebApiEventArgs(request, response));
this.PluginsManager?.Raise(nameof(IWebApiPlugin.OnResponse), this, new WebApiEventArgs(request, response));
if (invokeOption.FeedbackType != FeedbackType.WaitInvoke)
{
@@ -155,7 +155,7 @@ namespace ThingsGateway.Foundation.WebApi
break;
}
this.PluginsManager.Raise(nameof(IWebApiPlugin.OnRequest), this, new WebApiEventArgs(request, default));
this.PluginsManager?.Raise(nameof(IWebApiPlugin.OnRequest), this, new WebApiEventArgs(request, default));
using (var tokenSource = new CancellationTokenSource(invokeOption.Timeout))
{
@@ -165,7 +165,7 @@ namespace ThingsGateway.Foundation.WebApi
}
var response = this.HttpClient.SendAsync(request, tokenSource.Token).GetAwaiter().GetResult();
this.PluginsManager.Raise(nameof(IWebApiPlugin.OnResponse), this, new WebApiEventArgs(request, response));
this.PluginsManager?.Raise(nameof(IWebApiPlugin.OnResponse), this, new WebApiEventArgs(request, response));
if (invokeOption.FeedbackType != FeedbackType.WaitInvoke)
{