fix the actually stupid part where an empty value could overwrite the valid one

This commit is contained in:
13xforever 2019-02-23 20:52:37 +05:00
parent 897142388c
commit cc37ac833a
3 changed files with 13 additions and 5 deletions

View File

@ -42,7 +42,7 @@ namespace CompatBot.EventHandlers.LogParsing
["Physical device intialized"] = new Regex(@"Physical device intialized\. GPU=(?<vulkan_gpu>.+), driver=(?<vulkan_driver_version_raw>-?\d+)\r?$", DefaultOptions),
["Found vulkan-compatible GPU:"] = new Regex(@"Found vulkan-compatible GPU: (?<vulkan_found_device>'(?<vulkan_compatible_device_name>.+)' running.+)\r?$", DefaultOptions),
["Serial:"] = new Regex(@"Serial: (?<serial>[A-z]{4}\d{5})\r?$", DefaultOptions),
["Successfully installed PS3 firmware"] = new Regex(@"(?<fw_installed_message>Successfully installed PS3 firmware version (?<fw_version_installed>\d+\.\d+)).*\r?$", DefaultOptions),
["Successfully installed PS3 firmware"] = new Regex(@"(?<fw_installed_message>Successfully installed PS3 firmware) version (?<fw_version_installed>\d+\.\d+).*\r?$", DefaultOptions),
["Title:"] = new Regex(@"Title: (?<game_title>.*)?\r?$", DefaultOptions),
["Category:"] = new Regex(@"Category: (?<game_category>.*)?\r?$", DefaultOptions),
["LDR:"] = new Regex(@"(Path|Cache): ((?<win_path>\w:/)|(?<lin_path>/[^/])).*?\r?$", DefaultOptions),
@ -194,7 +194,7 @@ namespace CompatBot.EventHandlers.LogParsing
}
state.WipCollection = new NameValueCollection();
Copy(
"build_and_specs",
"build_and_specs", "fw_version_installed",
"vulkan_gpu", "d3d_gpu",
"driver_version", "driver_manuf",
"driver_manuf_new", "driver_version_new",

View File

@ -50,16 +50,22 @@ namespace CompatBot.EventHandlers.LogParsing
foreach (Group group in match.Groups)
if (!string.IsNullOrEmpty(group.Name) && group.Name != "0" && !string.IsNullOrWhiteSpace(group.Value))
{
var strValue = group.Value.ToUtf8();
if (string.IsNullOrEmpty(strValue))
continue;
Config.Log.Debug($"regex {group.Name} = {group.Value}");
if (MultiValueItems.Contains(group.Name))
{
var currentValue = state.WipCollection[group.Name];
if (!string.IsNullOrEmpty(currentValue))
currentValue += Environment.NewLine;
state.WipCollection[group.Name] = currentValue + group.Value.ToUtf8();
state.WipCollection[group.Name] = currentValue + strValue;
}
else
state.WipCollection[group.Name] = group.Value.ToUtf8();
{
state.WipCollection[group.Name] = strValue;
}
}
}

View File

@ -18,7 +18,9 @@ namespace CompatBot.Utils.ResultFormatters
{
items["build_branch"] = m.Groups["branch"].Value.Trim();
items["build_commit"] = m.Groups["commit"].Value.Trim();
items["fw_version_installed"] = m.Groups["fw_version_installed"].Value;
var fwVersion = m.Groups["fw_version_installed"].Value;
if (!string.IsNullOrEmpty(fwVersion))
items["fw_version_installed"] = fwVersion;
items["cpu_model"] = m.Groups["cpu_model"].Value
.Replace("(R)", "", StringComparison.InvariantCultureIgnoreCase)
.Replace("®", "", StringComparison.InvariantCultureIgnoreCase)