public ResetRankCommand(CommandConfiguration config, ITranslationLookup lookup, IMetaService metaService, IConfigurationHandlerFactory configurationHandlerFactory) : base(config, lookup)
        {
            _metaService          = metaService;
            _configurationHandler = configurationHandlerFactory.GetConfigurationHandler <Configuration>("ClanTagRankCommands");
            if (_configurationHandler.Configuration() == null)
            {
                _configurationHandler.Set((Configuration) new Configuration().Generate());
                _configurationHandler.Save();
            }
            Config = _configurationHandler.Configuration();

            Name           = "ResetRank";
            Description    = "set a user's clan tag Rank (does not give permissions)";
            Alias          = "rr";
            Permission     = EFClient.Permission.Administrator;
            RequiresTarget = true;
            Arguments      = new[]
            {
                new CommandArgument()
                {
                    //Name = "rank",
                    //Required = false
                }
            };
        }
Exemple #2
0
        public Controller(SocketConnection socketConnection,
                          IProtocolVersion protocolVersion,
                          int heartbeatInterval,
                          IControlMessageHandler messageHandler,
                          IConfigurationHandler configurationHandler,
                          IHeartbeatInformer heartbeatInformer,
                          IErrorHandler errorHandler,
                          ILog logger)
        {
            if (messageHandler == null)
            {
                throw new ArgumentNullException(nameof(messageHandler));
            }
            if (heartbeatInterval <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(heartbeatInterval));
            }

            _socketConnection  = socketConnection ?? throw new ArgumentNullException(nameof(socketConnection));
            _protocolVersion   = protocolVersion ?? throw new ArgumentNullException(nameof(protocolVersion));
            _heartbeatInterval = heartbeatInterval;
            _errorHandler      = errorHandler ?? throw new ArgumentNullException(nameof(errorHandler));
            _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
            _heartbeatInformer = heartbeatInformer ?? throw new ArgumentNullException(nameof(heartbeatInformer));
            _messageProcessor  = _protocolVersion.GetControlMessageProcessor(messageHandler, configurationHandler);

            _inputReader  = _socketConnection.InputReader;
            _outputWriter = _socketConnection.OutputWriter;

            _task = Task.Run(() => RunController());
        }
Exemple #3
0
 public ClientStatisticsController(IManager manager,
                                   IResourceQueryHelper <StatsInfoRequest, AdvancedStatsInfo> queryHelper,
                                   IConfigurationHandler <DefaultSettings> configurationHandler) : base(manager)
 {
     _queryHelper   = queryHelper;
     _defaultConfig = configurationHandler.Configuration();
 }
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        public void Initialize()
        {
            if (_extensionLoader == null)
            {
                _extensionLoader = _dependencyUtility.Resolve <IExtensionLoader>();
            }

            if (_logger == null)
            {
                _logger = _dependencyUtility.Resolve <ILogger>();
            }

            if (_config == null)
            {
                _config = _dependencyUtility.Resolve <IConfigurationHandler>();
            }

            if (_connectionManager == null)
            {
                _connectionManager = _dependencyUtility.Resolve <IWebSocketConnectionManager>();
            }

            CreateConnectionResources();
            CreateRequestResources();
            CreateResponseResources();

            _isInitialized = true;
        }
Exemple #5
0
 public Plugin(ILogger <Plugin> logger, IConfigurationHandlerFactory configurationHandlerFactory, ApplicationConfiguration appConfig)
 {
     _configurationHandler = configurationHandlerFactory.GetConfigurationHandler <LiveRadarConfiguration>("LiveRadarConfiguration");
     _botGuidLookups       = new Dictionary <string, long>();
     _logger    = logger;
     _appConfig = appConfig;
 }
Exemple #6
0
 public Plugin(IConfigurationHandlerFactory configurationHandlerFactory, IDatabaseContextFactory databaseContextFactory,
               ITranslationLookup translationLookup, IMetaService metaService, IResourceQueryHelper <ChatSearchQuery, MessageResponse> chatQueryHelper)
 {
     Config = configurationHandlerFactory.GetConfigurationHandler <StatsConfiguration>("StatsPluginSettings");
     _databaseContextFactory = databaseContextFactory;
     _translationLookup      = translationLookup;
     _metaService            = metaService;
     _chatQueryHelper        = chatQueryHelper;
 }
        /// <summary>
        /// Handles the configuration.
        /// </summary>
        private static void HandleConfiguration()
        {
            _config = new ConfigurationHandler(_dependencyUtility, "configuration.json");

            _dependencyUtility.Register <JsonSerializerSettings>(new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.All
            });
            _dependencyUtility.Register <IConfigurationHandler>(_config);
        }
Exemple #8
0
 public ControlMessageProcessor(IConfigurationReader configurationReader,
                                IControlMessageHandler messageHandler,
                                IConfigurationHandler configurationHandler,
                                IErrorHandler errorHandler)
 {
     _configurationReader  = configurationReader ?? throw new ArgumentNullException(nameof(configurationReader));
     _messageHandler       = messageHandler ?? throw new ArgumentNullException(nameof(messageHandler));
     _configurationHandler = configurationHandler ?? throw new ArgumentNullException(nameof(configurationHandler));
     _errorHandler         = errorHandler ?? throw new ArgumentNullException(nameof(errorHandler));
 }
Exemple #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Extension"/> class.
        /// </summary>
        /// <param name="extensionName">Name of the extension.</param>
        /// <param name="dependencyUtility">The dependency utility.</param>
        protected Extension(string extensionName, IDependencyUtility dependencyUtility)
        {
            Name = extensionName;

            DependencyUtility = dependencyUtility;

            Logger  = DependencyUtility.Resolve <ILogger>();
            Config  = DependencyUtility.Resolve <IConfigurationHandler>();
            _router = DependencyUtility.Resolve <ISignalRouter>();
        }
Exemple #10
0
 public ServerDistributionCalculator(IDatabaseContextFactory contextFactory,
                                     IDataValueCache <EFClientStatistics, Dictionary <long, Extensions.LogParams> > distributionCache,
                                     IDataValueCache <EFClientStatistics, double> maxZScoreCache,
                                     IConfigurationHandlerFactory configFactory)
 {
     _contextFactory       = contextFactory;
     _distributionCache    = distributionCache;
     _maxZScoreCache       = maxZScoreCache;
     _configurationHandler = configFactory.GetConfigurationHandler <StatsConfiguration>("StatsPluginSettings");
 }
Exemple #11
0
 public GscApiController(IManager manager, IMetaService metaService, IConfigurationHandlerFactory configurationHandlerFactory) : base(manager)
 {
     _metaService          = metaService;
     _configurationHandler = configurationHandlerFactory.GetConfigurationHandler <Configuration>("ClanTagRankCommands");
     if (_configurationHandler.Configuration() == null)
     {
         _configurationHandler.Set((Configuration) new Configuration().Generate());
         _configurationHandler.Save();
     }
     Config = _configurationHandler.Configuration();
 }
Exemple #12
0
 public StatsController(ILogger <StatsController> logger, IManager manager, IResourceQueryHelper <ChatSearchQuery,
                                                                                                  MessageResponse> resourceQueryHelper, ITranslationLookup translationLookup,
                        IDatabaseContextFactory contextFactory,
                        IConfigurationHandler <StatsConfiguration> configurationHandler) : base(manager)
 {
     _logger  = logger;
     _manager = manager;
     _chatResourceQueryHelper = resourceQueryHelper;
     _translationLookup       = translationLookup;
     _contextFactory          = contextFactory;
     _configurationHandler    = configurationHandler;
 }
Exemple #13
0
        static void Main(string[] args)
        {
            // bootstrap components
            _configurationHandler    = new CommandLineArgumentConfigurationHandler();
            _networkInterfaceManager = new NetworkInterfaceManager(_configurationHandler);
            _outputManager           = new ConsoleOutputManager();

            // start the engines
            _configurationHandler.LoadConfig(args);
            var data = _networkInterfaceManager.GatherNetworkData();

            _outputManager.WriteOutput(Console.Out, data);
        }
Exemple #14
0
 public Plugin(ILogger <Plugin> logger, IConfigurationHandlerFactory configurationHandlerFactory, IDatabaseContextFactory databaseContextFactory,
               ITranslationLookup translationLookup, IMetaService metaService, IResourceQueryHelper <ChatSearchQuery, MessageResponse> chatQueryHelper, ILogger <StatManager> managerLogger,
               IEnumerable <IClientStatisticCalculator> statCalculators, IServerDistributionCalculator serverDistributionCalculator)
 {
     Config = configurationHandlerFactory.GetConfigurationHandler <StatsConfiguration>("StatsPluginSettings");
     _databaseContextFactory = databaseContextFactory;
     _translationLookup      = translationLookup;
     _metaService            = metaService;
     _chatQueryHelper        = chatQueryHelper;
     _managerLogger          = managerLogger;
     _logger          = logger;
     _statCalculators = statCalculators.ToList();
     _serverDistributionCalculator = serverDistributionCalculator;
 }
Exemple #15
0
        public LexiconConfiguration(ILogger <LexiconConfiguration> log, IConfigurationHandler configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            this.log = log ?? throw new ArgumentNullException(nameof(log));

            ResourcePath = configuration.ResolvePath("Resources");
            LexiconPath  = Path.Combine(ResourcePath, configuration.SafeGetConfiguration("Lexicon", @"Library/Standard"));
            if (!Directory.Exists(LexiconPath))
            {
                log.LogError("Path doesn't exist: {0}", LexiconPath);
                throw new InvalidOperationException("Lexicon can't be constructed");
            }
        }
Exemple #16
0
 public ApplicationManager(ILogger <ApplicationManager> logger, IMiddlewareActionHandler actionHandler, IEnumerable <IManagerCommand> commands,
                           ITranslationLookup translationLookup, IConfigurationHandler <CommandConfiguration> commandConfiguration,
                           IConfigurationHandler <ApplicationConfiguration> appConfigHandler, IGameServerInstanceFactory serverInstanceFactory,
                           IEnumerable <IPlugin> plugins, IParserRegexFactory parserRegexFactory, IEnumerable <IRegisterEvent> customParserEvents,
                           IEventHandler eventHandler, IScriptCommandFactory scriptCommandFactory, IDatabaseContextFactory contextFactory, IMetaService metaService,
                           IMetaRegistration metaRegistration, IScriptPluginServiceResolver scriptPluginServiceResolver, ClientService clientService, IServiceProvider serviceProvider,
                           ChangeHistoryService changeHistoryService, ApplicationConfiguration appConfig, PenaltyService penaltyService)
 {
     MiddlewareActionHandler = actionHandler;
     _servers               = new ConcurrentBag <Server>();
     MessageTokens          = new List <MessageToken>();
     ClientSvc              = clientService;
     PenaltySvc             = penaltyService;
     ConfigHandler          = appConfigHandler;
     StartTime              = DateTime.UtcNow;
     PageList               = new PageList();
     AdditionalEventParsers = new List <IEventParser>()
     {
         new BaseEventParser(parserRegexFactory, logger, _appConfig)
     };
     AdditionalRConParsers = new List <IRConParser>()
     {
         new BaseRConParser(serviceProvider.GetRequiredService <ILogger <BaseRConParser> >(), parserRegexFactory)
     };
     TokenAuthenticator           = new TokenAuthentication();
     _logger                      = logger;
     _metaService                 = metaService;
     _tokenSource                 = new CancellationTokenSource();
     _commands                    = commands.ToList();
     _translationLookup           = translationLookup;
     _commandConfiguration        = commandConfiguration;
     _serverInstanceFactory       = serverInstanceFactory;
     _parserRegexFactory          = parserRegexFactory;
     _customParserEvents          = customParserEvents;
     _eventHandler                = eventHandler;
     _scriptCommandFactory        = scriptCommandFactory;
     _metaRegistration            = metaRegistration;
     _scriptPluginServiceResolver = scriptPluginServiceResolver;
     _serviceProvider             = serviceProvider;
     _changeHistoryService        = changeHistoryService;
     _appConfig                   = appConfig;
     Plugins                      = plugins;
 }
Exemple #17
0
        public void ExtensionLoaderThrowsExceptionWhenFileDoesNotExist()
        {
            string json = "{\"host\":\"0.0.0.0\",\"port\":1337,\"extensions\":{\"extension1\":{\"path\":\"\",\"config\":{\"key\":\"value\"}}}}";
            IConfigurationHandler config = GetConfigurationHandler(json, out string path);

            IDependencyUtility dependencyUtility = new DependencyUtility();

            dependencyUtility.Register <ILogger>(new Mock <ILogger>().Object);
            dependencyUtility.Register <IConfigurationHandler>(config);

            IExtensionLoader loader = new ExtensionLoader(dependencyUtility);

            try
            {
                Assert.Throws(typeof(ConfigurationItemMissingException), () => loader.LoadExtensions());
            }
            finally
            {
                File.Delete(path);
            }
        }
Exemple #18
0
 public Plugin(IConfigurationHandlerFactory configurationHandlerFactory)
 {
     _configHandler = configurationHandlerFactory.GetConfigurationHandler <WelcomeConfiguration>("WelcomePluginSettings");
 }
Exemple #19
0
 public Startup(IConfigurationHandler configHandler)
 {
     _configHandler = configHandler;
 }
Exemple #20
0
 public Plugin(IConfigurationHandlerFactory configurationHandlerFactory, IDatabaseContextFactory contextFactory)
 {
     _configHandler =
         configurationHandlerFactory.GetConfigurationHandler <WelcomeConfiguration>("WelcomePluginSettings");
     _contextFactory = contextFactory;
 }
Exemple #21
0
 public Plugin(IConfigurationHandlerFactory configurationHandlerFactory)
 {
     _configHandler = configurationHandlerFactory.GetConfigurationHandler <Configuration>("ProfanityDetermentSettings");
 }
 public NetworkInterfaceManager(IConfigurationHandler configurationHandler)
 {
     _configurationHandler = configurationHandler;
 }
Exemple #23
0
 public Plugin(IConfigurationHandlerFactory configurationHandlerFactory)
 {
     _configurationHandler = configurationHandlerFactory.GetConfigurationHandler <Configuration>("AutomessageFeedPluginSettings");
 }
Exemple #24
0
 /// <summary>
 /// The set agent infra. FOR TESTING PURPOSE!
 /// </summary>
 /// <param name="agent">
 /// The agent.
 /// </param>
 /// <param name="mockLoggerHelper">
 /// The mock logger helper.
 /// </param>
 /// <param name="mockConfHandler">
 /// The mock configuration handler.
 /// </param>
 public void SetAgentInfra(ILoggerHelper mockLoggerHelper, IConfigurationHandler mockConfHandler)
 {
     mLoggerHelper         = mockLoggerHelper;
     mLogger               = mLoggerHelper.InitLogging("SentinelSNMPLogger", "SentinelCoreSNMPAgent.dll.config");
     mConfigurationHandler = mockConfHandler;
 }
Exemple #25
0
 /// <summary>
 /// Getting reference to Generic SNMP Agent instance
 /// </summary>
 /// <param name="agent">
 /// ref instance of Generic SNMP Agent
 /// </param>
 public void SetAgentInfra()
 {
     mLoggerHelper         = new LoggerHelper();
     mLogger               = mLoggerHelper.InitLogging("SentinelSNMPLogger", "SentinelCoreSNMPAgent.dll.config");
     mConfigurationHandler = new ConfigurationHandler();
 }
Exemple #26
0
 public Plugin(IConfigurationHandlerFactory configurationHandlerFactory)
 {
     _configurationHandler = configurationHandlerFactory.GetConfigurationHandler <LiveRadarConfiguration>("LiveRadarConfiguration");
     _botGuidLookups       = new Dictionary <string, long>();
 }
Exemple #27
0
 public Plugin(IMetaService metaService, IConfigurationHandlerFactory configurationHandlerFactory, ILogger <Plugin> logger)
 {
     _logger               = logger;
     _metaService          = metaService;
     _configurationHandler = (IConfigurationHandler <Configuration>)configurationHandlerFactory.GetConfigurationHandler <Configuration>("ClanTagRankCommands");
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PrevalueEditorControlFactory"/> class.
 /// </summary>
 public PrevalueEditorControlFactory()
 {
     this.configurationHandler = new ConfigurationHandler();
 }
 public WeaponNameParser(ILogger <WeaponNameParser> logger, IConfigurationHandler <StatsConfiguration> config)
 {
     _logger = logger;
     _config = config.Configuration();
 }
Exemple #30
0
 public Plugin(IConfigurationHandlerFactory configurationHandlerFactory)
 {
     _configHandler = configurationHandlerFactory.GetConfigurationHandler <Configuration>("LoginPluginSettings");
 }
 public IControlMessageProcessor GetControlMessageProcessor(IControlMessageHandler controlMessageHandler,
                                                            IConfigurationHandler configurationHandler)
 {
     return(new ControlMessageProcessor(ConfigurationReader, controlMessageHandler, configurationHandler, _errorHandler));
 }