Beispiel #1
0
        internal T GetGroupHandler <T>(TechType upgradeId, params TechType[] additionalIds) where T : UpgradeHandler, IGroupHandler
        {
            if (!initialized)
            {
                InitializeUpgradeHandlers();
            }

            if (!KnownsUpgradeModules.TryGetValue(upgradeId, out UpgradeHandler upgradeHandler))
            {
                return(null);
            }

            if (upgradeHandler is IGroupedUpgradeHandler groupMember)
            {
                if (additionalIds.Length > 0)
                {
                    IGroupHandler groupHandler = groupMember.GroupHandler;
                    for (int i = 0; i < additionalIds.Length; i++)
                    {
                        if (!groupHandler.IsManaging(additionalIds[i]))
                        {
                            return(null);
                        }
                    }
                    return((T)groupHandler);
                }
                else
                {
                    return((T)groupMember.GroupHandler);
                }
            }

            return((T)upgradeHandler);
        }
Beispiel #2
0
        // -----------------------------------------------------------------------------
        public ADXEventHandler(IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;

            _logger = _serviceProvider.GetService <ILogger <ADXEventHandler> >();
            _config = _serviceProvider.GetService <ISTSOSYNCV2Config>();

            _eventHandlerOU    = _serviceProvider.GetService <IOUHandler>();
            _eventHandlerGroup = _serviceProvider.GetService <IGroupHandler>();
            _eventHandlerUser  = _serviceProvider.GetService <IUserHandler>();
        }