2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-07-03 01:03:41 -04:00

Rework Journal File Reading

Remove Explorer
Remove Plugin Architecture
This commit is contained in:
2024-04-14 21:51:56 +10:00
parent c0c69dcdf7
commit 256ebb179e
42 changed files with 855 additions and 2807 deletions

View File

@ -1,34 +1,12 @@
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
namespace Observatory.Framework.Files.Journal;
public static class JournalUtilities
{
public static string GetEventType(string line)
public static string? GetEventType(JsonObject? line)
{
var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(line));
var result = string.Empty;
try
{
while (reader.Read())
{
if (reader.TokenType == JsonTokenType.PropertyName && reader.GetString() == "event")
{
reader.Read();
result = reader.GetString();
}
}
}
catch
{
result = "InvalidJson";
}
return result;
return line.ContainsKey("event") ? line["event"]?.ToString() : null;
}
public static string CleanScanEvent(string line)
@ -38,6 +16,6 @@ public static class JournalUtilities
public const string ObsoleteMessage = "Unused in Elite Dangerous 3.7+, may appear in legacy journal data.";
public const string UnusedMessage = "Documented by Frontier, but no occurances of this value ever found in real journal data.";
public const string UnusedMessage =
"Documented by Frontier, but no occurances of this value ever found in real journal data.";
}