public static IRConParserConfiguration CreateRConParserConfiguration(IParserRegexFactory factory) => new DynamicRConParserConfiguration(factory)
 {
     CommandPrefixes = new SharedLibraryCore.RCon.CommandPrefix()
     {
         Kick = "kick",
         Say  = "say"
     }
 };
 public DynamicRConParserConfiguration(IParserRegexFactory parserRegexFactory)
 {
     Status         = parserRegexFactory.CreateParserRegex();
     MapStatus      = parserRegexFactory.CreateParserRegex();
     GametypeStatus = parserRegexFactory.CreateParserRegex();
     Dvar           = parserRegexFactory.CreateParserRegex();
     StatusHeader   = parserRegexFactory.CreateParserRegex();
 }
 public DynamicEventParserConfiguration(IParserRegexFactory parserRegexFactory)
 {
     Say    = parserRegexFactory.CreateParserRegex();
     Join   = parserRegexFactory.CreateParserRegex();
     Quit   = parserRegexFactory.CreateParserRegex();
     Kill   = parserRegexFactory.CreateParserRegex();
     Damage = parserRegexFactory.CreateParserRegex();
     Action = parserRegexFactory.CreateParserRegex();
     Time   = parserRegexFactory.CreateParserRegex();
 }
Example #4
0
        public BaseRConParser(ILogger <BaseRConParser> logger, IParserRegexFactory parserRegexFactory)
        {
            _logger       = logger;
            Configuration = new DynamicRConParserConfiguration(parserRegexFactory)
            {
                CommandPrefixes = new CommandPrefix()
                {
                    Tell                      = "tell {0} {1}",
                    Say                       = "say {0}",
                    Kick                      = "clientkick {0} \"{1}\"",
                    Ban                       = "clientkick {0} \"{1}\"",
                    TempBan                   = "tempbanclient {0} \"{1}\"",
                    RConCommand               = "ÿÿÿÿrcon {0} {1}",
                    RConGetDvar               = "ÿÿÿÿrcon {0} {1}",
                    RConSetDvar               = "ÿÿÿÿrcon {0} set {1}",
                    RConGetStatus             = "ÿÿÿÿgetstatus",
                    RConGetInfo               = "ÿÿÿÿgetinfo",
                    RConResponse              = "ÿÿÿÿprint",
                    RconGetInfoResponseHeader = "ÿÿÿÿinfoResponse"
                },
                ServerNotRunningResponse = "Server is not running."
            };

            Configuration.Status.Pattern = @"^ *([0-9]+) +-?([0-9]+) +((?:[A-Z]+|[0-9]+)) +((?:[a-z]|[0-9]){8,32}|(?:[a-z]|[0-9]){8,32}|bot[0-9]+|(?:[0-9]+)) *(.{0,32}) +([0-9]+) +(\d+\.\d+\.\d+.\d+\:-*\d{1,5}|0+.0+:-*\d{1,5}|loopback|unknown) +(-*[0-9]+) +([0-9]+) *$";
            Configuration.Status.AddMapping(ParserRegex.GroupType.RConClientNumber, 1);
            Configuration.Status.AddMapping(ParserRegex.GroupType.RConScore, 2);
            Configuration.Status.AddMapping(ParserRegex.GroupType.RConPing, 3);
            Configuration.Status.AddMapping(ParserRegex.GroupType.RConNetworkId, 4);
            Configuration.Status.AddMapping(ParserRegex.GroupType.RConName, 5);
            Configuration.Status.AddMapping(ParserRegex.GroupType.RConIpAddress, 7);

            Configuration.Dvar.Pattern = "^\"(.+)\" is: \"(.+)?\" default: \"(.+)?\"\n(?:latched: \"(.+)?\"\n)? *(.+)$";
            Configuration.Dvar.AddMapping(ParserRegex.GroupType.RConDvarName, 1);
            Configuration.Dvar.AddMapping(ParserRegex.GroupType.RConDvarValue, 2);
            Configuration.Dvar.AddMapping(ParserRegex.GroupType.RConDvarDefaultValue, 3);
            Configuration.Dvar.AddMapping(ParserRegex.GroupType.RConDvarLatchedValue, 4);
            Configuration.Dvar.AddMapping(ParserRegex.GroupType.RConDvarDomain, 5);
            Configuration.Dvar.AddMapping(ParserRegex.GroupType.AdditionalGroup, int.MaxValue);

            Configuration.StatusHeader.Pattern   = "num +score +ping +guid +name +lastmsg +address +qport +rate *";
            Configuration.GametypeStatus.Pattern = "";
            Configuration.MapStatus.Pattern      = @"map: (([a-z]|_|\d)+)";
            Configuration.MapStatus.AddMapping(ParserRegex.GroupType.RConStatusMap, 1);

            if (!Configuration.DefaultDvarValues.ContainsKey("mapname"))
            {
                Configuration.DefaultDvarValues.Add("mapname", "Unknown");
            }
        }
Example #5
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;
 }
Example #6
0
 public DynamicEventParser(IParserRegexFactory parserRegexFactory, ILogger logger, ApplicationConfiguration appConfig) : base(parserRegexFactory, logger, appConfig)
 {
 }
Example #7
0
 public DynamicRConParser(IParserRegexFactory parserRegexFactory) : base(parserRegexFactory)
 {
 }
Example #8
0
 public DynamicRConParser(ILogger <BaseRConParser> logger, IParserRegexFactory parserRegexFactory) : base(logger, parserRegexFactory)
 {
 }