ARobotCase.cs 795 B

123456789101112131415161718192021222324
  1. namespace ET.Server
  2. {
  3. // 这里为什么能定义class呢?因为这里只有逻辑,热重载后新的handler替换旧的,仍然没有问题
  4. [EnableClass]
  5. public abstract class ARobotCase: AInvokeHandler<RobotInvokeArgs, ETTask>
  6. {
  7. protected abstract ETTask Run(RobotCase robotCase);
  8. public override async ETTask Handle(RobotInvokeArgs a)
  9. {
  10. using RobotCase robotCase = await RobotCaseComponent.Instance.New();
  11. try
  12. {
  13. await this.Run(robotCase);
  14. }
  15. catch (System.Exception e)
  16. {
  17. Log.Error($"{robotCase.DomainZone()} {e}");
  18. RobotLog.Console($"RobotCase Error {this.GetType().Name}:\n\t{e}");
  19. }
  20. }
  21. }
  22. }