/// <summary> /// initObj是一个AllAndAutoArmAIThings /// </summary> /// <param name="path"></param> public override void TryInit(object path) { config = new AIManagementConfig((string)path); //判断autoArmAIThings是否是allAIThings的子集 if (!config.AIThings.AutoArmAIThingPaths.All(autoArm => config.AIThings.AllAIThingPaths.Any(every => every == autoArm))) { throw new Exception("需要自动arm的所有AIThing必须包含在所有AIThing中"); } logger = Cfet2LogManager.GetLogger("AIManagement"); }
public override void TryInit(object initObj) { base.TryInit(initObj); //get a logger logger = Cfet2LogManager.GetLogger("Event"); if (initObj != null) { config = (ListenerConfig)initObj.TryConvertTo(typeof(ListenerConfig)); } token = MyHub.EventHub.Subscribe(new EventFilter(config.Source, config.EventType), handler); }
public override void TryInit(object configFilePath) { myConfig = new UploadConfig((string[])configFilePath); if (myConfig != null) { State = Status.Idle; } else { throw new Exception("上传配置文件错误!"); } logger = Cfet2LogManager.GetLogger("UploadLog"); }
public override void TryInit(object initObj) { var dataAndConfigPath = (DataAndConfigPath)initObj.TryConvertTo(typeof(DataAndConfigPath)); DataFileParentDirectory = dataAndConfigPath.DataFileParentDirectory; //get a logger logger = Cfet2LogManager.GetLogger("Event-" + DataFileParentDirectory); basicAI.InitAI(dataAndConfigPath.ConfigFilePath); //订阅AI的event subscribeEvent(); }
public override void TryInit(object configFilePath) { myConfig = new MdsUploadConfig((string[])configFilePath); if (myConfig != null) { State = Status.Idle; } else { State = Status.Error; } logger = Cfet2LogManager.GetLogger("MdsUploadLog"); // 当为 Master 时,订阅上传触发事件 if (myConfig.MasterOrSlave == 1) { for (int i = 0; i < myConfig.EventPaths.Count(); i++) { token = MyHub.EventHub.Subscribe(new EventFilter(myConfig.EventPaths[i], myConfig.EventKinds[i]), handler); } } }