WatcherComponentSystem.cs 873 B

12345678910111213141516171819202122232425
  1. using System.Collections;
  2. using System.Diagnostics;
  3. namespace ET.Server
  4. {
  5. [EntitySystemOf(typeof(WatcherComponent))]
  6. public static partial class WatcherComponentSystem
  7. {
  8. [EntitySystem]
  9. public static void Awake(this WatcherComponent self)
  10. {
  11. string[] localIP = NetworkHelper.GetAddressIPs();
  12. var processConfigs = StartProcessConfigCategory.Instance.GetAll();
  13. foreach (StartProcessConfig startProcessConfig in processConfigs.Values)
  14. {
  15. if (!WatcherHelper.IsThisMachine(startProcessConfig.InnerIP, localIP))
  16. {
  17. continue;
  18. }
  19. System.Diagnostics.Process process = WatcherHelper.StartProcess(startProcessConfig.Id);
  20. self.Processes.Add(startProcessConfig.Id, process);
  21. }
  22. }
  23. }
  24. }