|
|
@@ -1,4 +1,4 @@
|
|
|
-using NTMiner.Router;
|
|
|
+using NTMiner.Hub;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Diagnostics;
|
|
|
@@ -8,11 +8,11 @@ using System.Timers;
|
|
|
namespace NTMiner {
|
|
|
public static partial class VirtualRoot {
|
|
|
public static void RaiseEvent<TEvent>(TEvent evnt) where TEvent : class, IEvent {
|
|
|
- MessageDispatcher.Route(evnt);
|
|
|
+ MessageHub.Route(evnt);
|
|
|
}
|
|
|
|
|
|
public static void Execute<TCmd>(TCmd command) where TCmd : class, ICmd {
|
|
|
- MessageDispatcher.Route(command);
|
|
|
+ MessageHub.Route(command);
|
|
|
}
|
|
|
|
|
|
// 修建消息(命令或事件)的运动路径
|
|
|
@@ -20,21 +20,21 @@ namespace NTMiner {
|
|
|
StackTrace ss = new StackTrace(false);
|
|
|
// 0是CreatePath,1是CreateCmdPath或CreateEventPath,2是当地
|
|
|
Type location = ss.GetFrame(2).GetMethod().DeclaringType;
|
|
|
- return MessagePath<TMessage>.Build(MessageDispatcher, location, description, logType, action, Guid.Empty);
|
|
|
+ return MessagePath<TMessage>.Build(MessageHub, location, description, logType, action, Guid.Empty);
|
|
|
}
|
|
|
|
|
|
public static IMessagePathId BuildOnecePath<TMessage>(string description, LogEnum logType, Action<TMessage> action, Guid pathId) {
|
|
|
StackTrace ss = new StackTrace(false);
|
|
|
// 0是CreatePath,1是CreateCmdPath或CreateEventPath,2是当地
|
|
|
Type location = ss.GetFrame(2).GetMethod().DeclaringType;
|
|
|
- return MessagePath<TMessage>.Build(MessageDispatcher, location, description, logType, action, pathId, viaLimit: 1);
|
|
|
+ return MessagePath<TMessage>.Build(MessageHub, location, description, logType, action, pathId, viaLimit: 1);
|
|
|
}
|
|
|
|
|
|
public static IMessagePathId BuildViaLimitPath<TMessage>(string description, LogEnum logType, Action<TMessage> action, int viaLimit) {
|
|
|
StackTrace ss = new StackTrace(false);
|
|
|
// 0是CreatePath,1是CreateCmdPath或CreateEventPath,2是当地
|
|
|
Type location = ss.GetFrame(2).GetMethod().DeclaringType;
|
|
|
- return MessagePath<TMessage>.Build(MessageDispatcher, location, description, logType, action, Guid.Empty, viaLimit);
|
|
|
+ return MessagePath<TMessage>.Build(MessageHub, location, description, logType, action, Guid.Empty, viaLimit);
|
|
|
}
|
|
|
|
|
|
public static void BuildCmdPath<TCmd>(Action<TCmd> action, LogEnum logType = LogEnum.DevConsole)
|
|
|
@@ -53,7 +53,7 @@ namespace NTMiner {
|
|
|
if (handler == null) {
|
|
|
return;
|
|
|
}
|
|
|
- MessageDispatcher.Remove(handler);
|
|
|
+ MessageHub.Remove(handler);
|
|
|
}
|
|
|
|
|
|
private static readonly Dictionary<string, Regex> _regexDic = new Dictionary<string, Regex>();
|