diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 00000000..189abff6
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,3 @@
+# These are supported funding model platforms
+
+github: somfic
diff --git a/EliteAPI.Abstractions/EliteAPI.Abstractions.csproj b/EliteAPI.Abstractions/EliteAPI.Abstractions.csproj
index 7a390c20..750ef1a3 100644
--- a/EliteAPI.Abstractions/EliteAPI.Abstractions.csproj
+++ b/EliteAPI.Abstractions/EliteAPI.Abstractions.csproj
@@ -5,10 +5,10 @@
10
3.0.0.0
3.0.0.0
- 3.0.15+54.Branch.main.Sha.70e812132018e1fd6aed105986a0a4e768ac07a8
+ 3.1.3+3.Branch.main.Sha.3f580569f82b353dc898f1e57a776f18dc2a597e
3.0.0-alpha5155
- 3.0.15.0
- 3.0.15.0
+ 3.1.3.0
+ 3.1.3.0
https://github.com/EliteAPI/EliteAPI
https://github.com/EliteAPI/EliteAPI
@@ -18,7 +18,7 @@
Abstractions for EliteAPI
© Somfic 2022
false
- 3.0.15
+ 3.1.3
true
icon.png
true
diff --git a/EliteAPI.Abstractions/Events/IEvents.cs b/EliteAPI.Abstractions/Events/IEvents.cs
index 4f9df52c..8e00ccb6 100644
--- a/EliteAPI.Abstractions/Events/IEvents.cs
+++ b/EliteAPI.Abstractions/Events/IEvents.cs
@@ -141,7 +141,7 @@ public interface IEvents
/// Converts the JSON to a registered event type and invokes the registered event handlers.
/// The event JSON
/// The context of the event
- IEvent Invoke(string json, EventContext context);
+ IEvent? Invoke(string json, EventContext context);
/// Discovers and registers all the events in the specified assembly.
/// The assembly the events are defined in
diff --git a/EliteAPI.Events/EliteAPI.Events.csproj b/EliteAPI.Events/EliteAPI.Events.csproj
index db261b38..0b43b675 100644
--- a/EliteAPI.Events/EliteAPI.Events.csproj
+++ b/EliteAPI.Events/EliteAPI.Events.csproj
@@ -3,9 +3,9 @@
enable
enable
10
- 3.0.15.0
- 3.0.15.0
- 3.0.15+54.Branch.main.Sha.70e812132018e1fd6aed105986a0a4e768ac07a8
+ 3.1.3.0
+ 3.1.3.0
+ 3.1.3+3.Branch.main.Sha.3f580569f82b353dc898f1e57a776f18dc2a597e
3.0.0-alpha5167
true
https://github.com/EliteAPI/EliteAPI
@@ -17,7 +17,7 @@
Events for EliteAPI
© Somfic 2022
false
- 3.0.15
+ 3.1.3
true
icon.png
netstandard2.0
diff --git a/EliteAPI.Events/Status/Ship/LegalState.cs b/EliteAPI.Events/Status/Ship/LegalState.cs
index ebbfbae8..d30bd367 100644
--- a/EliteAPI.Events/Status/Ship/LegalState.cs
+++ b/EliteAPI.Events/Status/Ship/LegalState.cs
@@ -8,5 +8,6 @@ public enum LegalState
Wanted,
Hostile,
PassengerWanted,
- Warrant
+ Warrant,
+ Thargoid
}
\ No newline at end of file
diff --git a/EliteAPI.Tests/Bindings.cs b/EliteAPI.Tests/Bindings.cs
index 91a3a746..3005a599 100644
--- a/EliteAPI.Tests/Bindings.cs
+++ b/EliteAPI.Tests/Bindings.cs
@@ -23,6 +23,19 @@ public void Parsing()
{
var xml = File.ReadAllText("Bindings.xml");
var bindings = _parser.Parse(xml);
+ Assert.That(bindings, Is.Not.Null);
+ Assert.That(bindings, Is.Not.Empty);
+ Assert.That(bindings, Has.Count.AtLeast(1));
+ }
+
+ [Test]
+ public void HcsParsing()
+ {
+ var xml = File.ReadAllText("BindingsHCS.xml");
+ var bindings = _parser.Parse(xml);
+ Assert.That(bindings, Is.Not.Null);
+ Assert.That(bindings, Is.Not.Empty);
+ Assert.That(bindings, Has.Count.AtLeast(1));
}
[Test]
diff --git a/EliteAPI.Tests/BindingsHCS.xml b/EliteAPI.Tests/BindingsHCS.xml
new file mode 100644
index 00000000..bf4a0633
--- /dev/null
+++ b/EliteAPI.Tests/BindingsHCS.xml
@@ -0,0 +1,1871 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EliteAPI.Tests/EliteAPI.Tests.csproj b/EliteAPI.Tests/EliteAPI.Tests.csproj
index e79a1bcc..42579ddf 100644
--- a/EliteAPI.Tests/EliteAPI.Tests.csproj
+++ b/EliteAPI.Tests/EliteAPI.Tests.csproj
@@ -5,10 +5,10 @@
enable
false
true
- 3.0.15.0
- 3.0.15.0
- 3.0.15+54.Branch.main.Sha.70e812132018e1fd6aed105986a0a4e768ac07a8
- 3.0.15
+ 3.1.3.0
+ 3.1.3.0
+ 3.1.3+3.Branch.main.Sha.3f580569f82b353dc898f1e57a776f18dc2a597e
+ 3.1.3
@@ -33,5 +33,8 @@
Always
+
+ Always
+
\ No newline at end of file
diff --git a/EliteAPI.Tests/JournalManual.cs b/EliteAPI.Tests/JournalManual.cs
index 268e4421..682c9ccf 100644
--- a/EliteAPI.Tests/JournalManual.cs
+++ b/EliteAPI.Tests/JournalManual.cs
@@ -17,7 +17,7 @@ namespace EliteAPI.Tests;
public class JournalManual
{
private static IEvents _events;
- private static string[] _legacyEvents = { "BackpackMaterials", "BuyMicroResources", "ShipTargetted", "CarrierNameChanged" };
+ private static string[] _legacyEvents = { "BackpackMaterials", "ShipTargetted", "CarrierNameChanged" };
private static string[] _legacyExamples =
{
"\"timestamp\":\"2020-04-27T08:02:52Z\", \"event\":\"Route\"",
@@ -69,7 +69,7 @@ public void Json(string json)
var invokedEvent = _events.Invoke(json, new EventContext());
- Assert.That(invokedEvent, Is.Not.Null, $"Event is null");
+ Assert.That(invokedEvent, Is.Not.Null, $"Event is not registered: {json}");
// Check if the event is the correct type
var eventType = invokedEvent.GetType();
diff --git a/EliteAPI.Web.Spansh/EliteAPI.Web.Spansh.csproj b/EliteAPI.Web.Spansh/EliteAPI.Web.Spansh.csproj
index 815f427c..f47f346b 100644
--- a/EliteAPI.Web.Spansh/EliteAPI.Web.Spansh.csproj
+++ b/EliteAPI.Web.Spansh/EliteAPI.Web.Spansh.csproj
@@ -4,10 +4,10 @@
enable
enable
default
- 3.0.15.0
- 3.0.15.0
- 3.0.15+54.Branch.main.Sha.70e812132018e1fd6aed105986a0a4e768ac07a8
- 3.0.15
+ 3.1.3.0
+ 3.1.3.0
+ 3.1.3+3.Branch.main.Sha.3f580569f82b353dc898f1e57a776f18dc2a597e
+ 3.1.3
diff --git a/EliteAPI.Web/EliteAPI.Web.csproj b/EliteAPI.Web/EliteAPI.Web.csproj
index ea08a61b..646204c8 100644
--- a/EliteAPI.Web/EliteAPI.Web.csproj
+++ b/EliteAPI.Web/EliteAPI.Web.csproj
@@ -4,10 +4,10 @@
enable
default
netstandard2.0
- 3.0.15.0
- 3.0.15.0
- 3.0.15+54.Branch.main.Sha.70e812132018e1fd6aed105986a0a4e768ac07a8
- 3.0.15
+ 3.1.3.0
+ 3.1.3.0
+ 3.1.3+3.Branch.main.Sha.3f580569f82b353dc898f1e57a776f18dc2a597e
+ 3.1.3
diff --git a/EliteAPI/Bindings/BindingsParser.cs b/EliteAPI/Bindings/BindingsParser.cs
index d02302a4..777f57ac 100644
--- a/EliteAPI/Bindings/BindingsParser.cs
+++ b/EliteAPI/Bindings/BindingsParser.cs
@@ -27,21 +27,30 @@ public IReadOnlyCollection Parse(string xml)
var document = new XmlDocument();
document.LoadXml(xml);
var root = document.DocumentElement;
+
+ if(root == null)
+ throw new Exception("Could not find root");
var bindings = new List();
for (var i = 0; i < root?.ChildNodes.Count; i++)
{
- var node = root.ChildNodes.Item(i);
-
- bindings.Add(ParseNode(node));
+ var node = root.ChildNodes.Item(i)!;
+
+ try
+ {
+ bindings.Add(ParseNode(node));
+ } catch (Exception ex)
+ {
+ _log?.LogWarning(ex, "Failed to parse binding {NodeName}", node.Name);
+ }
}
return bindings;
}
catch (Exception ex)
{
- _log?.LogError(ex, "Failed to parse bindings");
+ _log?.LogWarning(ex, "Failed to parse bindings");
return Array.Empty();
}
}
@@ -97,8 +106,8 @@ private Binding ParseNode(XmlNode node)
var modifiers = modifierNodes.Any() ? modifierNodes.Select(modifierNode => new ModifierBinding(modifierNode.Attributes?["Key"].Value,modifierNode.Attributes?["Device"].Value)) : Array.Empty();
return (
- node.Attributes["Key"].Value,
- node.Attributes["Device"].Value,
+ node.Attributes?["Key"]?.Value ?? "",
+ node.Attributes?["Device"]?.Value ?? "",
modifiers.ToArray()
);
}
diff --git a/EliteAPI/EliteAPI.csproj b/EliteAPI/EliteAPI.csproj
index 7a9997d1..c33b1f7d 100644
--- a/EliteAPI/EliteAPI.csproj
+++ b/EliteAPI/EliteAPI.csproj
@@ -1,7 +1,7 @@
- 3.0.15.0
- 3.0.15.0
+ 3.1.3.0
+ 3.1.3.0
https://github.com/EliteAPI/EliteAPI
https://github.com/EliteAPI/EliteAPI
@@ -11,14 +11,14 @@
A powerful event based .NET API for Elite: Dangerous
© Somfic 2022
false
- 3.0.15
+ 3.1.3
true
icon.png
true
10
true
Somfic
- 3.0.15+54.Branch.main.Sha.70e812132018e1fd6aed105986a0a4e768ac07a8
+ 3.1.3+3.Branch.main.Sha.3f580569f82b353dc898f1e57a776f18dc2a597e
enable
netstandard2.0
diff --git a/EliteAPI/EliteDangerousApi.cs b/EliteAPI/EliteDangerousApi.cs
index 273dec86..dbf56a2e 100644
--- a/EliteAPI/EliteDangerousApi.cs
+++ b/EliteAPI/EliteDangerousApi.cs
@@ -121,7 +121,7 @@ public async Task StartAsync()
try
{
- _log?.LogInformation("Starting EliteAPI v{Version}", typeof(EliteDangerousApi).Assembly.GetName().Version);
+ _log?.LogDebug("Starting EliteAPI v{Version}", typeof(EliteDangerousApi).Assembly.GetName().Version);
_journalsDirectory = new DirectoryInfo(Config.JournalsPath);
_optionsDirectory = new DirectoryInfo(Config.OptionsPath);
diff --git a/EliteAPI/Events/Events.cs b/EliteAPI/Events/Events.cs
index 02e1515a..e6282387 100644
--- a/EliteAPI/Events/Events.cs
+++ b/EliteAPI/Events/Events.cs
@@ -206,7 +206,7 @@ public IEvent Invoke(TEvent @event, EventContext context) where TEvent :
}
///
- public IEvent Invoke(string json, EventContext context)
+ public IEvent? Invoke(string json, EventContext context)
{
try
{
@@ -241,7 +241,7 @@ public IEvent Invoke(string json, EventContext context)
InvokeAnyHandlers(eventType, json, context);
if (eventType == null)
- throw new Exception($"The {eventName} event is not registered"); // todo: better exception type
+ return null;
var parsedEvent = _eventParser.FromJson(eventType, json);
diff --git a/Examples/Example.Web/Example.Web.csproj b/Examples/Example.Web/Example.Web.csproj
index 0599b6d5..f3c746e0 100644
--- a/Examples/Example.Web/Example.Web.csproj
+++ b/Examples/Example.Web/Example.Web.csproj
@@ -5,10 +5,10 @@
enable
enable
false
- 3.0.15.0
- 3.0.15.0
- 3.0.15+54.Branch.main.Sha.70e812132018e1fd6aed105986a0a4e768ac07a8
- 3.0.15
+ 3.1.3.0
+ 3.1.3.0
+ 3.1.3+3.Branch.main.Sha.3f580569f82b353dc898f1e57a776f18dc2a597e
+ 3.1.3
diff --git a/Examples/Example.Web/Program.cs b/Examples/Example.Web/Program.cs
index ef77edd9..e569e360 100644
--- a/Examples/Example.Web/Program.cs
+++ b/Examples/Example.Web/Program.cs
@@ -38,4 +38,5 @@
{
Console.WriteLine(string.Join(", ", r.Bodies.Select(x => x.SystemName)));
},
- error: e => Console.WriteLine(e.Message));
\ No newline at end of file
+ error: e => Console.WriteLine(e.Message));
+
\ No newline at end of file
diff --git a/Examples/Example/Example.csproj b/Examples/Example/Example.csproj
index 3bebecc2..6a0b8eff 100644
--- a/Examples/Example/Example.csproj
+++ b/Examples/Example/Example.csproj
@@ -2,10 +2,10 @@
enable
enable
- 3.0.15.0
- 3.0.15.0
- 3.0.15+54.Branch.main.Sha.70e812132018e1fd6aed105986a0a4e768ac07a8
- 3.0.15
+ 3.1.3.0
+ 3.1.3.0
+ 3.1.3+3.Branch.main.Sha.3f580569f82b353dc898f1e57a776f18dc2a597e
+ 3.1.3
false
10
Exe
@@ -17,8 +17,6 @@
-
-