feat: added RATSIGNAL warning support to plugin

Again, no profile support (yet)!
This commit is contained in:
alterNERDtive 2024-05-11 23:50:15 +02:00
parent 97df695b56
commit 5ef5b61c3c
Signed by: alterNERDtive
GPG key ID: 547787A4FE6533F1

View file

@ -183,6 +183,7 @@ namespace RatAttack
string cmdr = match.Groups["cmdr"].Value;
string? language = match.Groups["language"].Value;
string? system = match.Groups["system"].Value;
bool warning = match.Groups["system"].Value;
string? systemInfo = match.Groups["systemInfo"].Value;
bool permitLocked = match.Groups["permit"].Success;
string? permitName = match.Groups["permitName"].Value;
@ -197,9 +198,9 @@ namespace RatAttack
system = "None";
}
Log.Debug($"New rat case: CMDR “{cmdr}” in “{system}”{(!string.IsNullOrEmpty(systemInfo) ? $" ({systemInfo})" : string.Empty)} on {platform}{(!string.IsNullOrEmpty(mode) ? $" ({mode})" : string.Empty)}, permit locked: {permitLocked}{(permitLocked && !string.IsNullOrEmpty(permitName) ? $" (permit name: {permitName})" : string.Empty)}, code red: {codeRed} (#{number}).");
Log.Debug($"New rat case: CMDR “{cmdr}” in “{system}”{warning ? " " : string.Empty}{(!string.IsNullOrEmpty(systemInfo) ? $" ({systemInfo})" : string.Empty)} on {platform}{(!string.IsNullOrEmpty(mode) ? $" ({mode})" : string.Empty)}, permit locked: {permitLocked}{(permitLocked && !string.IsNullOrEmpty(permitName) ? $" (permit name: {permitName})" : string.Empty)}, code red: {codeRed} (#{number}).");
CaseList[number] = new RatCase(cmdr, language, system, systemInfo, permitLocked, permitName, platform, mode, codeRed, number);
CaseList[number] = new RatCase(cmdr, language, system, warning, systemInfo, permitLocked, permitName, platform, mode, codeRed, number);
return number;
}
@ -295,6 +296,7 @@ namespace RatAttack
vaProxy.SetInt("~~caseNumber", rc.Number);
vaProxy.SetText("~~cmdr", rc.Cmdr);
vaProxy.SetText("~~system", rc?.System?.ToLower());
vaProxy.SetBoolean("~~warning", rc?.Warning);
vaProxy.SetText("~~systemInfo", rc?.SystemInfo);
vaProxy.SetBoolean("~~permitLocked", rc?.PermitLocked);
vaProxy.SetText("~~permitName", rc?.PermitName);
@ -409,9 +411,9 @@ namespace RatAttack
private class RatCase
{
public RatCase(string cmdr, string? language, string? system, string? systemInfo, bool permitLocked, string? permitName, string platform, string mode, bool codeRed, int number)
=> (this.Cmdr, this.Language, this.System, this.SystemInfo, this.PermitLocked, this.PermitName, this.Platform, this.Mode, this.CodeRed, this.Number)
= (cmdr, language, system, systemInfo, permitLocked, permitName, platform, mode, codeRed, number);
public RatCase(string cmdr, string? language, string? system, bool warning, string? systemInfo, bool permitLocked, string? permitName, string platform, string mode, bool codeRed, int number)
=> (this.Cmdr, this.Language, this.System, this.Warning, this.SystemInfo, this.PermitLocked, this.PermitName, this.Platform, this.Mode, this.CodeRed, this.Number)
= (cmdr, language, system, warning systemInfo, permitLocked, permitName, platform, mode, codeRed, number);
public string Cmdr { get; }
@ -419,6 +421,8 @@ namespace RatAttack
public string? System { get; }
public bool Warning { get; }
public string? SystemInfo { get; }
public bool PermitLocked { get; }