2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-04-05 17:39:39 -04:00
2024-04-13 18:10:46 +10:00

43 lines
1.1 KiB
C#

using System.Text;
using System.Text.Json;
namespace Observatory.Framework.Files.Journal;
public static class JournalUtilities
{
public static string GetEventType(string 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;
}
public static string CleanScanEvent(string line)
{
return line.Replace("\"RotationPeriod\":inf,", "");
}
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.";
}