From 68eff73dbd45b0fe5903478e12cfb5fd4e3ccd09 Mon Sep 17 00:00:00 2001
From: Ben Parsons <9parsonsb@gmail.com>
Date: Sat, 25 May 2024 19:41:38 +1000
Subject: [PATCH] Add Startup Events to Database Now emit startup events on
conneciton Some events still to add
---
ObservatoryFramework/Files/BackPackFile.cs | 8 +-
ObservatoryFramework/Files/CargoFile.cs | 2 +-
.../MaterialCompositionConverter.cs | 11 +-
.../Files/Converters/MaterialConverter.cs | 10 +-
.../MutableStringDoubleConverter.cs | 22 ----
.../Converters/NumberOrStringConverter.cs | 21 ++++
.../Files/Converters/StarPosConverter.cs | 11 +-
ObservatoryFramework/Files/FCMaterialsFile.cs | 2 +-
.../Files/Journal/Combat/Bounty.cs | 2 +-
.../Files/Journal/Combat/Died.cs | 2 +-
.../Files/Journal/Exploration/CodexEntry.cs | 2 +-
.../Exploration/MultiSellExplorationData.cs | 2 +-
.../Journal/Exploration/SAAScanComplete.cs | 4 +-
.../Journal/Exploration/SAASignalsFound.cs | 4 +-
.../Files/Journal/Exploration/Scan.cs | 17 +--
.../Exploration/SellExplorationData.cs | 4 +-
.../Files/Journal/FleetCarrier/CarrierJump.cs | 2 +-
.../Journal/FleetCarrier/CarrierStats.cs | 6 +-
.../Files/Journal/Odyssey/BackpackChange.cs | 4 +-
.../Journal/Odyssey/BackpackMaterials.cs | 8 +-
.../Journal/Odyssey/BuyMicroResources.cs | 2 +-
.../Journal/Odyssey/CreateSuitLoadout.cs | 4 +-
.../Journal/Odyssey/SellMicroResources.cs | 2 +-
.../Files/Journal/Odyssey/SellOrganicData.cs | 2 +-
.../Journal/Odyssey/ShipLockerMaterials.cs | 8 +-
.../Journal/Odyssey/TradeMicroResources.cs | 2 +-
.../Journal/Odyssey/TransferMicroResources.cs | 2 +-
.../Files/Journal/Other/ApproachSettlement.cs | 2 +-
.../Files/Journal/Other/CargoTransfer.cs | 2 +-
.../Files/Journal/Other/ProspectedAsteroid.cs | 2 +-
.../Files/Journal/Other/RebootRepair.cs | 2 +-
.../Files/Journal/Other/Synthesis.cs | 2 +-
.../Files/Journal/Other/WingJoin.cs | 2 +-
.../Journal/Powerplay/PowerplayVoucher.cs | 2 +-
.../Files/Journal/Startup/Cargo.cs | 2 +-
.../Files/Journal/Startup/Loadout.cs | 2 +-
.../Files/Journal/Startup/Materials.cs | 12 +-
.../Files/Journal/Startup/Missions.cs | 6 +-
.../Files/Journal/Startup/Progress.cs | 34 ++++-
.../Files/Journal/Startup/Statistics.cs | 6 +-
.../Journal/StationServices/CommunityGoal.cs | 2 +-
.../Journal/StationServices/EngineerCraft.cs | 4 +-
.../StationServices/EngineerProgress.cs | 39 ++++--
.../StationServices/MassModuleStore.cs | 2 +-
.../StationServices/MissionCompleted.cs | 8 +-
.../Journal/StationServices/RedeemVoucher.cs | 2 +-
.../Files/Journal/StationServices/Repair.cs | 2 +-
.../Journal/StationServices/StoredModules.cs | 2 +-
.../Journal/StationServices/StoredShips.cs | 4 +-
.../StationServices/TechnologyBroker.cs | 6 +-
.../Files/Journal/Travel/Docked.cs | 2 +-
.../Files/Journal/Travel/FSDJump.cs | 8 +-
.../Files/Journal/Travel/Location.cs | 27 ++--
ObservatoryFramework/Files/MarketFile.cs | 2 +-
ObservatoryFramework/Files/ModuleInfoFile.cs | 2 +-
ObservatoryFramework/Files/NavRouteFile.cs | 2 +-
ObservatoryFramework/Files/OutfittingFile.cs | 2 +-
.../Files/ParameterTypes/DetailedFaction.cs | 4 +-
.../Files/ParameterTypes/Engineering.cs | 2 +-
.../Files/ParameterTypes/FactionEffect.cs | 4 +-
.../Files/ParameterTypes/Modifiers.cs | 45 +++----
.../Files/ParameterTypes/Route.cs | 3 +-
.../Files/ParameterTypes/SuitModule.cs | 2 +-
.../Files/ParameterTypes/SystemFaction.cs | 6 +-
ObservatoryFramework/Files/ShipyardFile.cs | 2 +-
.../Configuration/BackpackCofiguration.cs | 17 +++
.../Configuration/CargoConfiguration.cs | 13 ++
.../Configuration/LoadoutConfiguration.cs | 26 ++++
.../Configuration/LocationConfiguration.cs | 34 +++++
.../Configuration/ShipLockerConfiguration.cs | 16 +++
Pulsar/Context/PulsarContext.cs | 28 ++---
Pulsar/Features/EventsHub.cs | 10 +-
Pulsar/Features/FileWatcherService.cs | 5 -
Pulsar/Features/Journal/JournalProcessor.cs | 80 +++++++++---
Pulsar/Features/Journal/JournalService.cs | 117 +++++++++++++++---
Pulsar/Features/Journal/JournalStore.cs | 24 ++++
Pulsar/Features/NavRoute/NavRouteService.cs | 6 +-
.../Features/Outfitting/OutfittingService.cs | 6 +-
.../Features/ShipLocker/ShipLockerService.cs | 4 +-
Pulsar/PulsarServiceRegistry.cs | 3 +-
80 files changed, 586 insertions(+), 229 deletions(-)
delete mode 100644 ObservatoryFramework/Files/Converters/MutableStringDoubleConverter.cs
create mode 100644 ObservatoryFramework/Files/Converters/NumberOrStringConverter.cs
create mode 100644 Pulsar/Context/Configuration/BackpackCofiguration.cs
create mode 100644 Pulsar/Context/Configuration/CargoConfiguration.cs
create mode 100644 Pulsar/Context/Configuration/LoadoutConfiguration.cs
create mode 100644 Pulsar/Context/Configuration/LocationConfiguration.cs
create mode 100644 Pulsar/Context/Configuration/ShipLockerConfiguration.cs
create mode 100644 Pulsar/Features/Journal/JournalStore.cs
diff --git a/ObservatoryFramework/Files/BackPackFile.cs b/ObservatoryFramework/Files/BackPackFile.cs
index d2bde67..78e28b2 100644
--- a/ObservatoryFramework/Files/BackPackFile.cs
+++ b/ObservatoryFramework/Files/BackPackFile.cs
@@ -13,17 +13,17 @@ public class BackpackFile : JournalBase
///
/// List of all items carried.
///
- public ImmutableList Items { get; init; }
+ public IReadOnlyCollection Items { get; init; }
///
/// List of all components carried.
///
- public ImmutableList Components { get; init; }
+ public IReadOnlyCollection Components { get; init; }
///
/// List of player consumable items carried.
///
- public ImmutableList Consumables { get; init; }
+ public IReadOnlyCollection Consumables { get; init; }
///
/// List of all data currently stored by the player.
///
- public ImmutableList Data { get; init; }
+ public IReadOnlyCollection Data { get; init; }
}
\ No newline at end of file
diff --git a/ObservatoryFramework/Files/CargoFile.cs b/ObservatoryFramework/Files/CargoFile.cs
index e5b0db2..c19112d 100644
--- a/ObservatoryFramework/Files/CargoFile.cs
+++ b/ObservatoryFramework/Files/CargoFile.cs
@@ -21,5 +21,5 @@ public class CargoFile : JournalBase
///
/// List of full cargo details.
///
- public ImmutableList Inventory { get; init; }
+ public IReadOnlyCollection Inventory { get; init; }
}
\ No newline at end of file
diff --git a/ObservatoryFramework/Files/Converters/MaterialCompositionConverter.cs b/ObservatoryFramework/Files/Converters/MaterialCompositionConverter.cs
index 440c923..0acfcf8 100644
--- a/ObservatoryFramework/Files/Converters/MaterialCompositionConverter.cs
+++ b/ObservatoryFramework/Files/Converters/MaterialCompositionConverter.cs
@@ -9,9 +9,9 @@ namespace Observatory.Framework.Files.Converters;
/// The format used for materials changed from an object with a key for each material to an array of objects containing "name" and "percent".
/// Need to handle both if we're going to read historical data. This reads the old format into a class reflecting the new structure.
///
-public class MaterialCompositionConverter : JsonConverter>
+public class MaterialCompositionConverter : JsonConverter>
{
- public override ImmutableList Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
+ public override IReadOnlyCollection Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.StartObject)
{
@@ -38,13 +38,14 @@ public class MaterialCompositionConverter : JsonConverter>(ref reader, options)!;
+ return JsonSerializer.Deserialize>(ref reader, options)!;
}
- public override void Write(Utf8JsonWriter writer, ImmutableList value,
+ public override void Write(Utf8JsonWriter writer, IReadOnlyCollection value,
JsonSerializerOptions options)
{
JsonSerializer.Serialize(writer, value, options);
diff --git a/ObservatoryFramework/Files/Converters/MaterialConverter.cs b/ObservatoryFramework/Files/Converters/MaterialConverter.cs
index f005bdb..532e2e7 100644
--- a/ObservatoryFramework/Files/Converters/MaterialConverter.cs
+++ b/ObservatoryFramework/Files/Converters/MaterialConverter.cs
@@ -9,9 +9,9 @@ namespace Observatory.Framework.Files.Converters;
/// The format used for materials changed from an object with a key for each material to an array of objects containing "name" and "percent".
/// Need to handle both if we're going to read historical data. This reads the old format into a class reflecting the new structure.
///
-public class MaterialConverter : JsonConverter>
+public class MaterialConverter : JsonConverter>
{
- public override ImmutableList Read(ref Utf8JsonReader reader, Type typeToConvert,
+ public override IReadOnlyCollection Read(ref Utf8JsonReader reader, Type typeToConvert,
JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.StartObject)
@@ -41,13 +41,13 @@ public class MaterialConverter : JsonConverter>
}
}
- return materialComposition.ToImmutableList();
+ return materialComposition;
}
- return JsonSerializer.Deserialize>(ref reader, options)!;
+ return JsonSerializer.Deserialize>(ref reader, options)!;
}
- public override void Write(Utf8JsonWriter writer, ImmutableList value, JsonSerializerOptions options)
+ public override void Write(Utf8JsonWriter writer, IReadOnlyCollection value, JsonSerializerOptions options)
{
JsonSerializer.Serialize(writer, value, options);
}
diff --git a/ObservatoryFramework/Files/Converters/MutableStringDoubleConverter.cs b/ObservatoryFramework/Files/Converters/MutableStringDoubleConverter.cs
deleted file mode 100644
index 7bbfe6f..0000000
--- a/ObservatoryFramework/Files/Converters/MutableStringDoubleConverter.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Text.Json;
-using System.Text.Json.Serialization;
-
-namespace Observatory.Framework.Files.Converters;
-
-class MutableStringDoubleConverter : JsonConverter