1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

fix for runaway regular expression on linux

explicitly set string dvars in quotes to allow setting empty dvars
allow piping in input from command line (#114)
update the distribution for top stats elo
prevent game log file rotation from stopping event parsing
This commit is contained in:
RaidMax
2020-04-01 14:11:56 -05:00
parent 87987f885d
commit d45d99454b
35 changed files with 504 additions and 124 deletions

View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharedLibraryCore.Interfaces
{
@ -41,10 +40,21 @@ namespace SharedLibraryCore.Interfaces
AdditionalGroup = 200
}
public IParserPatternMatcher PatternMatcher { get; private set; }
private string pattern;
/// <summary>
/// stores the regular expression groups that will be mapped to group types
/// </summary>
public string Pattern { get; set; }
public string Pattern
{
get => pattern;
set
{
pattern = value;
PatternMatcher.Compile(value);
}
}
/// <summary>
/// stores the mapping from group type to group index in the regular expression
@ -90,9 +100,10 @@ namespace SharedLibraryCore.Interfaces
}
}
public ParserRegex()
public ParserRegex(IParserPatternMatcher pattern)
{
GroupMapping = new Dictionary<GroupType, int>();
PatternMatcher = pattern;
}
}
}

View File

@ -39,6 +39,11 @@ namespace SharedLibraryCore.Interfaces
/// </summary>
ParserRegex Action { get; set; }
/// <summary>
/// stores the regex information for the time prefix in game log
/// </summary>
ParserRegex Time { get; set; }
/// <summary>
/// indicates the format expected for parsed guids
/// </summary>

View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SharedLibraryCore.Interfaces
@ -17,11 +15,13 @@ namespace SharedLibraryCore.Interfaces
/// <param name="fileSizeDiff"></param>
/// <param name="startPosition"></param>
/// <returns></returns>
Task<ICollection<GameEvent>> ReadEventsFromLog(Server server, long fileSizeDiff, long startPosition);
Task<IEnumerable<GameEvent>> ReadEventsFromLog(Server server, long fileSizeDiff, long startPosition);
/// <summary>
/// how long the log file is
/// </summary>
long Length { get; }
/// <summary>
/// how often to poll the log file
/// </summary>

View File

@ -0,0 +1,18 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// represents a pattern match result
/// </summary>
public interface IMatchResult
{
/// <summary>
/// array of matched pattern groups
/// </summary>
string[] Values { get; set; }
/// <summary>
/// indicates if the match succeeded
/// </summary>
bool Success { get; set; }
}
}

View File

@ -0,0 +1,21 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// defines the capabilities of a parser pattern
/// </summary>
public interface IParserPatternMatcher
{
/// <summary>
/// converts input string into pattern groups
/// </summary>
/// <param name="input">input string</param>
/// <returns>group matches</returns>
IMatchResult Match(string input);
/// <summary>
/// compiles the pattern to be used for matching
/// </summary>
/// <param name="pattern"></param>
void Compile(string pattern);
}
}

View File

@ -0,0 +1,14 @@
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// defines the capabilities of the parser regex factory
/// </summary>
public interface IParserRegexFactory
{
/// <summary>
/// creates a new ParserRegex instance
/// </summary>
/// <returns>ParserRegex instance</returns>
ParserRegex CreateParserRegex();
}
}

View File

@ -46,30 +46,30 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentValidation" Version="8.6.1" />
<PackageReference Include="FluentValidation" Version="8.6.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.1">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Npgsql" Version="4.1.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.1.2" />
<PackageReference Include="Npgsql" Version="4.1.3.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.1" />
<PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Debug'">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.3" />
</ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">