|
@@ -138,19 +138,26 @@ namespace YSAI.Core.data
|
|
|
/// <returns>统一出参</returns>
|
|
/// <returns>统一出参</returns>
|
|
|
public static OperateResult Subscribe(string Topic, string ISn)
|
|
public static OperateResult Subscribe(string Topic, string ISn)
|
|
|
{
|
|
{
|
|
|
- //反射状态为true才进行操作
|
|
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
|
|
|
|
+ try
|
|
|
{
|
|
{
|
|
|
- //类的唯一标识符
|
|
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
|
|
- //方法的唯一标识符
|
|
|
|
|
- string MethodSN = "[Subscribe]";
|
|
|
|
|
- //执行转发方法
|
|
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { Topic, ISn }) as OperateResult;
|
|
|
|
|
|
|
+ //反射状态为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} 不做此操作", 0.1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
{
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 0.1);
|
|
|
|
|
|
|
+ return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 0.1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -161,19 +168,26 @@ namespace YSAI.Core.data
|
|
|
/// <returns>统一出参</returns>
|
|
/// <returns>统一出参</returns>
|
|
|
public static OperateResult UnSubscribe(string Topic, string ISn)
|
|
public static OperateResult UnSubscribe(string Topic, string ISn)
|
|
|
{
|
|
{
|
|
|
- //反射状态为true才进行操作
|
|
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
|
|
|
|
+ try
|
|
|
{
|
|
{
|
|
|
- //类的唯一标识符
|
|
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
|
|
- //方法的唯一标识符
|
|
|
|
|
- string MethodSN = "[UnSubscribe]";
|
|
|
|
|
- //执行转发方法
|
|
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { Topic, ISn }) as OperateResult;
|
|
|
|
|
|
|
+ //反射状态为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} 不做此操作", 0.1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
{
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 0.1);
|
|
|
|
|
|
|
+ return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 0.1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -184,21 +198,28 @@ namespace YSAI.Core.data
|
|
|
/// <param name="Content">内容</param>
|
|
/// <param name="Content">内容</param>
|
|
|
/// <param name="ISns">实例唯一标识符集合,空则全部发送</param>
|
|
/// <param name="ISns">实例唯一标识符集合,空则全部发送</param>
|
|
|
/// <returns>统一出参</returns>
|
|
/// <returns>统一出参</returns>
|
|
|
- public static OperateResult Produce(string Topic, string Content,List<string>? ISns = null)
|
|
|
|
|
|
|
+ public static OperateResult Produce(string Topic, string Content, List<string>? ISns = null)
|
|
|
{
|
|
{
|
|
|
- //反射状态为true才进行操作
|
|
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
|
|
|
|
+ try
|
|
|
{
|
|
{
|
|
|
- //类的唯一标识符
|
|
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
|
|
- //方法的唯一标识符
|
|
|
|
|
- string MethodSN = "[Produce]";
|
|
|
|
|
- //执行转发方法
|
|
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { Topic, Content, ISns }) as OperateResult;
|
|
|
|
|
|
|
+ //反射状态为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} 不做此操作", 0.1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
{
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 0.1);
|
|
|
|
|
|
|
+ return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 0.1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -207,40 +228,40 @@ namespace YSAI.Core.data
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
public static List<string>? TypeSns()
|
|
public static List<string>? TypeSns()
|
|
|
{
|
|
{
|
|
|
- //反射状态为true才进行操作
|
|
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
|
|
- {
|
|
|
|
|
- //类的唯一标识符
|
|
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
|
|
- //方法的唯一标识符
|
|
|
|
|
- string MethodSN = "[TypeSns]";
|
|
|
|
|
- //执行转发方法
|
|
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", null) as List<string>;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
|
|
+ if (reflectionOperate != null)
|
|
|
{
|
|
{
|
|
|
- return 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>
|
|
|
/// 实例唯一标识符集合
|
|
/// 实例唯一标识符集合
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
public static List<string>? InstanceSns()
|
|
public static List<string>? InstanceSns()
|
|
|
{
|
|
{
|
|
|
- //反射状态为true才进行操作
|
|
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
|
|
- {
|
|
|
|
|
- //类的唯一标识符
|
|
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
|
|
- //方法的唯一标识符
|
|
|
|
|
- string MethodSN = "[InstanceSns]";
|
|
|
|
|
- //执行转发方法
|
|
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", null) as List<string>;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
|
|
+ if (reflectionOperate != null)
|
|
|
{
|
|
{
|
|
|
- return 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>
|
|
|
/// 释放指定实例
|
|
/// 释放指定实例
|
|
@@ -249,19 +270,26 @@ namespace YSAI.Core.data
|
|
|
/// <returns>统一出参</returns>
|
|
/// <returns>统一出参</returns>
|
|
|
public static OperateResult DisposeISn(string ISn)
|
|
public static OperateResult DisposeISn(string ISn)
|
|
|
{
|
|
{
|
|
|
- //反射状态为true才进行操作
|
|
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
|
|
|
|
+ try
|
|
|
{
|
|
{
|
|
|
- //类的唯一标识符
|
|
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
|
|
- //方法的唯一标识符
|
|
|
|
|
- string MethodSN = "[DisposeISn]";
|
|
|
|
|
- //执行转发方法
|
|
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { ISn }) as OperateResult;
|
|
|
|
|
|
|
+ //反射状态为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} 不做此操作", 0.1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
{
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 0.1);
|
|
|
|
|
|
|
+ return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 0.1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -271,19 +299,26 @@ namespace YSAI.Core.data
|
|
|
/// <returns>统一出参</returns>
|
|
/// <returns>统一出参</returns>
|
|
|
public static OperateResult RemoveISn(string ISn)
|
|
public static OperateResult RemoveISn(string ISn)
|
|
|
{
|
|
{
|
|
|
- //反射状态为true才进行操作
|
|
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
|
|
|
|
+ try
|
|
|
{
|
|
{
|
|
|
- //类的唯一标识符
|
|
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
|
|
- //方法的唯一标识符
|
|
|
|
|
- string MethodSN = "[RemoveISn]";
|
|
|
|
|
- //执行转发方法
|
|
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { ISn }) as OperateResult;
|
|
|
|
|
|
|
+ //反射状态为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} 不做此操作", 0.1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
{
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 0.1);
|
|
|
|
|
|
|
+ return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 0.1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -293,19 +328,26 @@ namespace YSAI.Core.data
|
|
|
/// <returns>统一出参</returns>
|
|
/// <returns>统一出参</returns>
|
|
|
public static OperateResult On(string ISn)
|
|
public static OperateResult On(string ISn)
|
|
|
{
|
|
{
|
|
|
- //反射状态为true才进行操作
|
|
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
|
|
|
|
+ try
|
|
|
{
|
|
{
|
|
|
- //类的唯一标识符
|
|
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
|
|
- //方法的唯一标识符
|
|
|
|
|
- string MethodSN = "[On]";
|
|
|
|
|
- //执行转发方法
|
|
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { ISn }) as OperateResult;
|
|
|
|
|
|
|
+ //反射状态为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} 不做此操作", 0.1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
{
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 0.1);
|
|
|
|
|
|
|
+ return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 0.1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -315,19 +357,26 @@ namespace YSAI.Core.data
|
|
|
/// <returns>统一出参</returns>
|
|
/// <returns>统一出参</returns>
|
|
|
public static OperateResult Off(string ISn)
|
|
public static OperateResult Off(string ISn)
|
|
|
{
|
|
{
|
|
|
- //反射状态为true才进行操作
|
|
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
|
|
|
|
+ try
|
|
|
{
|
|
{
|
|
|
- //类的唯一标识符
|
|
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
|
|
- //方法的唯一标识符
|
|
|
|
|
- string MethodSN = "[Off]";
|
|
|
|
|
- //执行转发方法
|
|
|
|
|
- return reflectionOperate.ExecuteMethod($"{ClassSN}{MethodSN}", new object[] { ISn }) as OperateResult;
|
|
|
|
|
|
|
+ //反射状态为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} 不做此操作", 0.1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
{
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 0.1);
|
|
|
|
|
|
|
+ return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 0.1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -336,19 +385,26 @@ namespace YSAI.Core.data
|
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
|
public static OperateResult RelayEventRegister(Action<object, object> action, bool Register = true)
|
|
public static OperateResult RelayEventRegister(Action<object, object> action, bool Register = true)
|
|
|
{
|
|
{
|
|
|
- //反射状态为true才进行操作
|
|
|
|
|
- if (reflectionOperate.ReflectionState)
|
|
|
|
|
|
|
+ try
|
|
|
{
|
|
{
|
|
|
- //类的唯一标识符
|
|
|
|
|
- string ClassSN = "YSAI.RelayManage.RelayManageOperate[Instance]";
|
|
|
|
|
- //事件的唯一标识符
|
|
|
|
|
- string EventSN = "[OnEvent]";
|
|
|
|
|
- //注册事件
|
|
|
|
|
- return reflectionOperate.RegisterEvent($"{ClassSN}{EventSN}", Register, P2: action);
|
|
|
|
|
|
|
+ //反射状态为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} 不做此操作", 0.1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
{
|
|
|
- return new OperateResult(false, $"反射状态 {reflectionOperate.ReflectionState} 不做此操作", 0.1);
|
|
|
|
|
|
|
+ return new OperateResult(false, $"转发事件注册异常:{ex.Message}", 0.1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|