EliteJourneyReader 1.0.1

dotnet add package EliteJourneyReader --version 1.0.1
                    
NuGet\Install-Package EliteJourneyReader -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EliteJourneyReader" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EliteJourneyReader" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="EliteJourneyReader" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EliteJourneyReader --version 1.0.1
                    
#r "nuget: EliteJourneyReader, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EliteJourneyReader@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EliteJourneyReader&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=EliteJourneyReader&version=1.0.1
                    
Install as a Cake Tool

EliteJourneyReader

EliteJourneyReader is a library for game Elite Dangerous written in .Net for interacting with in-game events with easy-to-use interface and customizable options.

How does it work?

When an event happens in-game, a file in %userprofile%\Saved Games\Frontier Developments\Elite Dangerous\ is appended (or new file is created) with json message of this in-game event along with event description (json properties). Each in-game event is unique, has (mostly) different properties and is triggered by different actions.

EliteJourneyReader is capable of listening to these file changes, processing new in-game messages and exposing all necessary for you to easily react upon it.

Even without having supported all in-game event messages, EliteJourneyReader is fully capable of reacting to all messages, supported or not.

This is supported with OnAnyEvent event. This event is raised every time an in-game event is triggered. From here, you will get the base properties that every message has, like what type of event was triggered and when it was triggered, along with json value of message that raised the event.

Code sample

In order for EliteJourneyReader to work, you need to register it's services through DI first:

services.ConfigureJourneyReader();

You can set options to your liking, for example to disable default reading of messages right from application start:

services.ConfigureJourneyReader(options =>
{
    options.AutoStartProcessingMessages = false;
});

If you are not familiar with DI design pattern, it is explained in official microsoft documentation for .NET dependency injection. You can also check how it's done in <c>WpfSampleApp</c> in this solution.

Reacting to event not directly supported by EliteJourneyReader:

public MainWindow(IEliteJourneyProvider eliteJourneyProvider)
{
    eliteJourneyProvider.OnAnyEvent += EliteJourneyProviderOnAnyEvent;
}

private void EliteJourneyProviderOnAnyEvent(JourneyEventMessage message, string jsonMessage)
{
    if (message.EventType == "ReceiveText")
    {
        //do something
    }
}

Even though not much is given to us from message argument, we get the full jsonMessage:

{ 
  "timestamp":"2023-05-30T17:17:56Z", 
  "event":"ReceiveText", 
  "From":"", 
  "Message":"$COMMS_entered:#name=HIP 64726;", 
  "Message_Localised":"Entered Channel: HIP 64726", 
  "Channel":"npc"
}

We can then deserialize jsonMessage e.g. using Newtonsoft json:

var message = JsonConvert.DeserializeObject<ReceiveTextMessage>(jsonMessage);

Once you have deserialized the message, it's only up to you what to do!

Reacting to supported event

For supported events it's even easier - we have all the types and even handled in EliteJourneyReader.

public MainWindow(IEliteJourneyProvider eliteJourneyProvider)
{
    eliteJourneyProvider.OnFriendsChange += OnFriendsChange;
}

private void OnFriendsChange(object? sender, FriendsEventMessage friendsChangeMessage)
{
    //"Your friend {username} is {online/offline/...}"
    Console.WriteLine($"Your friend {friendsChangeMessage.FriendName} is {friendsChangeMessage.Status}!");
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 247 6/4/2023
0.1.7 302 2/11/2023
0.1.3 311 2/7/2023

1.0.0 Added support for new message types
                 Added possibility to set:
                   * Json serializer settings when deserializing message
                   * Auto start processing messages on startup (default is true)
                   * Start or stop reading file changes (enables or disables reading / processing of new messages)
                   * Directory path (default is the same as default Journal files location)
                 Internal code changes
           0.1.8 Added option to change journal directory