|
|
@@ -1,7 +1,4 @@
|
|
|
-using YSAI.Core.data;
|
|
|
-using YSAI.Core.reflection;
|
|
|
-
|
|
|
-namespace YSAI.Core.handler
|
|
|
+namespace YSAI.Core.handler
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 转发处理
|
|
|
@@ -11,291 +8,291 @@ namespace YSAI.Core.handler
|
|
|
/// <summary>
|
|
|
/// 反射操作
|
|
|
/// </summary>
|
|
|
- private static readonly RIOperate reflectionOperate = RIOperate.Instance();
|
|
|
+ //private static readonly RIOperate reflectionOperate = RIOperate.Instance();
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 订阅
|
|
|
- /// </summary>
|
|
|
- /// <param name="Topic">主题</param>
|
|
|
- /// <param name="ISn">实例唯一标识符</param>
|
|
|
- /// <returns>统一出参</returns>
|
|
|
- public static OperateResult Subscribe(string Topic, string ISn)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- //反射状态为true才进行操作
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
- {
|
|
|
- //类的唯一标识符
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
- //方法的唯一标识符
|
|
|
- string MethodSN = "[Subscribe]";
|
|
|
- //执行转发方法
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { Topic, ISn }) as OperateResult;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
- }
|
|
|
- }
|
|
|
+ ///// <summary>
|
|
|
+ ///// 订阅
|
|
|
+ ///// </summary>
|
|
|
+ ///// <param name="Topic">主题</param>
|
|
|
+ ///// <param name="ISn">实例唯一标识符</param>
|
|
|
+ ///// <returns>统一出参</returns>
|
|
|
+ //public static OperateResult Subscribe(string Topic, string ISn)
|
|
|
+ //{
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // //反射状态为true才进行操作
|
|
|
+ // if (reflectionOperate.ReflectionState)
|
|
|
+ // {
|
|
|
+ // //类的唯一标识符
|
|
|
+ // string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
+ // //方法的唯一标识符
|
|
|
+ // string MethodSN = "[Subscribe]";
|
|
|
+ // //执行转发方法
|
|
|
+ // return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { Topic, ISn }) as OperateResult;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // catch (Exception ex)
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 取消订阅
|
|
|
- /// </summary>
|
|
|
- /// <param name="Topic">主题</param>
|
|
|
- /// <param name="ISn">实例唯一标识符</param>
|
|
|
- /// <returns>统一出参</returns>
|
|
|
- public static OperateResult UnSubscribe(string Topic, string ISn)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- //反射状态为true才进行操作
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
- {
|
|
|
- //类的唯一标识符
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
- //方法的唯一标识符
|
|
|
- string MethodSN = "[UnSubscribe]";
|
|
|
- //执行转发方法
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { Topic, ISn }) as OperateResult;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
- }
|
|
|
- }
|
|
|
+ ///// <summary>
|
|
|
+ ///// 取消订阅
|
|
|
+ ///// </summary>
|
|
|
+ ///// <param name="Topic">主题</param>
|
|
|
+ ///// <param name="ISn">实例唯一标识符</param>
|
|
|
+ ///// <returns>统一出参</returns>
|
|
|
+ //public static OperateResult UnSubscribe(string Topic, string ISn)
|
|
|
+ //{
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // //反射状态为true才进行操作
|
|
|
+ // if (reflectionOperate.ReflectionState)
|
|
|
+ // {
|
|
|
+ // //类的唯一标识符
|
|
|
+ // string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
+ // //方法的唯一标识符
|
|
|
+ // string MethodSN = "[UnSubscribe]";
|
|
|
+ // //执行转发方法
|
|
|
+ // return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { Topic, ISn }) as OperateResult;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // catch (Exception ex)
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 生产
|
|
|
- /// </summary>
|
|
|
- /// <param name="Topic">主题</param>
|
|
|
- /// <param name="Content">内容</param>
|
|
|
- /// <param name="ISns">实例唯一标识符集合,空则全部发送</param>
|
|
|
- /// <returns>统一出参</returns>
|
|
|
- public static OperateResult Produce(string Topic, string Content, List<string>? ISns = null)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- //反射状态为true才进行操作
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
- {
|
|
|
- //类的唯一标识符
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
- //方法的唯一标识符
|
|
|
- string MethodSN = "[Produce]";
|
|
|
- //执行转发方法
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { Topic, Content, ISns }) as OperateResult;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
- }
|
|
|
- }
|
|
|
+ ///// <summary>
|
|
|
+ ///// 生产
|
|
|
+ ///// </summary>
|
|
|
+ ///// <param name="Topic">主题</param>
|
|
|
+ ///// <param name="Content">内容</param>
|
|
|
+ ///// <param name="ISns">实例唯一标识符集合,空则全部发送</param>
|
|
|
+ ///// <returns>统一出参</returns>
|
|
|
+ //public static OperateResult Produce(string Topic, string Content, List<string>? ISns = null)
|
|
|
+ //{
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // //反射状态为true才进行操作
|
|
|
+ // if (reflectionOperate.ReflectionState)
|
|
|
+ // {
|
|
|
+ // //类的唯一标识符
|
|
|
+ // string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
+ // //方法的唯一标识符
|
|
|
+ // string MethodSN = "[Produce]";
|
|
|
+ // //执行转发方法
|
|
|
+ // return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { Topic, Content, ISns }) as OperateResult;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // catch (Exception ex)
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 程序集唯一标识符集合
|
|
|
- /// </summary>
|
|
|
- public static List<string>? TypeSns()
|
|
|
- {
|
|
|
- if (reflectionOperate != null)
|
|
|
- {
|
|
|
- //反射状态为true才进行操作
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
- {
|
|
|
- //类的唯一标识符
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
- //方法的唯一标识符
|
|
|
- string MethodSN = "[TypeSns]";
|
|
|
- //执行转发方法
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", null) as List<string>;
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
+ ///// <summary>
|
|
|
+ ///// 程序集唯一标识符集合
|
|
|
+ ///// </summary>
|
|
|
+ //public static List<string>? TypeSns()
|
|
|
+ //{
|
|
|
+ // if (reflectionOperate != null)
|
|
|
+ // {
|
|
|
+ // //反射状态为true才进行操作
|
|
|
+ // if (reflectionOperate.ReflectionState)
|
|
|
+ // {
|
|
|
+ // //类的唯一标识符
|
|
|
+ // string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
+ // //方法的唯一标识符
|
|
|
+ // string MethodSN = "[TypeSns]";
|
|
|
+ // //执行转发方法
|
|
|
+ // return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", null) as List<string>;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // return null;
|
|
|
+ //}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 实例唯一标识符集合
|
|
|
- /// </summary>
|
|
|
- public static List<string>? InstanceSns()
|
|
|
- {
|
|
|
- if (reflectionOperate != null)
|
|
|
- {
|
|
|
- //反射状态为true才进行操作
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
- {
|
|
|
- //类的唯一标识符
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
- //方法的唯一标识符
|
|
|
- string MethodSN = "[InstanceSns]";
|
|
|
- //执行转发方法
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", null) as List<string>;
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
+ ///// <summary>
|
|
|
+ ///// 实例唯一标识符集合
|
|
|
+ ///// </summary>
|
|
|
+ //public static List<string>? InstanceSns()
|
|
|
+ //{
|
|
|
+ // if (reflectionOperate != null)
|
|
|
+ // {
|
|
|
+ // //反射状态为true才进行操作
|
|
|
+ // if (reflectionOperate.ReflectionState)
|
|
|
+ // {
|
|
|
+ // //类的唯一标识符
|
|
|
+ // string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
+ // //方法的唯一标识符
|
|
|
+ // string MethodSN = "[InstanceSns]";
|
|
|
+ // //执行转发方法
|
|
|
+ // return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", null) as List<string>;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // return null;
|
|
|
+ //}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 释放指定实例
|
|
|
- /// </summary>
|
|
|
- /// <param name="ISn">实例唯一标识符</param>
|
|
|
- /// <returns>统一出参</returns>
|
|
|
- public static OperateResult DisposeISn(string ISn)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- //反射状态为true才进行操作
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
- {
|
|
|
- //类的唯一标识符
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
- //方法的唯一标识符
|
|
|
- string MethodSN = "[DisposeISn]";
|
|
|
- //执行转发方法
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { ISn }) as OperateResult;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
- }
|
|
|
- }
|
|
|
+ ///// <summary>
|
|
|
+ ///// 释放指定实例
|
|
|
+ ///// </summary>
|
|
|
+ ///// <param name="ISn">实例唯一标识符</param>
|
|
|
+ ///// <returns>统一出参</returns>
|
|
|
+ //public static OperateResult DisposeISn(string ISn)
|
|
|
+ //{
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // //反射状态为true才进行操作
|
|
|
+ // if (reflectionOperate.ReflectionState)
|
|
|
+ // {
|
|
|
+ // //类的唯一标识符
|
|
|
+ // string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
+ // //方法的唯一标识符
|
|
|
+ // string MethodSN = "[DisposeISn]";
|
|
|
+ // //执行转发方法
|
|
|
+ // return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { ISn }) as OperateResult;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // catch (Exception ex)
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 移除指定实例
|
|
|
- /// </summary>
|
|
|
- /// <param name="ISn">实例唯一标识符</param>
|
|
|
- /// <returns>统一出参</returns>
|
|
|
- public static OperateResult RemoveISn(string ISn)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- //反射状态为true才进行操作
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
- {
|
|
|
- //类的唯一标识符
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
- //方法的唯一标识符
|
|
|
- string MethodSN = "[RemoveISn]";
|
|
|
- //执行转发方法
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { ISn }) as OperateResult;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
- }
|
|
|
- }
|
|
|
+ ///// <summary>
|
|
|
+ ///// 移除指定实例
|
|
|
+ ///// </summary>
|
|
|
+ ///// <param name="ISn">实例唯一标识符</param>
|
|
|
+ ///// <returns>统一出参</returns>
|
|
|
+ //public static OperateResult RemoveISn(string ISn)
|
|
|
+ //{
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // //反射状态为true才进行操作
|
|
|
+ // if (reflectionOperate.ReflectionState)
|
|
|
+ // {
|
|
|
+ // //类的唯一标识符
|
|
|
+ // string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
+ // //方法的唯一标识符
|
|
|
+ // string MethodSN = "[RemoveISn]";
|
|
|
+ // //执行转发方法
|
|
|
+ // return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { ISn }) as OperateResult;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // catch (Exception ex)
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 打开
|
|
|
- /// </summary>
|
|
|
- /// <param name="ISn">实例唯一标识符</param>
|
|
|
- /// <returns>统一出参</returns>
|
|
|
- public static OperateResult On(string ISn)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- //反射状态为true才进行操作
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
- {
|
|
|
- //类的唯一标识符
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
- //方法的唯一标识符
|
|
|
- string MethodSN = "[On]";
|
|
|
- //执行转发方法
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { ISn }) as OperateResult;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
- }
|
|
|
- }
|
|
|
+ ///// <summary>
|
|
|
+ ///// 打开
|
|
|
+ ///// </summary>
|
|
|
+ ///// <param name="ISn">实例唯一标识符</param>
|
|
|
+ ///// <returns>统一出参</returns>
|
|
|
+ //public static OperateResult On(string ISn)
|
|
|
+ //{
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // //反射状态为true才进行操作
|
|
|
+ // if (reflectionOperate.ReflectionState)
|
|
|
+ // {
|
|
|
+ // //类的唯一标识符
|
|
|
+ // string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
+ // //方法的唯一标识符
|
|
|
+ // string MethodSN = "[On]";
|
|
|
+ // //执行转发方法
|
|
|
+ // return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { ISn }) as OperateResult;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // catch (Exception ex)
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 关闭
|
|
|
- /// </summary>
|
|
|
- /// <param name="ISn">实例唯一标识符</param>
|
|
|
- /// <returns>统一出参</returns>
|
|
|
- public static OperateResult Off(string ISn)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- //反射状态为true才进行操作
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
- {
|
|
|
- //类的唯一标识符
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
- //方法的唯一标识符
|
|
|
- string MethodSN = "[Off]";
|
|
|
- //执行转发方法
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { ISn }) as OperateResult;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
- }
|
|
|
- }
|
|
|
+ ///// <summary>
|
|
|
+ ///// 关闭
|
|
|
+ ///// </summary>
|
|
|
+ ///// <param name="ISn">实例唯一标识符</param>
|
|
|
+ ///// <returns>统一出参</returns>
|
|
|
+ //public static OperateResult Off(string ISn)
|
|
|
+ //{
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // //反射状态为true才进行操作
|
|
|
+ // if (reflectionOperate.ReflectionState)
|
|
|
+ // {
|
|
|
+ // //类的唯一标识符
|
|
|
+ // string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
+ // //方法的唯一标识符
|
|
|
+ // string MethodSN = "[Off]";
|
|
|
+ // //执行转发方法
|
|
|
+ // return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { ISn }) as OperateResult;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // catch (Exception ex)
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 转发事件注册
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public static OperateResult RelayEventRegister(Action<object, object> action, bool Register = true)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- //反射状态为true才进行操作
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
- {
|
|
|
- //类的唯一标识符
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
- //事件的唯一标识符
|
|
|
- string EventSN = "[OnEvent]";
|
|
|
- //注册事件
|
|
|
- return reflectionOperate.RegisterEvent($"{ClassSN}{EventSN}", Register, P2: action);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
- }
|
|
|
- }
|
|
|
+ ///// <summary>
|
|
|
+ ///// 转发事件注册
|
|
|
+ ///// </summary>
|
|
|
+ ///// <returns></returns>
|
|
|
+ //public static OperateResult RelayEventRegister(Action<object, object> action, bool Register = true)
|
|
|
+ //{
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // //反射状态为true才进行操作
|
|
|
+ // if (reflectionOperate.ReflectionState)
|
|
|
+ // {
|
|
|
+ // //类的唯一标识符
|
|
|
+ // string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
+ // //事件的唯一标识符
|
|
|
+ // string EventSN = "[OnEvent]";
|
|
|
+ // //注册事件
|
|
|
+ // return reflectionOperate.RegisterEvent($"{ClassSN}{EventSN}", Register, P2: action);
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 1);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // catch (Exception ex)
|
|
|
+ // {
|
|
|
+ // return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 1);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
}
|
|
|
}
|