2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-07-02 00:43:42 -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,20 +1,22 @@
namespace Observatory.Framework;
using System.Text.Json.Nodes;
namespace Observatory.Framework;
/// <summary>
/// Provides data for Elite Dangerous journal events.
/// </summary>
public class JournalEventArgs : EventArgs
public class JournalEventArgs(string journalEventType, JsonObject journalEvent) : EventArgs
{
/// <summary>
/// <para>Type of journal entry that triggered event.</para>
/// <para>Will be a class from the Observatory.Framework.Files.Journal namespace derived from JournalBase, or JournalBase itself in the case of an unhandled journal event type.</para>
/// </summary>
public Type journalType;
public string JournalEventType = journalEventType;
/// <summary>
/// <para>Elite Dangerous journal event, deserialized into a .NET object of the type specified by JournalEventArgs.journalType.</para>
/// <para>Unhandled json values within a journal entry type will be contained in member property:<br/>Dictionary&lt;string, object&gt; AdditionalProperties.</para>
/// </summary>
public object journalEvent;
public JsonObject JournalEvent = journalEvent;
}
/// <summary>
@ -26,48 +28,59 @@ public class NotificationArgs
/// Text typically displayed as header content.
/// </summary>
public string Title;
/// <summary>
/// SSML representation of Title text.<br/>
/// This value is optional, if omitted the value of <c>NotificationArgs.Title</c> will be used for voice synthesis without markup.
/// </summary>
public string TitleSsml;
/// <summary>
/// Text typically displayed as body content.
/// </summary>
public string Detail;
/// <summary>
/// SSML representation of Detail text.<br/>
/// This value is optional, if omitted the value of <c>NotificationArgs.Detail</c> will be used for voice synthesis without markup.
/// </summary>
public string DetailSsml;
/// <summary>
/// Specify window timeout in ms (overrides Core setting). Specify 0 timeout to persist until removed via IObservatoryCore.CancelNotification. Default -1 (use Core setting).
/// </summary>
public int Timeout = -1;
/// <summary>
/// Specify window X position as a percentage from upper left corner (overrides Core setting). Default -1.0 (use Core setting).
/// </summary>
public double XPos = -1.0;
/// <summary>
/// Specify window Y position as a percentage from upper left corner (overrides Core setting). Default -1.0 (use Core setting).
/// </summary>
public double YPos = -1.0;
/// <summary>
/// Specifies the desired renderings of the notification. Defaults to <see cref="NotificationRendering.All"/>.
/// </summary>
public NotificationRendering Rendering = NotificationRendering.All;
/// <summary>
/// Specifies if some part of the notification should be suppressed. Not supported by all notifiers. Defaults to <see cref="NotificationSuppression.None"/>.
/// </summary>
public NotificationSuppression Suppression = NotificationSuppression.None;
/// <summary>
/// The plugin sending this notification.
/// </summary>
public string Sender = "";
/// <summary>
/// Additional notification detailed (generally not rendered by voice or popup; potentially used by aggregating/logging plugins).
/// </summary>
public string ExtendedDetails;
/// <summary>
/// A value which allows grouping of notifications together. For example, values &gt;= 0 &lt;= 1000 could be system body IDs, -1 is the system, anything else is arbitrary.
/// </summary>
@ -84,10 +97,12 @@ public enum NotificationSuppression
/// No suppression.
/// </summary>
None = 0,
/// <summary>
/// Suppress title.
/// </summary>
Title = 1,
/// <summary>
/// Suppress detail.
/// </summary>
@ -104,14 +119,17 @@ public enum NotificationRendering
/// Send notification to native visual popup notificaiton handler.
/// </summary>
NativeVisual = 1,
/// <summary>
/// Send notification to native speech notification handler.
/// </summary>
NativeVocal = 2,
/// <summary>
/// Send notification to all installed notifier plugins.
/// </summary>
PluginNotifier = 4,
/// <summary>
/// Send notification to all available handlers.
/// </summary>
@ -128,18 +146,21 @@ public enum LogMonitorState : uint
/// Monitoring is stopped.
/// </summary>
Idle = 0,
/// <summary>
/// Real-time monitoring is active.
/// </summary>
Realtime = 1,
/// <summary>
/// Batch read of historical journals is in progress.
/// </summary>
Batch = 2,
BatchProcessing = 2,
/// <summary>
/// Batch read of recent journals is in progress to establish current player state.
/// Initial read of recent journals to establish current player state is in progress .
/// </summary>
PreRead = 4
Init = 4
}
/// <summary>
@ -164,6 +185,6 @@ public class LogMonitorStateChangedEventArgs : EventArgs
/// <returns>A boolean; True iff the state provided represents a batch-mode read.</returns>
public static bool IsBatchRead(LogMonitorState state)
{
return state.HasFlag(LogMonitorState.Batch) || state.HasFlag(LogMonitorState.PreRead);
return state.HasFlag(LogMonitorState.BatchProcessing) || state.HasFlag(LogMonitorState.Init);
}
}