diff --git a/.editorconfig b/.editorconfig
index e0a8988..81a6f6b 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -18,7 +18,7 @@ insert_final_newline = false
# Organize usings
dotnet_separate_import_directive_groups = true
-file_header_template = --------------------------------------------------------------------------------------------------------------------\n\nOpenSky project 2021\n\n--------------------------------------------------------------------------------------------------------------------
+file_header_template = --------------------------------------------------------------------------------------------------------------------\n\nOpenSky project 2021-2022\n\n--------------------------------------------------------------------------------------------------------------------
# this. and Me. preferences
dotnet_style_qualification_for_event = true:suggestion
diff --git a/Installer/Installer.wixproj b/Installer/Installer.wixproj
index 127f53e..3b8eeeb 100644
--- a/Installer/Installer.wixproj
+++ b/Installer/Installer.wixproj
@@ -6,7 +6,7 @@
3.10
853790e9-5caa-4ebc-b4c3-c563c3242f1d
2.0
- OpenSky.AgentMSFS
+ OpenSky.Agent
Package
@@ -58,7 +58,7 @@
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.-->
-
+
@@ -84,7 +84,7 @@
- "..\..\StellarHeat\DevToolkit.StellarHeat.exe" -dr:INSTALLFOLDER -cg:OpenSky.AgentMSFS.Libraries -dir:"..\..\..\OpenSky.AgentMSFS\bin\$(Configuration)" -out:"..\..\Libraries.wxs"
+ "..\..\StellarHeat\DevToolkit.StellarHeat.exe" -dr:INSTALLFOLDER -cg:OpenSky.Agent.Libraries -dir:"..\..\..\OpenSky.Agent\bin\$(Configuration)" -out:"..\..\Libraries.wxs"
"C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe" dir "..\..\..\SoundPacks" -o "..\..\SoundPacks.wxs" -cg OpenSky.SoundPacks -sfrag -gg -suid -dr INSTALLFOLDER -var var.SoundPackSourceFolder -v -t ..\..\win64.xslt
\ No newline at end of file
diff --git a/Installer/Product.wxs b/Installer/Product.wxs
index ffdf22d..63f0983 100644
--- a/Installer/Product.wxs
+++ b/Installer/Product.wxs
@@ -2,9 +2,9 @@
-
+
-
+
@@ -15,20 +15,20 @@
-
-
-
+
+
+
-
+
-
+
-
+
-
-
-
+
+
+
-
-
+
+
@@ -55,7 +55,7 @@
-
+
diff --git a/OpenSky.AgentMSFS/SimConnect/Enums/ClientEvents.cs b/OpenSky.Agent.SimConnectMSFS/Enums/ClientEvents.cs
similarity index 95%
rename from OpenSky.AgentMSFS/SimConnect/Enums/ClientEvents.cs
rename to OpenSky.Agent.SimConnectMSFS/Enums/ClientEvents.cs
index fa14fd1..9c71906 100644
--- a/OpenSky.AgentMSFS/SimConnect/Enums/ClientEvents.cs
+++ b/OpenSky.Agent.SimConnectMSFS/Enums/ClientEvents.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Enums
+namespace OpenSky.Agent.SimConnectMSFS.Enums
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/SimConnect/Enums/CrashSequence.cs b/OpenSky.Agent.SimConnectMSFS/Enums/CrashSequence.cs
similarity index 94%
rename from OpenSky.AgentMSFS/SimConnect/Enums/CrashSequence.cs
rename to OpenSky.Agent.SimConnectMSFS/Enums/CrashSequence.cs
index 4cdfa19..930b277 100644
--- a/OpenSky.AgentMSFS/SimConnect/Enums/CrashSequence.cs
+++ b/OpenSky.Agent.SimConnectMSFS/Enums/CrashSequence.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Enums
+namespace OpenSky.Agent.SimConnectMSFS.Enums
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.Agent.SimConnectMSFS/OpenSky.Agent.SimConnectMSFS.csproj b/OpenSky.Agent.SimConnectMSFS/OpenSky.Agent.SimConnectMSFS.csproj
new file mode 100644
index 0000000..0869344
--- /dev/null
+++ b/OpenSky.Agent.SimConnectMSFS/OpenSky.Agent.SimConnectMSFS.csproj
@@ -0,0 +1,114 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {1F9CBEDE-669D-4510-BCA2-E6AD29D6A498}
+ Library
+ Properties
+ OpenSky.Agent.SimConnectMSFS
+ OpenSky.Agent.SimConnectMSFS
+ v4.8
+ 512
+ true
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ bin\Debug\OpenSky.Agent.SimConnectMSFS.xml
+ latest
+ x64
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ bin\Release\OpenSky.Agent.SimConnectMSFS.xml
+ latest
+ x64
+
+
+
+ ..\packages\CTrue.FsConnect.1.3.3\lib\net45\CTrue.FsConnect.dll
+
+
+ ..\packages\JetBrains.Annotations.2021.3.0\lib\net20\JetBrains.Annotations.dll
+
+
+ ..\packages\CTrue.FsConnect.1.3.3\lib\net45\Microsoft.FlightSimulator.SimConnect.dll
+
+
+ ..\packages\Microsoft.Maps.MapControl.WPF.1.0.0.3\lib\net40-Client\Microsoft.Maps.MapControl.WPF.dll
+
+
+ ..\packages\OpenSky.FlightLogXML.0.1.5\lib\net48\OpenSky.FlightLogXML.dll
+
+
+ ..\packages\MSFT.ParallelExtensionsExtras.1.2.0\lib\ParallelExtensionsExtras.dll
+
+
+ ..\packages\Serilog.2.10.0\lib\net46\Serilog.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {30c467e8-2eee-41e5-be01-0142a61ba171}
+ OpenSky.Agent.Simulator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OpenSky.Agent.SimConnectMSFS/OpenSky.Agent.SimConnectMSFS.csproj.DotSettings b/OpenSky.Agent.SimConnectMSFS/OpenSky.Agent.SimConnectMSFS.csproj.DotSettings
new file mode 100644
index 0000000..4887f94
--- /dev/null
+++ b/OpenSky.Agent.SimConnectMSFS/OpenSky.Agent.SimConnectMSFS.csproj.DotSettings
@@ -0,0 +1,2 @@
+
+ CSharp100
\ No newline at end of file
diff --git a/OpenSky.Agent.SimConnectMSFS/Properties/AssemblyInfo.cs b/OpenSky.Agent.SimConnectMSFS/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..dfcb19a
--- /dev/null
+++ b/OpenSky.Agent.SimConnectMSFS/Properties/AssemblyInfo.cs
@@ -0,0 +1,21 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("OpenSky.Agent.SimConnectMSFS")]
+[assembly: AssemblyDescription("OpenSky Agent SimConnect Library for MSFS 2020")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("OpenSky")]
+[assembly: AssemblyProduct("OpenSky")]
+[assembly: AssemblyCopyright("OpenSky project 2021-2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: ComVisible(false)]
+[assembly: Guid("1f9cbede-669d-4510-bca2-e6ad29d6a498")]
+[assembly: AssemblyVersion("0.4.0")]
+[assembly: AssemblyFileVersion("0.4.0")]
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/SimConnect/SimConnect.cs b/OpenSky.Agent.SimConnectMSFS/SimConnect.cs
similarity index 52%
rename from OpenSky.AgentMSFS/SimConnect/SimConnect.cs
rename to OpenSky.Agent.SimConnectMSFS/SimConnect.cs
index 9354903..aab1042 100644
--- a/OpenSky.AgentMSFS/SimConnect/SimConnect.cs
+++ b/OpenSky.Agent.SimConnectMSFS/SimConnect.cs
@@ -1,38 +1,38 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect
+namespace OpenSky.Agent.SimConnectMSFS
{
using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Runtime.CompilerServices;
using System.Threading;
- using System.Windows;
using CTrue.FsConnect;
- using OpenSky.AgentMSFS.Properties;
-
using JetBrains.Annotations;
- using Microsoft.Maps.MapControl.WPF;
-
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.SimConnect.Enums;
- using OpenSky.AgentMSFS.SimConnect.Helpers;
- using OpenSky.AgentMSFS.SimConnect.Structs;
- using OpenSky.AgentMSFS.Tools;
- using OpenSky.FlightLogXML;
-
- using TrackingEventLogEntry = Models.TrackingEventLogEntry;
+ using OpenSky.Agent.SimConnectMSFS.Enums;
+ using OpenSky.Agent.SimConnectMSFS.Structs;
+ using OpenSky.Agent.Simulator;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Models;
+ using OpenSky.Agent.Simulator.Tools;
+
+ using OpenSkyApi;
+
+ using AircraftIdentity = OpenSky.Agent.SimConnectMSFS.Structs.AircraftIdentity;
+ using FuelTanks = OpenSky.Agent.SimConnectMSFS.Structs.FuelTanks;
+ using LandingAnalysis = OpenSky.Agent.SimConnectMSFS.Structs.LandingAnalysis;
+ using PayloadStations = OpenSky.Agent.SimConnectMSFS.Structs.PayloadStations;
+ using PrimaryTracking = OpenSky.Agent.SimConnectMSFS.Structs.PrimaryTracking;
+ using SecondaryTracking = OpenSky.Agent.SimConnectMSFS.Structs.SecondaryTracking;
+ using Simulator = OpenSky.Agent.Simulator.Simulator;
+ using SlewAircraftIntoPosition = OpenSky.Agent.SimConnectMSFS.Structs.SlewAircraftIntoPosition;
+ using WeightAndBalance = OpenSky.Agent.SimConnectMSFS.Structs.WeightAndBalance;
/// -------------------------------------------------------------------------------------------------
///
@@ -42,7 +42,7 @@ namespace OpenSky.AgentMSFS.SimConnect
/// sushi.at, 13/03/2021.
///
/// -------------------------------------------------------------------------------------------------
- public partial class SimConnect : INotifyPropertyChanged
+ public partial class SimConnect : Simulator
{
/// -------------------------------------------------------------------------------------------------
///
@@ -53,100 +53,17 @@ public partial class SimConnect : INotifyPropertyChanged
/// -------------------------------------------------------------------------------------------------
///
- /// Set to true to close the client.
- ///
- /// -------------------------------------------------------------------------------------------------
- private bool close;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// True if we are connected via SimConnect.
- ///
- /// -------------------------------------------------------------------------------------------------
- private bool connected;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The last fuel tanks info received from the sim.
- ///
- /// -------------------------------------------------------------------------------------------------
- private FuelTanks fuelTanks;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The last landing analysis info received from the sim.
- ///
- /// -------------------------------------------------------------------------------------------------
- private LandingAnalysis landingAnalysis;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The time the last pause started.
- ///
- /// -------------------------------------------------------------------------------------------------
- private DateTime? pauseStarted;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The last payload stations info received from the sim.
- ///
- /// -------------------------------------------------------------------------------------------------
- private PayloadStations payloadStations;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The last plane identity info received from the sim.
- ///
- /// -------------------------------------------------------------------------------------------------
- private PlaneIdentity planeIdentity;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The last primary tracking info received from the sim.
+ /// Name of the simulator host.
///
/// -------------------------------------------------------------------------------------------------
- private PrimaryTracking primaryTracking;
+ private readonly string simulatorHostName;
/// -------------------------------------------------------------------------------------------------
///
- /// The last plane systems info received from the sim.
+ /// The simulator port.
///
/// -------------------------------------------------------------------------------------------------
- private SecondaryTracking secondaryTracking;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The last slew plane into position info received from the sim.
- ///
- /// -------------------------------------------------------------------------------------------------
- private SlewPlaneIntoPosition slewPlaneIntoPosition;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The total paused timespan.
- ///
- /// -------------------------------------------------------------------------------------------------
- private TimeSpan totalPaused = TimeSpan.Zero;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The last weight and balance info received from the sim.
- ///
- /// -------------------------------------------------------------------------------------------------
- private WeightAndBalance weightAndBalance;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Initializes static members of the class.
- ///
- ///
- /// sushi.at, 17/03/2021.
- ///
- /// -------------------------------------------------------------------------------------------------
- static SimConnect()
- {
- Instance = new SimConnect();
- }
+ private readonly uint simulatorPort;
/// -------------------------------------------------------------------------------------------------
///
@@ -155,43 +72,20 @@ static SimConnect()
///
/// sushi.at, 13/03/2021.
///
+ ///
+ /// Name of the simulator host.
+ ///
+ ///
+ /// The simulator port.
+ ///
+ ///
+ /// The OpenSky service instance.
+ ///
/// -------------------------------------------------------------------------------------------------
- private SimConnect()
+ public SimConnect(string simulatorHostName, uint simulatorPort, OpenSkyService openSkyServiceInstance) : base(openSkyServiceInstance)
{
- // Default values and init data structures
- this.SampleRates = new ObservableConcurrentDictionary
- {
- { Requests.Primary, 50 },
- { Requests.Secondary, 500 },
- { Requests.FuelTanks, 15000 },
- { Requests.PayloadStations, 15000 },
- { Requests.PlaneIdentity, 15000 },
- { Requests.WeightAndBalance, 15000 },
- { Requests.LandingAnalysis, 500 }
- };
-
- this.LastReceivedTimes = new ObservableConcurrentDictionary();
- foreach (Requests request in Enum.GetValues(typeof(Requests)))
- {
- this.LastReceivedTimes.Add(request, null);
- }
-
- this.primaryTrackingProcessingQueue = new ConcurrentQueue();
- this.secondaryTrackingProcessingQueue = new ConcurrentQueue();
- this.landingAnalysisProcessingQueue = new ConcurrentQueue();
- this.AircraftTrailLocations = new LocationCollection();
- this.SimbriefRouteLocations = new LocationCollection();
- this.TrackingEventLogEntries = new ObservableCollection();
- this.LandingReports = new ObservableCollection();
- this.TrackingConditions = new Dictionary
- {
- { (int)Models.TrackingConditions.DateTime, new TrackingCondition { AutoSet = true } },
- { (int)Models.TrackingConditions.Fuel, new TrackingCondition { AutoSet = true } },
- { (int)Models.TrackingConditions.Payload, new TrackingCondition { AutoSet = true } },
- { (int)Models.TrackingConditions.PlaneModel, new TrackingCondition() },
- { (int)Models.TrackingConditions.RealismSettings, new TrackingCondition { Expected = "No slew, No unlimited fuel,\r\nCrash detection, SimRate=1" } },
- { (int)Models.TrackingConditions.Location, new TrackingCondition() }
- };
+ this.simulatorHostName = simulatorHostName;
+ this.simulatorPort = simulatorPort;
// Set up fsConnect client
this.fsConnect = new FsConnect { SimConnectFileLocation = SimConnectFileLocation.Local };
@@ -199,256 +93,33 @@ private SimConnect()
this.fsConnect.FsDataReceived += this.FsDataReceived;
this.fsConnect.PauseStateChanged += this.FsConnectPauseStateChanged;
- // Start our worker threads
+ // Start our worker thread
new Thread(this.ReadFromSimconnect) { Name = "SimConnect.ReadFromSim" }.Start();
- new Thread(this.ProcessPrimaryTracking) { Name = "SimConnect.ProcessPrimaryTracking" }.Start();
- new Thread(this.ProcessSecondaryTracking) { Name = "SimConnect.ProcessSecondaryTracking" }.Start();
- new Thread(this.ProcessLandingAnalysis) { Name = "SimConnect.ProcessLandingAnalysis" }.Start();
- }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Occurs when a property value changes.
- ///
- /// -------------------------------------------------------------------------------------------------
- public event PropertyChangedEventHandler PropertyChanged;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The single instance of the SimConnect class.
- ///
- /// -------------------------------------------------------------------------------------------------
- [NotNull]
- public static SimConnect Instance { get; }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets or sets a value indicating whether we are connected via SimConnect.
- ///
- /// -------------------------------------------------------------------------------------------------
- public bool Connected
- {
- get => this.connected;
-
- private set
- {
- if (Equals(this.connected, value))
- {
- return;
- }
-
- this.connected = value;
- this.OnPropertyChanged();
- }
- }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets the latest fuel tanks info.
- ///
- /// -------------------------------------------------------------------------------------------------
- public FuelTanks FuelTanks
- {
- get => this.fuelTanks;
-
- private set
- {
- if (Equals(this.fuelTanks, value))
- {
- return;
- }
-
- this.fuelTanks = value;
- this.OnPropertyChanged();
- }
- }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets a value indicating whether the sim is paused (proper pause, not ESC menu and definitely not active pause).
- ///
- /// -------------------------------------------------------------------------------------------------
- public bool IsPaused => this.fsConnect.Paused;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets the latest landing analysis.
- ///
- /// -------------------------------------------------------------------------------------------------
- public LandingAnalysis LandingAnalysis
- {
- get => this.landingAnalysis;
-
- private set
- {
- if (Equals(this.landingAnalysis, value))
- {
- return;
- }
-
- this.landingAnalysis = value;
- this.OnPropertyChanged();
- }
}
/// -------------------------------------------------------------------------------------------------
///
- /// The last received/request date times dictionary.
+ /// Gets the name of the simulator interface.
///
/// -------------------------------------------------------------------------------------------------
- public ObservableConcurrentDictionary LastReceivedTimes { get; }
+ public static string SimulatorInterfaceName => "SimConnectMSFS";
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the latest payload stations info.
+ /// Gets a value indicating whether the sim is paused (proper pause, not ESC menu and definitely
+ /// not active pause).
///
+ ///
/// -------------------------------------------------------------------------------------------------
- public PayloadStations PayloadStations
- {
- get => this.payloadStations;
-
- private set
- {
- if (Equals(this.payloadStations, value))
- {
- return;
- }
-
- this.payloadStations = value;
- this.OnPropertyChanged();
- }
- }
+ public override bool IsPaused => this.fsConnect.Paused;
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the latest plane identity info.
+ /// Gets the type of the simulator.
///
+ ///
/// -------------------------------------------------------------------------------------------------
- public PlaneIdentity PlaneIdentity
- {
- get => this.planeIdentity;
-
- private set
- {
- if (Equals(this.planeIdentity, value))
- {
- return;
- }
-
- this.planeIdentity = value;
- this.OnPropertyChanged();
- }
- }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets the latest primary tracking info.
- ///
- /// -------------------------------------------------------------------------------------------------
- public PrimaryTracking PrimaryTracking
- {
- get => this.primaryTracking;
-
- private set
- {
- if (Equals(this.primaryTracking, value))
- {
- return;
- }
-
- this.primaryTracking = value;
- this.OnPropertyChanged();
- }
- }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The sample rates/request dictionary.
- ///
- /// -------------------------------------------------------------------------------------------------
- public ObservableConcurrentDictionary SampleRates { get; }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets the latest secondary tracking info.
- ///
- /// -------------------------------------------------------------------------------------------------
- public SecondaryTracking SecondaryTracking
- {
- get => this.secondaryTracking;
-
- private set
- {
- if (Equals(this.secondaryTracking, value))
- {
- return;
- }
-
- this.secondaryTracking = value;
- this.OnPropertyChanged();
- }
- }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets or sets the latest slew plane into position.
- ///
- /// -------------------------------------------------------------------------------------------------
- public SlewPlaneIntoPosition SlewPlaneIntoPosition
- {
- get => this.slewPlaneIntoPosition;
-
- set
- {
- if (Equals(this.slewPlaneIntoPosition, value))
- {
- return;
- }
-
- this.slewPlaneIntoPosition = value;
- this.OnPropertyChanged();
- }
- }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets the latest weight and balance info.
- ///
- /// -------------------------------------------------------------------------------------------------
- public WeightAndBalance WeightAndBalance
- {
- get => this.weightAndBalance;
-
- private set
- {
- if (Equals(this.weightAndBalance, value))
- {
- return;
- }
-
- this.weightAndBalance = value;
- this.OnPropertyChanged();
- }
- }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Close all connections and dispose the client.
- ///
- ///
- /// sushi.at, 13/03/2021.
- ///
- /// -------------------------------------------------------------------------------------------------
- public void Close()
- {
- Debug.WriteLine("SimConnect closing down...");
- if (this.TrackingStatus is TrackingStatus.GroundOperations or TrackingStatus.Tracking)
- {
- this.StopTracking(false);
- }
-
- this.close = true;
- }
+ public override OpenSkyApi.Simulator SimulatorType => OpenSkyApi.Simulator.MSFS;
/// -------------------------------------------------------------------------------------------------
///
@@ -463,8 +134,9 @@ public void Close()
///
/// True to pause, false to un-pause.
///
+ ///
/// -------------------------------------------------------------------------------------------------
- public void Pause(bool pause)
+ public override void Pause(bool pause)
{
if (this.fsConnect.Connected)
{
@@ -479,48 +151,35 @@ public void Pause(bool pause)
/// -------------------------------------------------------------------------------------------------
///
- /// Refresh SimConnect with the specified request ID now.
+ /// Sets the aircraft registration in the simulator.
///
///
- /// sushi.at, 20/03/2021.
+ /// sushi.at, 31/01/2022.
///
- ///
- /// The request ID.
+ ///
+ /// Thrown when an exception error condition occurs.
+ ///
+ ///
+ /// The registry to set.
///
+ ///
/// -------------------------------------------------------------------------------------------------
- public void RefreshStructNow(Requests request)
+ public override void SetAircraftRegistry(string registry)
{
- this.LastReceivedTimes[request] = null;
- }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Replay simbrief waypoint and tracking event markers (new tracking view was opened).
- ///
- ///
- /// sushi.at, 18/03/2021.
- ///
- /// -------------------------------------------------------------------------------------------------
- public void ReplayMapMarkers()
- {
- Debug.WriteLine("SimConnect is replaying map markers to listeners...");
-
- UpdateGUIDelegate restoreMarkers = () =>
+ if (string.IsNullOrEmpty(registry))
{
- foreach (var waypointMarker in this.simbriefWaypointMarkers)
- {
- this.SimbriefWaypointMarkerAdded?.Invoke(this, waypointMarker);
- }
+ return;
+ }
- lock (this.trackingEventMarkers)
- {
- foreach (var trackingEventMarker in this.trackingEventMarkers)
- {
- this.TrackingEventMarkerAdded?.Invoke(this, trackingEventMarker);
- }
- }
- };
- Application.Current.Dispatcher.BeginInvoke(restoreMarkers);
+ if (this.fsConnect.Connected)
+ {
+ var planeRegistry = new PlaneRegistry { AtcID = registry };
+ this.fsConnect.UpdateData(Requests.PlaneRegistry, planeRegistry);
+ }
+ else
+ {
+ throw new Exception("Not connected to sim!");
+ }
}
/// -------------------------------------------------------------------------------------------------
@@ -533,21 +192,22 @@ public void ReplayMapMarkers()
///
/// Thrown when an exception error condition occurs.
///
+ ///
/// -------------------------------------------------------------------------------------------------
- public void SetFuelAndPayloadFromSave()
+ public override void SetFuelAndPayloadFromSave()
{
if (this.fsConnect.Connected)
{
- if (this.flightLoadingTempStructs == null)
+ if (this.flightLoadingTempModels == null)
{
throw new Exception("No restored fuel and payload station values found.");
}
Debug.WriteLine("SimConnect setting fuel and payload stations from temp structs restored from save");
- this.fsConnect.UpdateData(Requests.FuelTanks, this.flightLoadingTempStructs.FuelTanks);
- this.fsConnect.UpdateData(Requests.PayloadStations, this.flightLoadingTempStructs.PayloadStations);
- this.RefreshStructNow(Requests.FuelTanks);
- this.RefreshStructNow(Requests.PayloadStations);
+ this.fsConnect.UpdateData(Requests.FuelTanks, this.flightLoadingTempModels.FuelTanks.ConvertBack());
+ this.fsConnect.UpdateData(Requests.PayloadStations, this.flightLoadingTempModels.PayloadStations.ConvertBack());
+ this.RefreshModelNow(Requests.FuelTanks);
+ this.RefreshModelNow(Requests.PayloadStations);
}
else
{
@@ -562,17 +222,21 @@ public void SetFuelAndPayloadFromSave()
///
/// sushi.at, 19/03/2021.
///
+ ///
+ /// Thrown when an exception error condition occurs.
+ ///
///
/// The new fuel tank quantities to set.
///
+ ///
/// -------------------------------------------------------------------------------------------------
- public void SetFuelTanks(FuelTanks newFuelTanks)
+ public override void SetFuelTanks(Agent.Simulator.Models.FuelTanks newFuelTanks)
{
if (this.fsConnect.Connected)
{
Debug.WriteLine("SimConnect setting fuel tanks");
- this.fsConnect.UpdateData(Requests.FuelTanks, newFuelTanks);
- this.RefreshStructNow(Requests.FuelTanks);
+ this.fsConnect.UpdateData(Requests.FuelTanks, newFuelTanks.ConvertBack());
+ this.RefreshModelNow(Requests.FuelTanks);
}
else
{
@@ -587,17 +251,21 @@ public void SetFuelTanks(FuelTanks newFuelTanks)
///
/// sushi.at, 19/03/2021.
///
+ ///
+ /// Thrown when an exception error condition occurs.
+ ///
///
/// The new payload station weights to set.
///
+ ///
/// -------------------------------------------------------------------------------------------------
- public void SetPayloadStations(PayloadStations newPayloadStations)
+ public override void SetPayloadStations(Agent.Simulator.Models.PayloadStations newPayloadStations)
{
if (this.fsConnect.Connected)
{
Debug.WriteLine("SimConnect setting payload stations");
- this.fsConnect.UpdateData(Requests.PayloadStations, newPayloadStations);
- this.RefreshStructNow(Requests.PayloadStations);
+ this.fsConnect.UpdateData(Requests.PayloadStations, newPayloadStations.ConvertBack());
+ this.RefreshModelNow(Requests.PayloadStations);
}
else
{
@@ -607,48 +275,20 @@ public void SetPayloadStations(PayloadStations newPayloadStations)
/// -------------------------------------------------------------------------------------------------
///
- /// Sets plane registry in the sim.
+ /// Sets slew to on or off.
///
///
- /// sushi.at, 02/04/2021.
+ /// sushi.at, 31/03/2021.
///
///
/// Thrown when an exception error condition occurs.
///
- ///
- /// The registry to set.
- ///
- /// -------------------------------------------------------------------------------------------------
- public void SetPlaneRegistry(string registry)
- {
- if (string.IsNullOrEmpty(registry))
- {
- return;
- }
-
- if (this.fsConnect.Connected)
- {
- var planeRegistry = new PlaneRegistry { AtcID = registry };
- this.fsConnect.UpdateData(Requests.PlaneRegistry, planeRegistry);
- }
- else
- {
- throw new Exception("Not connected to sim!");
- }
- }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Sets slew to on or off.
- ///
- ///
- /// sushi.at, 31/03/2021.
- ///
///
/// True to enable, false to disable.
///
+ ///
/// -------------------------------------------------------------------------------------------------
- public void SetSlew(bool enable)
+ public override void SetSlew(bool enable)
{
if (this.fsConnect.Connected)
{
@@ -660,8 +300,6 @@ public void SetSlew(bool enable)
}
}
-
-
/// -------------------------------------------------------------------------------------------------
///
/// Sets the UTC time in the sim.
@@ -669,11 +307,15 @@ public void SetSlew(bool enable)
///
/// sushi.at, 31/03/2021.
///
+ ///
+ /// Thrown when an exception error condition occurs.
+ ///
///
/// The new UTC time.
///
+ ///
/// -------------------------------------------------------------------------------------------------
- public void SetTime(DateTime time)
+ public override void SetTime(DateTime time)
{
if (this.fsConnect.Connected)
{
@@ -699,9 +341,10 @@ public void SetTime(DateTime time)
///
/// Thrown when an exception error condition occurs.
///
+ ///
/// -------------------------------------------------------------------------------------------------
[SuppressMessage("ReSharper", "PossibleNullReferenceException")]
- public void SlewPlaneToFlightPosition()
+ public override void SlewPlaneToFlightPosition()
{
if (this.fsConnect.Connected)
{
@@ -728,7 +371,7 @@ public void SlewPlaneToFlightPosition()
throw new Exception("Timeout waiting for sim data response!");
}
- var slewTo = this.SlewPlaneIntoPosition;
+ var slewTo = this.SlewAircraftIntoPosition;
if (!this.PrimaryTracking.OnGround || this.PrimaryTracking.GroundSpeed > 0)
{
throw new Exception("Plane needs to be stationary on the ground for this!");
@@ -741,11 +384,11 @@ public void SlewPlaneToFlightPosition()
slewTo.Latitude = this.Flight.Origin.Latitude;
slewTo.Longitude = this.Flight.Origin.Longitude;
- this.fsConnect.UpdateData(Requests.SlewPlaneIntoPosition, slewTo);
+ this.fsConnect.UpdateData(Requests.SlewPlaneIntoPosition, slewTo.ConvertBack());
}
else
{
- if (this.flightLoadingTempStructs == null)
+ if (this.flightLoadingTempModels == null)
{
throw new Exception("No resume position available.");
}
@@ -755,7 +398,7 @@ public void SlewPlaneToFlightPosition()
this.SetSlew(true);
}
- this.fsConnect.UpdateData(Requests.SlewPlaneIntoPosition, this.flightLoadingTempStructs.SlewPlaneIntoPosition);
+ this.fsConnect.UpdateData(Requests.SlewPlaneIntoPosition, this.flightLoadingTempModels.SlewAircraftIntoPosition.ConvertBack());
}
}
else
@@ -764,23 +407,6 @@ public void SlewPlaneToFlightPosition()
}
}
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Executes the property changed action.
- ///
- ///
- /// sushi.at, 13/03/2021.
- ///
- ///
- /// (Optional) Name of the property.
- ///
- /// -------------------------------------------------------------------------------------------------
- [NotifyPropertyChangedInvocator]
- protected virtual void OnPropertyChanged([CallerMemberName][CanBeNull] string propertyName = null)
- {
- this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
-
/// -------------------------------------------------------------------------------------------------
///
/// File system connection changed.
@@ -864,45 +490,48 @@ private void FsDataReceived(object sender, FsDataReceivedEventArgs e)
{
if (simConnectObject is PrimaryTracking isPrimaryTracking)
{
- this.primaryTrackingProcessingQueue.Enqueue(new ProcessPrimaryTracking { Old = this.PrimaryTracking, New = isPrimaryTracking });
+ var converted = isPrimaryTracking.Convert();
+ this.primaryTrackingProcessingQueue.Enqueue(new ProcessPrimaryTracking { Old = this.PrimaryTracking, New = converted });
this.OnPropertyChanged(nameof(this.PrimaryTrackingProcessingQueueLength));
- this.PrimaryTracking = isPrimaryTracking;
+ this.PrimaryTracking = converted;
this.LastReceivedTimes[Requests.Primary] = DateTime.UtcNow;
}
if (simConnectObject is SecondaryTracking isSecondaryTracking)
{
- this.secondaryTrackingProcessingQueue.Enqueue(new ProcessSecondaryTracking { Old = this.SecondaryTracking, New = isSecondaryTracking });
+ var converted = isSecondaryTracking.Convert();
+ this.secondaryTrackingProcessingQueue.Enqueue(new ProcessSecondaryTracking { Old = this.SecondaryTracking, New = converted });
this.OnPropertyChanged(nameof(this.SecondaryTrackingProcessingQueueLength));
- this.SecondaryTracking = isSecondaryTracking;
+ this.SecondaryTracking = converted;
this.LastReceivedTimes[Requests.Secondary] = DateTime.UtcNow;
}
if (simConnectObject is FuelTanks isFuelTanks)
{
- this.FuelTanks = isFuelTanks;
+ this.FuelTanks = isFuelTanks.Convert();
this.LastReceivedTimes[Requests.FuelTanks] = DateTime.UtcNow;
}
if (simConnectObject is PayloadStations isPayloadStations)
{
new Thread(
- () =>
- {
- this.ProcessPayloadStations(this.PayloadStations, isPayloadStations);
- this.PayloadStations = isPayloadStations;
- })
- { Name = "OpenSky.ProcessPayloadStations" }.Start();
+ () =>
+ {
+ var converted = isPayloadStations.Convert();
+ this.ProcessPayloadStations(this.PayloadStations, converted);
+ this.PayloadStations = converted;
+ })
+ { Name = "OpenSky.ProcessPayloadStations" }.Start();
this.LastReceivedTimes[Requests.PayloadStations] = DateTime.UtcNow;
}
- if (simConnectObject is PlaneIdentity isPlaneIdentity)
+ if (simConnectObject is AircraftIdentity isPlaneIdentity)
{
- this.PlaneIdentity = isPlaneIdentity;
+ this.AircraftIdentity = isPlaneIdentity.Convert();
this.LastReceivedTimes[Requests.PlaneIdentity] = DateTime.UtcNow;
- new Thread(this.ProcessPlaneIdentity) { Name = "OpenSky.ProcessPlaneIdentity" }.Start();
+ new Thread(this.ProcessAircraftIdentity) { Name = "OpenSky.ProcessAircraftIdentity" }.Start();
}
if (simConnectObject is WeightAndBalance isWeightAndBalance)
@@ -910,25 +539,27 @@ private void FsDataReceived(object sender, FsDataReceivedEventArgs e)
new Thread(
() =>
{
- this.ProcessWeightAndBalance(this.WeightAndBalance, isWeightAndBalance);
- this.WeightAndBalance = isWeightAndBalance;
+ var converted = isWeightAndBalance.Convert();
+ this.ProcessWeightAndBalance(this.WeightAndBalance, converted);
+ this.WeightAndBalance = converted;
})
- { Name = "OpenSky.ProcessWeightAndBalance" }.Start();
+ { Name = "OpenSky.ProcessWeightAndBalance" }.Start();
this.LastReceivedTimes[Requests.WeightAndBalance] = DateTime.UtcNow;
}
if (simConnectObject is LandingAnalysis isLandingAnalysis)
{
- this.landingAnalysisProcessingQueue.Enqueue(new ProcessLandingAnalysis { Old = this.LandingAnalysis, New = isLandingAnalysis });
+ var converted = isLandingAnalysis.Convert();
+ this.landingAnalysisProcessingQueue.Enqueue(new ProcessLandingAnalysis { Old = this.LandingAnalysis, New = converted });
this.OnPropertyChanged(nameof(this.LandingAnalysisProcessingQueueLength));
- this.LandingAnalysis = isLandingAnalysis;
+ this.LandingAnalysis = converted;
this.LastReceivedTimes[Requests.LandingAnalysis] = DateTime.UtcNow;
}
- if (simConnectObject is SlewPlaneIntoPosition isSlewPlaneIntoPosition)
+ if (simConnectObject is SlewAircraftIntoPosition isSlewPlaneIntoPosition)
{
- this.SlewPlaneIntoPosition = isSlewPlaneIntoPosition;
+ this.SlewAircraftIntoPosition = isSlewPlaneIntoPosition.Convert();
this.LastReceivedTimes[Requests.SlewPlaneIntoPosition] = DateTime.UtcNow;
}
}
@@ -953,17 +584,17 @@ private void ReadFromSimconnect()
{
try
{
- this.fsConnect.Connect("OpenSky.AgentMSFS.Primary", Settings.Default.SimulatorHostName, Settings.Default.SimulatorPort, SimConnectProtocol.Ipv4);
+ this.fsConnect.Connect("OpenSky.Agent.SimConnectMSFS.Primary", this.simulatorHostName, this.simulatorPort, SimConnectProtocol.Ipv4);
// Register struct data definitions
this.fsConnect.RegisterDataDefinition(Requests.Primary, PrimaryTrackingDefinition.Definition);
this.fsConnect.RegisterDataDefinition(Requests.Secondary, SecondaryTrackingDefinition.Definition);
this.fsConnect.RegisterDataDefinition(Requests.FuelTanks, FuelTanksDefinition.Definition);
this.fsConnect.RegisterDataDefinition(Requests.PayloadStations, PayloadStationsDefinition.Definition);
- this.fsConnect.RegisterDataDefinition(Requests.PlaneIdentity, PlaneIdentityDefinition.Definition);
+ this.fsConnect.RegisterDataDefinition(Requests.PlaneIdentity, AircraftIdentityDefinition.Definition);
this.fsConnect.RegisterDataDefinition(Requests.WeightAndBalance, WeightAndBalanceDefinition.Definition);
this.fsConnect.RegisterDataDefinition(Requests.LandingAnalysis, LandingAnalysisDefinition.Definition);
- this.fsConnect.RegisterDataDefinition(Requests.SlewPlaneIntoPosition, SlewPlaneIntoPositionDefinition.Definition);
+ this.fsConnect.RegisterDataDefinition(Requests.SlewPlaneIntoPosition, SlewAircraftIntoPositionDefinition.Definition);
this.fsConnect.RegisterDataDefinition(Requests.PlaneRegistry, PlaneRegistryDefinition.Definition);
// Register client events
@@ -985,7 +616,6 @@ private void ReadFromSimconnect()
veryFirstConnectError = false;
Debug.WriteLine("Error connecting to sim: " + ex);
}
-
}
}
@@ -1012,7 +642,6 @@ private void ReadFromSimconnect()
{
SleepScheduler.SleepFor(TimeSpan.FromSeconds(this.Flight == null ? 30 : 5));
}
-
}
catch (Exception ex)
{
diff --git a/OpenSky.AgentMSFS/SimConnect/Structs/PlaneIdentity.cs b/OpenSky.Agent.SimConnectMSFS/Structs/AircraftIdentity.cs
similarity index 75%
rename from OpenSky.AgentMSFS/SimConnect/Structs/PlaneIdentity.cs
rename to OpenSky.Agent.SimConnectMSFS/Structs/AircraftIdentity.cs
index 7eb7d06..8ff736d 100644
--- a/OpenSky.AgentMSFS/SimConnect/Structs/PlaneIdentity.cs
+++ b/OpenSky.Agent.SimConnectMSFS/Structs/AircraftIdentity.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Structs
+namespace OpenSky.Agent.SimConnectMSFS.Structs
{
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@@ -18,7 +18,7 @@ namespace OpenSky.AgentMSFS.SimConnect.Structs
/// -------------------------------------------------------------------------------------------------
///
- /// Plane identity struct.
+ /// Aircraft identity struct.
///
///
/// sushi.at, 20/03/2021.
@@ -26,7 +26,7 @@ namespace OpenSky.AgentMSFS.SimConnect.Structs
/// -------------------------------------------------------------------------------------------------
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Uppercase naming for struct variables/mixed with some being properties")]
- public struct PlaneIdentity
+ public struct AircraftIdentity
{
/// -------------------------------------------------------------------------------------------------
///
@@ -79,42 +79,56 @@ public struct PlaneIdentity
///
/// -------------------------------------------------------------------------------------------------
public bool GearRetractable { get; set; }
+ }
- // ==================================================================================================
- // END OF STRUCT PROPERTIES - BELOW ARE GET-ONLY COMPUTED PROPERTIES FOR OPENSKY
- // ==================================================================================================
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The plane type as property (for gui bindings).
- ///
- /// -------------------------------------------------------------------------------------------------
- public string TypeProperty => this.Type;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The ATC plane type as property (for gui bindings).
- ///
- /// -------------------------------------------------------------------------------------------------
- public string AtcTypeProperty => this.AtcType;
-
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Aircraft identity converter (simConnect struct to simulator model).
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static class AircraftIdentityConverter
+ {
/// -------------------------------------------------------------------------------------------------
///
- /// The ATC plane model as property (for gui bindings).
+ /// An AircraftIdentity extension method that converts the given aircraft identity.
///
- /// -------------------------------------------------------------------------------------------------
- public string AtcModelProperty => this.AtcModel;
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The identity to act on.
+ ///
+ ///
+ /// The simulator model aircraft identity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static Agent.Simulator.Models.AircraftIdentity Convert(this AircraftIdentity identity)
+ {
+ return new Agent.Simulator.Models.AircraftIdentity
+ {
+ Type = identity.Type,
+ EngineType = identity.EngineType,
+ EngineCount = identity.EngineCount,
+ AtcType = identity.AtcType,
+ AtcModel = identity.AtcModel,
+ FlapsAvailable = identity.FlapsAvailable,
+ GearRetractable = identity.GearRetractable
+ };
+ }
}
/// -------------------------------------------------------------------------------------------------
///
- /// The plane identity struct SimConnect properties definition.
+ /// The aircraft identity struct SimConnect properties definition.
///
///
/// sushi.at, 20/03/2021.
///
/// -------------------------------------------------------------------------------------------------
- public static class PlaneIdentityDefinition
+ public static class AircraftIdentityDefinition
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.Agent.SimConnectMSFS/Structs/FuelTanks.cs b/OpenSky.Agent.SimConnectMSFS/Structs/FuelTanks.cs
new file mode 100644
index 0000000..6bb0fb2
--- /dev/null
+++ b/OpenSky.Agent.SimConnectMSFS/Structs/FuelTanks.cs
@@ -0,0 +1,324 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace OpenSky.Agent.SimConnectMSFS.Structs
+{
+ using System.Collections.Generic;
+ using System.Runtime.InteropServices;
+
+ using CTrue.FsConnect;
+
+ using Microsoft.FlightSimulator.SimConnect;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Fuel tanks struct.
+ ///
+ ///
+ /// sushi.at, 17/03/2021.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
+ public struct FuelTanks
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank center capacity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankCenterCapacity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank center 2 capacity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankCenter2Capacity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank center 3 capacity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankCenter3Capacity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank left main capacity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankLeftMainCapacity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank left auxiliary capacity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankLeftAuxCapacity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank left tip capacity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankLeftTipCapacity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank right main capacity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankRightMainCapacity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank right auxiliary capacity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankRightAuxCapacity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank right tip capacity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankRightTipCapacity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank external 1 capacity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankExternal1Capacity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank external 2 capacity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankExternal2Capacity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank center quantity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankCenterQuantity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank center 2 quantity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankCenter2Quantity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank center 3 quantity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankCenter3Quantity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank left main quantity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankLeftMainQuantity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank left auxiliary quantity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankLeftAuxQuantity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank left tip quantity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankLeftTipQuantity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank right main quantity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankRightMainQuantity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank right auxiliary quantity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankRightAuxQuantity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank right tip quantity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankRightTipQuantity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank external 1 quantity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankExternal1Quantity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the fuel tank external 2 quantity.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTankExternal2Quantity { get; set; }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Fuel tanks converter (simConnect struct to simulator model).
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static class FuelTanksConverter
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The FuelTanks extension method that converts the given tanks struct.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The tanks to act on.
+ ///
+ ///
+ /// The simulator model fuel tanks.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static Simulator.Models.FuelTanks Convert(this FuelTanks tanks)
+ {
+ return new Simulator.Models.FuelTanks
+ {
+ FuelTankCenterCapacity = tanks.FuelTankCenterCapacity,
+ FuelTankCenter2Capacity = tanks.FuelTankCenter2Capacity,
+ FuelTankCenter3Capacity = tanks.FuelTankCenter3Capacity,
+ FuelTankLeftMainCapacity = tanks.FuelTankLeftMainCapacity,
+ FuelTankLeftAuxCapacity = tanks.FuelTankLeftAuxCapacity,
+ FuelTankLeftTipCapacity = tanks.FuelTankLeftTipCapacity,
+ FuelTankRightMainCapacity = tanks.FuelTankRightMainCapacity,
+ FuelTankRightAuxCapacity = tanks.FuelTankRightAuxCapacity,
+ FuelTankRightTipCapacity = tanks.FuelTankRightTipCapacity,
+ FuelTankExternal1Capacity = tanks.FuelTankExternal1Capacity,
+ FuelTankExternal2Capacity = tanks.FuelTankExternal2Capacity,
+
+ FuelTankCenterQuantity = tanks.FuelTankCenterQuantity,
+ FuelTankCenter2Quantity = tanks.FuelTankCenter2Quantity,
+ FuelTankCenter3Quantity = tanks.FuelTankCenter3Quantity,
+ FuelTankLeftMainQuantity = tanks.FuelTankLeftMainQuantity,
+ FuelTankLeftAuxQuantity = tanks.FuelTankLeftAuxQuantity,
+ FuelTankLeftTipQuantity = tanks.FuelTankLeftTipQuantity,
+ FuelTankRightMainQuantity = tanks.FuelTankRightMainQuantity,
+ FuelTankRightAuxQuantity = tanks.FuelTankRightAuxQuantity,
+ FuelTankRightTipQuantity = tanks.FuelTankRightTipQuantity,
+ FuelTankExternal1Quantity = tanks.FuelTankExternal1Quantity,
+ FuelTankExternal2Quantity = tanks.FuelTankExternal2Quantity
+ };
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The FuelTanks extension method that converts the given tanks model.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The tanks to act on.
+ ///
+ ///
+ /// The simConnect fuel tanks struct.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static FuelTanks ConvertBack(this Simulator.Models.FuelTanks tanks)
+ {
+ return new FuelTanks
+ {
+ FuelTankCenterCapacity = tanks.FuelTankCenterCapacity,
+ FuelTankCenter2Capacity = tanks.FuelTankCenter2Capacity,
+ FuelTankCenter3Capacity = tanks.FuelTankCenter3Capacity,
+ FuelTankLeftMainCapacity = tanks.FuelTankLeftMainCapacity,
+ FuelTankLeftAuxCapacity = tanks.FuelTankLeftAuxCapacity,
+ FuelTankLeftTipCapacity = tanks.FuelTankLeftTipCapacity,
+ FuelTankRightMainCapacity = tanks.FuelTankRightMainCapacity,
+ FuelTankRightAuxCapacity = tanks.FuelTankRightAuxCapacity,
+ FuelTankRightTipCapacity = tanks.FuelTankRightTipCapacity,
+ FuelTankExternal1Capacity = tanks.FuelTankExternal1Capacity,
+ FuelTankExternal2Capacity = tanks.FuelTankExternal2Capacity,
+
+ FuelTankCenterQuantity = tanks.FuelTankCenterQuantity,
+ FuelTankCenter2Quantity = tanks.FuelTankCenter2Quantity,
+ FuelTankCenter3Quantity = tanks.FuelTankCenter3Quantity,
+ FuelTankLeftMainQuantity = tanks.FuelTankLeftMainQuantity,
+ FuelTankLeftAuxQuantity = tanks.FuelTankLeftAuxQuantity,
+ FuelTankLeftTipQuantity = tanks.FuelTankLeftTipQuantity,
+ FuelTankRightMainQuantity = tanks.FuelTankRightMainQuantity,
+ FuelTankRightAuxQuantity = tanks.FuelTankRightAuxQuantity,
+ FuelTankRightTipQuantity = tanks.FuelTankRightTipQuantity,
+ FuelTankExternal1Quantity = tanks.FuelTankExternal1Quantity,
+ FuelTankExternal2Quantity = tanks.FuelTankExternal2Quantity
+ };
+ }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The fuel tanks struct SimConnect properties definition.
+ ///
+ ///
+ /// sushi.at, 18/03/2021.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static class FuelTanksDefinition
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the definition list of sim properties.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static List Definition =>
+ new()
+ {
+ new SimVar("FUEL TANK CENTER CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK CENTER2 CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK CENTER3 CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK LEFT MAIN CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK LEFT AUX CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK LEFT TIP CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK RIGHT MAIN CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK RIGHT AUX CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK RIGHT TIP CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK EXTERNAL1 CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK EXTERNAL2 CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+
+ new SimVar("FUEL TANK CENTER QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK CENTER2 QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK CENTER3 QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK LEFT MAIN QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK LEFT AUX QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK LEFT TIP QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK RIGHT MAIN QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK RIGHT AUX QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK RIGHT TIP QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK EXTERNAL1 QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TANK EXTERNAL2 QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ };
+ }
+}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/SimConnect/Structs/LandingAnalysis.cs b/OpenSky.Agent.SimConnectMSFS/Structs/LandingAnalysis.cs
similarity index 81%
rename from OpenSky.AgentMSFS/SimConnect/Structs/LandingAnalysis.cs
rename to OpenSky.Agent.SimConnectMSFS/Structs/LandingAnalysis.cs
index ba1dd72..366727b 100644
--- a/OpenSky.AgentMSFS/SimConnect/Structs/LandingAnalysis.cs
+++ b/OpenSky.Agent.SimConnectMSFS/Structs/LandingAnalysis.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Structs
+namespace OpenSky.Agent.SimConnectMSFS.Structs
{
using System.Collections.Generic;
using System.Runtime.InteropServices;
@@ -12,7 +12,6 @@ namespace OpenSky.AgentMSFS.SimConnect.Structs
using CTrue.FsConnect;
using Microsoft.FlightSimulator.SimConnect;
- using Microsoft.Maps.MapControl.WPF;
/// -------------------------------------------------------------------------------------------------
///
@@ -115,24 +114,51 @@ public struct LandingAnalysis
///
/// -------------------------------------------------------------------------------------------------
public double BankAngle { get; set; }
+ }
- // ==================================================================================================
- // END OF STRUCT PROPERTIES - BELOW ARE GET-ONLY COMPUTED PROPERTIES FOR OPENSKY
- // ==================================================================================================
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The landing rate in feet per minute.
- ///
- /// -------------------------------------------------------------------------------------------------
- public double LandingRate => this.LandingRateSeconds * 60;
-
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Landing analysis converter (simConnect struct to simulator model).
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static class LandingAnalysisConverter
+ {
/// -------------------------------------------------------------------------------------------------
///
- /// The current map location.
+ /// The LandingAnalysis extension method that converts the given landing analysis struct.
///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The analysis to act on.
+ ///
+ ///
+ /// The simulator model landing analysis.
+ ///
/// -------------------------------------------------------------------------------------------------
- public Location Location => new(this.Latitude, this.Longitude, this.Altitude);
+ public static Simulator.Models.LandingAnalysis Convert(this LandingAnalysis analysis)
+ {
+ return new Simulator.Models.LandingAnalysis
+ {
+ Latitude = analysis.Latitude,
+ Longitude = analysis.Longitude,
+ Altitude = analysis.Altitude,
+ OnGround = analysis.OnGround,
+ WindLat = analysis.WindLat,
+ WindLong = analysis.WindLong,
+ AirspeedTrue = analysis.AirspeedTrue,
+ GroundSpeed = analysis.GroundSpeed,
+ SpeedLat = analysis.SpeedLat,
+ SpeedLong = analysis.SpeedLong,
+ Gforce = analysis.Gforce,
+ LandingRateSeconds = analysis.LandingRateSeconds,
+ BankAngle = analysis.BankAngle
+ };
+ }
}
/// -------------------------------------------------------------------------------------------------
diff --git a/OpenSky.AgentMSFS/SimConnect/Structs/PayloadStations.cs b/OpenSky.Agent.SimConnectMSFS/Structs/PayloadStations.cs
similarity index 81%
rename from OpenSky.AgentMSFS/SimConnect/Structs/PayloadStations.cs
rename to OpenSky.Agent.SimConnectMSFS/Structs/PayloadStations.cs
index 7ae060c..875f7f7 100644
--- a/OpenSky.AgentMSFS/SimConnect/Structs/PayloadStations.cs
+++ b/OpenSky.Agent.SimConnectMSFS/Structs/PayloadStations.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Structs
+namespace OpenSky.Agent.SimConnectMSFS.Structs
{
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@@ -332,62 +332,140 @@ public struct PayloadStations
///
/// -------------------------------------------------------------------------------------------------
public double Weight20 { get; set; }
+ }
- // ==================================================================================================
- // END OF STRUCT PROPERTIES - BELOW ARE GET-ONLY COMPUTED PROPERTIES FOR OPENSKY
- // ==================================================================================================
-
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Payload station converter (simConnect struct to simulator model).
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static class PayloadStationsConverter
+ {
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the payload stations names list.
+ /// The PayloadStations extension method that converts the given payload stations struct.
///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The stations to act on.
+ ///
+ ///
+ /// The simulator model payload stations.
+ ///
/// -------------------------------------------------------------------------------------------------
- public List Names =>
- new()
+ public static Simulator.Models.PayloadStations Convert(this PayloadStations stations)
+ {
+ return new Simulator.Models.PayloadStations
{
- this.Name1?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name2?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name3?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name4?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name5?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name6?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name7?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name8?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name9?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name10?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name11?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name12?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name13?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name14?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name15?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name16?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name17?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name18?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name19?.Replace("TT:MENU.PAYLOAD.", string.Empty),
- this.Name20?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ Count = stations.Count,
+ Name1 = stations.Name1,
+ Name2 = stations.Name2,
+ Name3 = stations.Name3,
+ Name4 = stations.Name4,
+ Name5 = stations.Name5,
+ Name6 = stations.Name6,
+ Name7 = stations.Name7,
+ Name8 = stations.Name8,
+ Name9 = stations.Name9,
+ Name10 = stations.Name10,
+ Name11 = stations.Name11,
+ Name12 = stations.Name12,
+ Name13 = stations.Name13,
+ Name14 = stations.Name14,
+ Name15 = stations.Name15,
+ Name16 = stations.Name16,
+ Name17 = stations.Name17,
+ Name18 = stations.Name18,
+ Name19 = stations.Name19,
+ Name20 = stations.Name20,
+ Weight1 = stations.Weight1,
+ Weight2 = stations.Weight2,
+ Weight3 = stations.Weight3,
+ Weight4 = stations.Weight4,
+ Weight5 = stations.Weight5,
+ Weight6 = stations.Weight6,
+ Weight7 = stations.Weight7,
+ Weight8 = stations.Weight8,
+ Weight9 = stations.Weight9,
+ Weight10 = stations.Weight10,
+ Weight11 = stations.Weight11,
+ Weight12 = stations.Weight12,
+ Weight13 = stations.Weight13,
+ Weight14 = stations.Weight14,
+ Weight15 = stations.Weight15,
+ Weight16 = stations.Weight16,
+ Weight17 = stations.Weight17,
+ Weight18 = stations.Weight18,
+ Weight19 = stations.Weight19,
+ Weight20 = stations.Weight20,
};
+ }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the total payload weight across all stations.
+ /// The PayloadStations extension method that converts the given payload stations model.
///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The stations to act on.
+ ///
+ ///
+ /// The simConnect payload stations struct.
+ ///
/// -------------------------------------------------------------------------------------------------
- public double TotalWeight
+ public static PayloadStations ConvertBack(this Simulator.Models.PayloadStations stations)
{
- get
+ return new PayloadStations
{
- var total = 0.0;
- for (var i = 1; i < this.Count + 1; i++)
- {
- var propInfo = this.GetType().GetProperty($"Weight{i}");
- if (propInfo != null)
- {
- total += (double)propInfo.GetValue(this);
- }
- }
-
- return total;
- }
+ Count = stations.Count,
+ Name1 = stations.Name1,
+ Name2 = stations.Name2,
+ Name3 = stations.Name3,
+ Name4 = stations.Name4,
+ Name5 = stations.Name5,
+ Name6 = stations.Name6,
+ Name7 = stations.Name7,
+ Name8 = stations.Name8,
+ Name9 = stations.Name9,
+ Name10 = stations.Name10,
+ Name11 = stations.Name11,
+ Name12 = stations.Name12,
+ Name13 = stations.Name13,
+ Name14 = stations.Name14,
+ Name15 = stations.Name15,
+ Name16 = stations.Name16,
+ Name17 = stations.Name17,
+ Name18 = stations.Name18,
+ Name19 = stations.Name19,
+ Name20 = stations.Name20,
+ Weight1 = stations.Weight1,
+ Weight2 = stations.Weight2,
+ Weight3 = stations.Weight3,
+ Weight4 = stations.Weight4,
+ Weight5 = stations.Weight5,
+ Weight6 = stations.Weight6,
+ Weight7 = stations.Weight7,
+ Weight8 = stations.Weight8,
+ Weight9 = stations.Weight9,
+ Weight10 = stations.Weight10,
+ Weight11 = stations.Weight11,
+ Weight12 = stations.Weight12,
+ Weight13 = stations.Weight13,
+ Weight14 = stations.Weight14,
+ Weight15 = stations.Weight15,
+ Weight16 = stations.Weight16,
+ Weight17 = stations.Weight17,
+ Weight18 = stations.Weight18,
+ Weight19 = stations.Weight19,
+ Weight20 = stations.Weight20,
+ };
}
}
diff --git a/OpenSky.AgentMSFS/SimConnect/Structs/PlaneRegistry.cs b/OpenSky.Agent.SimConnectMSFS/Structs/PlaneRegistry.cs
similarity index 97%
rename from OpenSky.AgentMSFS/SimConnect/Structs/PlaneRegistry.cs
rename to OpenSky.Agent.SimConnectMSFS/Structs/PlaneRegistry.cs
index 68b0f86..6048a7c 100644
--- a/OpenSky.AgentMSFS/SimConnect/Structs/PlaneRegistry.cs
+++ b/OpenSky.Agent.SimConnectMSFS/Structs/PlaneRegistry.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Structs
+namespace OpenSky.Agent.SimConnectMSFS.Structs
{
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
diff --git a/OpenSky.AgentMSFS/SimConnect/Structs/PrimaryTracking.cs b/OpenSky.Agent.SimConnectMSFS/Structs/PrimaryTracking.cs
similarity index 81%
rename from OpenSky.AgentMSFS/SimConnect/Structs/PrimaryTracking.cs
rename to OpenSky.Agent.SimConnectMSFS/Structs/PrimaryTracking.cs
index 47e387f..4b2ba5c 100644
--- a/OpenSky.AgentMSFS/SimConnect/Structs/PrimaryTracking.cs
+++ b/OpenSky.Agent.SimConnectMSFS/Structs/PrimaryTracking.cs
@@ -1,21 +1,19 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Structs
+namespace OpenSky.Agent.SimConnectMSFS.Structs
{
using System.Collections.Generic;
- using System.Device.Location;
using System.Runtime.InteropServices;
using CTrue.FsConnect;
using Microsoft.FlightSimulator.SimConnect;
- using Microsoft.Maps.MapControl.WPF;
- using OpenSky.AgentMSFS.SimConnect.Enums;
+ using OpenSky.Agent.SimConnectMSFS.Enums;
/// -------------------------------------------------------------------------------------------------
///
@@ -91,6 +89,13 @@ public struct PrimaryTracking
/// -------------------------------------------------------------------------------------------------
public double GroundSpeed { get; set; }
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The indicated airspeed in knots.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double AirspeedIndicated { get; set; }
+
/// -------------------------------------------------------------------------------------------------
///
/// The pitch angle in degrees.
@@ -153,33 +158,57 @@ public struct PrimaryTracking
///
/// -------------------------------------------------------------------------------------------------
public CrashSequence CrashSequence { get; set; }
+ }
- // todo Maybe add "AMBIENT IN CLOUD Bool", so we further refine lights on requirements (say no ldg lights below 10000 if in the clouds?)
-
- // ==================================================================================================
- // END OF STRUCT PROPERTIES - BELOW ARE GET-ONLY COMPUTED PROPERTIES FOR OPENSKY
- // ==================================================================================================
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The vertical speed in feet per minute.
- ///
- /// -------------------------------------------------------------------------------------------------
- public double VerticalSpeed => this.VerticalSpeedSeconds * 60;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The current map location.
- ///
- /// -------------------------------------------------------------------------------------------------
- public Location MapLocation => new(this.Latitude, this.Longitude, this.Altitude);
-
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Primary tracking converter (simConnect struct to simulator model).
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static class PrimaryTrackingConverter
+ {
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the geo coordinate.
+ /// A PrimaryTracking extension method that converts the given primary tracking.
///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The primary to act on.
+ ///
+ ///
+ /// The simulator model primary tracking.
+ ///
/// -------------------------------------------------------------------------------------------------
- public GeoCoordinate GeoCoordinate => new(this.Latitude, this.Longitude, this.Altitude);
+ public static Simulator.Models.PrimaryTracking Convert(this PrimaryTracking primary)
+ {
+ return new Simulator.Models.PrimaryTracking
+ {
+ Latitude = primary.Latitude,
+ Longitude = primary.Longitude,
+ Altitude = primary.Altitude,
+ RadioHeight = primary.RadioHeight,
+ IndicatedAltitude = primary.IndicatedAltitude,
+ OnGround = primary.OnGround,
+ Heading = primary.Heading,
+ AirspeedTrue = primary.AirspeedTrue,
+ GroundSpeed = primary.GroundSpeed,
+ AirspeedIndicated = primary.AirspeedIndicated,
+ PitchAngle = primary.PitchAngle,
+ BankAngle = primary.BankAngle,
+ VerticalSpeedSeconds = primary.VerticalSpeedSeconds,
+ StallWarning = primary.StallWarning,
+ OverspeedWarning = primary.OverspeedWarning,
+ GForce = primary.GForce,
+ SimulationRate = primary.SimulationRate,
+ SlewActive = primary.SlewActive,
+ Crash = primary.CrashSequence != CrashSequence.Off
+ };
+ }
}
/// -------------------------------------------------------------------------------------------------
@@ -209,6 +238,7 @@ public static class PrimaryTrackingDefinition
new SimVar("PLANE HEADING DEGREES MAGNETIC", "Degrees", SIMCONNECT_DATATYPE.FLOAT64),
new SimVar("AIRSPEED TRUE", "Knots", SIMCONNECT_DATATYPE.FLOAT64),
new SimVar("GROUND VELOCITY", "Knots", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("AIRSPEED INDICATED", "Knots", SIMCONNECT_DATATYPE.FLOAT64),
new SimVar("PLANE PITCH DEGREES", "Degrees", SIMCONNECT_DATATYPE.FLOAT64),
new SimVar("PLANE BANK DEGREES", "Degrees", SIMCONNECT_DATATYPE.FLOAT64),
new SimVar("VERTICAL SPEED", "Feet per second", SIMCONNECT_DATATYPE.FLOAT64),
diff --git a/OpenSky.AgentMSFS/SimConnect/Structs/SecondaryTracking.cs b/OpenSky.Agent.SimConnectMSFS/Structs/SecondaryTracking.cs
similarity index 84%
rename from OpenSky.AgentMSFS/SimConnect/Structs/SecondaryTracking.cs
rename to OpenSky.Agent.SimConnectMSFS/Structs/SecondaryTracking.cs
index 03761d1..076ac5c 100644
--- a/OpenSky.AgentMSFS/SimConnect/Structs/SecondaryTracking.cs
+++ b/OpenSky.Agent.SimConnectMSFS/Structs/SecondaryTracking.cs
@@ -1,12 +1,11 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Structs
+namespace OpenSky.Agent.SimConnectMSFS.Structs
{
- using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
@@ -14,7 +13,8 @@ namespace OpenSky.AgentMSFS.SimConnect.Structs
using Microsoft.FlightSimulator.SimConnect;
- using OpenSky.AgentMSFS.SimConnect.Enums;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.FlightLogXML;
/// -------------------------------------------------------------------------------------------------
///
@@ -222,38 +222,66 @@ public struct SecondaryTracking
///
/// -------------------------------------------------------------------------------------------------
public bool NoSmokingSign { get; set; }
+ }
-
- // ==================================================================================================
- // END OF STRUCT PROPERTIES - BELOW ARE GET-ONLY COMPUTED PROPERTIES FOR OPENSKY
- // ==================================================================================================
-
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Secondary tracking converter (simConnect struct to simulator model).
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static class SecondaryTrackingConverter
+ {
/// -------------------------------------------------------------------------------------------------
///
- /// The UTC date/time.
+ /// A SecondaryTracking extension method that converts the given secondary tracking.
///
- /// -------------------------------------------------------------------------------------------------
- public DateTime UtcDateTime
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The secondary to act on.
+ ///
+ ///
+ /// The simulator model secondary tracking.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static Simulator.Models.SecondaryTracking Convert(this SecondaryTracking secondary)
{
- get
+ return new Simulator.Models.SecondaryTracking
{
- try
- {
- return new DateTime(this.UtcYear, this.UtcMonth, this.UtcDay).AddSeconds(this.UtcTime);
- }
- catch
- {
- return DateTime.MinValue;
- }
- }
+ UtcTime = secondary.UtcTime,
+ UtcDay = secondary.UtcDay,
+ UtcMonth = secondary.UtcMonth,
+ UtcYear = secondary.UtcYear,
+ TimeOfDay = secondary.TimeOfDay,
+ CrashDetection = secondary.CrashDetection,
+ UnlimitedFuel = secondary.UnlimitedFuel,
+ ElectricalMasterBattery = secondary.ElectricalMasterBattery,
+ EngineCombustion1 = secondary.EngineCombustion1,
+ EngineCombustion2 = secondary.EngineCombustion2,
+ EngineCombustion3 = secondary.EngineCombustion3,
+ EngineCombustion4 = secondary.EngineCombustion4,
+ Pushback = secondary.Pushback,
+ ApuGenerator = secondary.ApuGenerator,
+ LightBeacon = secondary.LightBeacon,
+ LightNav = secondary.LightNav,
+ LightStrobe = secondary.LightStrobe,
+ LightTaxi = secondary.LightTaxi,
+ LightLanding = secondary.LightLanding,
+ FlapsHandle = secondary.FlapsHandle,
+ FlapsPercentage = secondary.FlapsPercentage,
+ GearHandle = secondary.GearHandle,
+ GearPercentage = secondary.GearPercentage,
+ AutoPilot = secondary.AutoPilot,
+ ParkingBrake = secondary.ParkingBrake,
+ SpoilersArmed = secondary.SpoilersArmed,
+ SeatBeltSign = secondary.SeatBeltSign,
+ NoSmokingSign = secondary.NoSmokingSign
+ };
}
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Is there a running engine?
- ///
- /// -------------------------------------------------------------------------------------------------
- public bool EngineRunning => this.EngineCombustion1 || this.EngineCombustion2 || this.EngineCombustion3 || this.EngineCombustion4;
}
/// -------------------------------------------------------------------------------------------------
diff --git a/OpenSky.AgentMSFS/SimConnect/Structs/SlewPlaneIntoPosition.cs b/OpenSky.Agent.SimConnectMSFS/Structs/SlewAircraftIntoPosition.cs
similarity index 68%
rename from OpenSky.AgentMSFS/SimConnect/Structs/SlewPlaneIntoPosition.cs
rename to OpenSky.Agent.SimConnectMSFS/Structs/SlewAircraftIntoPosition.cs
index c526180..7bfdf34 100644
--- a/OpenSky.AgentMSFS/SimConnect/Structs/SlewPlaneIntoPosition.cs
+++ b/OpenSky.Agent.SimConnectMSFS/Structs/SlewAircraftIntoPosition.cs
@@ -1,13 +1,12 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Structs
+namespace OpenSky.Agent.SimConnectMSFS.Structs
{
using System.Collections.Generic;
- using System.Device.Location;
using System.Runtime.InteropServices;
using CTrue.FsConnect;
@@ -23,7 +22,7 @@ namespace OpenSky.AgentMSFS.SimConnect.Structs
///
/// -------------------------------------------------------------------------------------------------
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
- public struct SlewPlaneIntoPosition
+ public struct SlewAircraftIntoPosition
{
/// -------------------------------------------------------------------------------------------------
///
@@ -87,59 +86,88 @@ public struct SlewPlaneIntoPosition
///
/// -------------------------------------------------------------------------------------------------
public bool OnGround { get; set; }
+ }
- // ==================================================================================================
- // END OF STRUCT PROPERTIES - BELOW ARE GET-ONLY COMPUTED PROPERTIES FOR OPENSKY
- // ==================================================================================================
-
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Slew aircraft into position converter (simConnect struct to simulator model).
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static class SlewAircraftIntoPositionConverter
+ {
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the geo coordinate.
+ /// A SlewAircraftIntoPosition extension method that converts the given slew aircraft into position struct.
///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The position to act on.
+ ///
+ ///
+ /// The simulator model slew aircraft into position.
+ ///
/// -------------------------------------------------------------------------------------------------
- public GeoCoordinate GeoCoordinate => new(this.Latitude, this.Longitude, this.RadioHeight);
+ public static Agent.Simulator.Models.SlewAircraftIntoPosition Convert(this SlewAircraftIntoPosition position)
+ {
+ return new Agent.Simulator.Models.SlewAircraftIntoPosition
+ {
+ Latitude = position.Latitude,
+ Longitude = position.Longitude,
+ RadioHeight = position.RadioHeight,
+ Heading = position.Heading,
+ AirspeedTrue = position.AirspeedTrue,
+ PitchAngle = position.PitchAngle,
+ BankAngle = position.BankAngle,
+ VerticalSpeedSeconds = position.VerticalSpeedSeconds,
+ OnGround = position.OnGround
+ };
+ }
/// -------------------------------------------------------------------------------------------------
///
- /// Initializes this object from the given from primary tracking struct.
+ /// An SlewAircraftIntoPosition extension method that converts the given slew aircraft into position model.
///
///
- /// sushi.at, 02/04/2021.
+ /// sushi.at, 31/01/2022.
///
- ///
- /// The primary tracking struct.
+ ///
+ /// The position to act on.
///
///
- /// A SlewPlaneIntoPosition struct.
+ /// The simConnect slew aircraft into position struct.
///
/// -------------------------------------------------------------------------------------------------
- public static SlewPlaneIntoPosition FromPrimaryTracking(PrimaryTracking primary)
+ public static SlewAircraftIntoPosition ConvertBack(this Agent.Simulator.Models.SlewAircraftIntoPosition position)
{
- var slew = new SlewPlaneIntoPosition
+ return new SlewAircraftIntoPosition
{
- Latitude = primary.Latitude,
- Longitude = primary.Longitude,
- RadioHeight = primary.RadioHeight,
- Heading = primary.Heading,
- AirspeedTrue = primary.AirspeedTrue,
- PitchAngle = primary.PitchAngle,
- BankAngle = primary.BankAngle,
- VerticalSpeedSeconds = primary.VerticalSpeedSeconds,
- OnGround = primary.OnGround
+ Latitude = position.Latitude,
+ Longitude = position.Longitude,
+ RadioHeight = position.RadioHeight,
+ Heading = position.Heading,
+ AirspeedTrue = position.AirspeedTrue,
+ PitchAngle = position.PitchAngle,
+ BankAngle = position.BankAngle,
+ VerticalSpeedSeconds = position.VerticalSpeedSeconds,
+ OnGround = position.OnGround
};
- return slew;
}
}
/// -------------------------------------------------------------------------------------------------
- ///
- /// The slew plane into position struct SimConnect properties definition.
- ///
- ///
- /// sushi.at, 13/03/2021.
- ///
- /// -------------------------------------------------------------------------------------------------
- public static class SlewPlaneIntoPositionDefinition
+ ///
+ /// The slew aircraft into position struct SimConnect properties definition.
+ ///
+ ///
+ /// sushi.at, 13/03/2021.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static class SlewAircraftIntoPositionDefinition
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.Agent.SimConnectMSFS/Structs/WeightAndBalance.cs b/OpenSky.Agent.SimConnectMSFS/Structs/WeightAndBalance.cs
new file mode 100644
index 0000000..d48834f
--- /dev/null
+++ b/OpenSky.Agent.SimConnectMSFS/Structs/WeightAndBalance.cs
@@ -0,0 +1,168 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace OpenSky.Agent.SimConnectMSFS.Structs
+{
+ using System.Collections.Generic;
+
+ using CTrue.FsConnect;
+
+ using Microsoft.FlightSimulator.SimConnect;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The weight and balance struct.
+ ///
+ ///
+ /// sushi.at, 20/03/2021.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public struct WeightAndBalance
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Empty weight in pounds.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double EmptyWeight { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Total weight in pounds.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double TotalWeight { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Max gross weight in pounds.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double MaxGrossWeight { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Fuel total capacity in gallons.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTotalCapacity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Fuel total quantity on board in gallons.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelTotalQuantity { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Fuel weight (pounds/gallon).
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FuelWeightPerGallon { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The center of gravity aft limit.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double CgAftLimit { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The center of gravity forward limit.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double CgFwdLimit { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The center of gravity (longitudinal)
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double CgPercent { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The center of gravity (lateral)
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double CgPercentLateral { get; set; }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Weight and balance converter (simConnect struct to simulator model).
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static class WeightAndBalanceConverter
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// A WeightAndBalance extension method that converts the given weight and balance.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The wab to act on.
+ ///
+ ///
+ /// The simulator model weight and balance.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static Simulator.Models.WeightAndBalance Convert(this WeightAndBalance wab)
+ {
+ return new Simulator.Models.WeightAndBalance
+ {
+ EmptyWeight = wab.EmptyWeight,
+ TotalWeight = wab.TotalWeight,
+ MaxGrossWeight = wab.MaxGrossWeight,
+ FuelTotalCapacity = wab.FuelTotalCapacity,
+ FuelTotalQuantity = wab.FuelTotalQuantity,
+ FuelWeightPerGallon = wab.FuelWeightPerGallon,
+ CgAftLimit = wab.CgAftLimit,
+ CgFwdLimit = wab.CgFwdLimit,
+ CgPercent = wab.CgPercent,
+ CgPercentLateral = wab.CgPercentLateral
+ };
+ }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The weight and balance struct SimConnect properties definition.
+ ///
+ ///
+ /// sushi.at, 20/03/2021.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static class WeightAndBalanceDefinition
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the definition list of sim properties.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static List Definition =>
+ new()
+ {
+ new SimVar("EMPTY WEIGHT", "Pounds", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("TOTAL WEIGHT", "Pounds", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("MAX GROSS WEIGHT", "Pounds", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TOTAL CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL TOTAL QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("FUEL WEIGHT PER GALLON", "Pounds", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("CG AFT LIMIT", "Percent over 100", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("CG FWD LIMIT", "Percent over 100", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("CG PERCENT", "Percent over 100", SIMCONNECT_DATATYPE.FLOAT64),
+ new SimVar("CG PERCENT LATERAL", "Percent over 100", SIMCONNECT_DATATYPE.FLOAT64),
+ };
+ }
+}
\ No newline at end of file
diff --git a/OpenSky.Agent.SimConnectMSFS/packages.config b/OpenSky.Agent.SimConnectMSFS/packages.config
new file mode 100644
index 0000000..a7151c7
--- /dev/null
+++ b/OpenSky.Agent.SimConnectMSFS/packages.config
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/SimConnect/Enums/FuelTank.cs b/OpenSky.Agent.Simulator/Enums/FuelTank.cs
similarity index 95%
rename from OpenSky.AgentMSFS/SimConnect/Enums/FuelTank.cs
rename to OpenSky.Agent.Simulator/Enums/FuelTank.cs
index 9b67ea4..d199f26 100644
--- a/OpenSky.AgentMSFS/SimConnect/Enums/FuelTank.cs
+++ b/OpenSky.Agent.Simulator/Enums/FuelTank.cs
@@ -1,12 +1,12 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Enums
+namespace OpenSky.Agent.Simulator.Enums
{
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Simulator.Tools;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/SimConnect/Enums/Pushback.cs b/OpenSky.Agent.Simulator/Enums/Pushback.cs
similarity index 94%
rename from OpenSky.AgentMSFS/SimConnect/Enums/Pushback.cs
rename to OpenSky.Agent.Simulator/Enums/Pushback.cs
index 045a52b..fb17c34 100644
--- a/OpenSky.AgentMSFS/SimConnect/Enums/Pushback.cs
+++ b/OpenSky.Agent.Simulator/Enums/Pushback.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Enums
+namespace OpenSky.Agent.Simulator.Enums
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/SimConnect/Enums/Requests.cs b/OpenSky.Agent.Simulator/Enums/Requests.cs
similarity index 96%
rename from OpenSky.AgentMSFS/SimConnect/Enums/Requests.cs
rename to OpenSky.Agent.Simulator/Enums/Requests.cs
index ecb8140..ed82159 100644
--- a/OpenSky.AgentMSFS/SimConnect/Enums/Requests.cs
+++ b/OpenSky.Agent.Simulator/Enums/Requests.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Enums
+namespace OpenSky.Agent.Simulator.Enums
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Models/TrackingStatus.cs b/OpenSky.Agent.Simulator/Enums/TrackingStatus.cs
similarity index 95%
rename from OpenSky.AgentMSFS/Models/TrackingStatus.cs
rename to OpenSky.Agent.Simulator/Enums/TrackingStatus.cs
index 426bd2e..5417ae7 100644
--- a/OpenSky.AgentMSFS/Models/TrackingStatus.cs
+++ b/OpenSky.Agent.Simulator/Enums/TrackingStatus.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Models
+namespace OpenSky.Agent.Simulator.Enums
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.Agent.Simulator/Models/AircraftIdentity.cs b/OpenSky.Agent.Simulator/Models/AircraftIdentity.cs
new file mode 100644
index 0000000..96a3d82
--- /dev/null
+++ b/OpenSky.Agent.Simulator/Models/AircraftIdentity.cs
@@ -0,0 +1,70 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace OpenSky.Agent.Simulator.Models
+{
+ using OpenSkyApi;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Aircraft identity model.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public class AircraftIdentity
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The ATC plane model string.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public string AtcModel { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The ATC plane type string.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public string AtcType { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The engine count.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public int EngineCount { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Engine type.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public EngineType EngineType { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Does the plane have flaps?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool FlapsAvailable { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Is the landing gear retractable?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool GearRetractable { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the plane type.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public string Type { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/Models/AircraftTrailLocation.cs b/OpenSky.Agent.Simulator/Models/AircraftTrailLocation.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Models/AircraftTrailLocation.cs
rename to OpenSky.Agent.Simulator/Models/AircraftTrailLocation.cs
index 27fd805..3148c24 100644
--- a/OpenSky.AgentMSFS/Models/AircraftTrailLocation.cs
+++ b/OpenSky.Agent.Simulator/Models/AircraftTrailLocation.cs
@@ -1,16 +1,15 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Models
+namespace OpenSky.Agent.Simulator.Models
{
using System;
using Microsoft.Maps.MapControl.WPF;
- using OpenSky.AgentMSFS.SimConnect.Structs;
using OpenSky.FlightLogXML;
/// -------------------------------------------------------------------------------------------------
diff --git a/OpenSky.AgentMSFS/Models/FlightLoadingTempStructs.cs b/OpenSky.Agent.Simulator/Models/FlightLoadingTempModels.cs
similarity index 70%
rename from OpenSky.AgentMSFS/Models/FlightLoadingTempStructs.cs
rename to OpenSky.Agent.Simulator/Models/FlightLoadingTempModels.cs
index 20c2b3e..89f88ad 100644
--- a/OpenSky.AgentMSFS/Models/FlightLoadingTempStructs.cs
+++ b/OpenSky.Agent.Simulator/Models/FlightLoadingTempModels.cs
@@ -1,43 +1,41 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Models
+namespace OpenSky.Agent.Simulator.Models
{
- using OpenSky.AgentMSFS.SimConnect.Structs;
-
/// -------------------------------------------------------------------------------------------------
///
- /// Temporary structs loaded from flight save file are kept here until the user clicks resume
- /// tracking.
+ /// Flight loading temporary models (loaded from flight save and kept here until the user clicks
+ /// resume tracking.
///
///
- /// sushi.at, 01/04/2021.
+ /// sushi.at, 31/01/2022.
///
/// -------------------------------------------------------------------------------------------------
- public class FlightLoadingTempStructs
+ public class FlightLoadingTempModels
{
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tanks struct.
+ /// Gets or sets the fuel tanks model.
///
/// -------------------------------------------------------------------------------------------------
public FuelTanks FuelTanks { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the payload stations struct.
+ /// Gets or sets the payload stations model.
///
/// -------------------------------------------------------------------------------------------------
public PayloadStations PayloadStations { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the slew plane into position struct.
+ /// Gets or sets the slew aircraft into position model.
///
/// -------------------------------------------------------------------------------------------------
- public SlewPlaneIntoPosition SlewPlaneIntoPosition { get; set; }
+ public SlewAircraftIntoPosition SlewAircraftIntoPosition { get; set; }
}
}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/SimConnect/Structs/FuelTanks.cs b/OpenSky.Agent.Simulator/Models/FuelTanks.cs
similarity index 78%
rename from OpenSky.AgentMSFS/SimConnect/Structs/FuelTanks.cs
rename to OpenSky.Agent.Simulator/Models/FuelTanks.cs
index a1f6feb..2b75fde 100644
--- a/OpenSky.AgentMSFS/SimConnect/Structs/FuelTanks.cs
+++ b/OpenSky.Agent.Simulator/Models/FuelTanks.cs
@@ -1,37 +1,45 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Structs
+namespace OpenSky.Agent.Simulator.Models
{
using System.Collections.Generic;
- using System.Runtime.InteropServices;
- using CTrue.FsConnect;
-
- using Microsoft.FlightSimulator.SimConnect;
-
- using OpenSky.AgentMSFS.SimConnect.Enums;
+ using OpenSky.Agent.Simulator.Enums;
/// -------------------------------------------------------------------------------------------------
///
- /// Fuel tanks struct.
+ /// Fuel tanks model.
///
///
- /// sushi.at, 17/03/2021.
+ /// sushi.at, 31/01/2022.
///
/// -------------------------------------------------------------------------------------------------
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
- public struct FuelTanks
+ public class FuelTanks
{
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank center capacity.
+ /// Gets the fuel tank capacities dictionary.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankCenterCapacity { get; set; }
+ public Dictionary Capacities =>
+ new()
+ {
+ { FuelTank.Center, this.FuelTankCenterCapacity },
+ { FuelTank.Center2, this.FuelTankCenter2Capacity },
+ { FuelTank.Center3, this.FuelTankCenter3Capacity },
+ { FuelTank.LeftMain, this.FuelTankLeftMainCapacity },
+ { FuelTank.LeftAux, this.FuelTankLeftAuxCapacity },
+ { FuelTank.LeftTip, this.FuelTankLeftTipCapacity },
+ { FuelTank.RightMain, this.FuelTankRightMainCapacity },
+ { FuelTank.RightAux, this.FuelTankRightAuxCapacity },
+ { FuelTank.RightTip, this.FuelTankRightTipCapacity },
+ { FuelTank.External1, this.FuelTankExternal1Capacity },
+ { FuelTank.External2, this.FuelTankExternal2Capacity }
+ };
/// -------------------------------------------------------------------------------------------------
///
@@ -42,87 +50,87 @@ public struct FuelTanks
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank center 3 capacity.
+ /// Gets or sets the fuel tank center 2 quantity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankCenter3Capacity { get; set; }
+ public double FuelTankCenter2Quantity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank left main capacity.
+ /// Gets or sets the fuel tank center 3 capacity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankLeftMainCapacity { get; set; }
+ public double FuelTankCenter3Capacity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank left auxiliary capacity.
+ /// Gets or sets the fuel tank center 3 quantity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankLeftAuxCapacity { get; set; }
+ public double FuelTankCenter3Quantity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank left tip capacity.
+ /// Gets or sets the fuel tank center capacity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankLeftTipCapacity { get; set; }
+ public double FuelTankCenterCapacity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank right main capacity.
+ /// Gets or sets the fuel tank center quantity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankRightMainCapacity { get; set; }
+ public double FuelTankCenterQuantity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank right auxiliary capacity.
+ /// Gets or sets the fuel tank external 1 capacity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankRightAuxCapacity { get; set; }
+ public double FuelTankExternal1Capacity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank right tip capacity.
+ /// Gets or sets the fuel tank external 1 quantity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankRightTipCapacity { get; set; }
+ public double FuelTankExternal1Quantity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank external 1 capacity.
+ /// Gets or sets the fuel tank external 2 capacity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankExternal1Capacity { get; set; }
+ public double FuelTankExternal2Capacity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank external 2 capacity.
+ /// Gets or sets the fuel tank external 2 quantity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankExternal2Capacity { get; set; }
+ public double FuelTankExternal2Quantity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank center quantity.
+ /// Gets or sets the fuel tank left auxiliary capacity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankCenterQuantity { get; set; }
+ public double FuelTankLeftAuxCapacity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank center 2 quantity.
+ /// Gets or sets the fuel tank left auxiliary quantity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankCenter2Quantity { get; set; }
+ public double FuelTankLeftAuxQuantity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank center 3 quantity.
+ /// Gets or sets the fuel tank left main capacity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankCenter3Quantity { get; set; }
+ public double FuelTankLeftMainCapacity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
@@ -133,10 +141,10 @@ public struct FuelTanks
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank left auxiliary quantity.
+ /// Gets or sets the fuel tank left tip capacity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankLeftAuxQuantity { get; set; }
+ public double FuelTankLeftTipCapacity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
@@ -147,10 +155,10 @@ public struct FuelTanks
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank right main quantity.
+ /// Gets or sets the fuel tank right auxiliary capacity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankRightMainQuantity { get; set; }
+ public double FuelTankRightAuxCapacity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
@@ -161,68 +169,31 @@ public struct FuelTanks
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank right tip quantity.
- ///
- /// -------------------------------------------------------------------------------------------------
- public double FuelTankRightTipQuantity { get; set; }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets or sets the fuel tank external 1 quantity.
+ /// Gets or sets the fuel tank right main capacity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankExternal1Quantity { get; set; }
+ public double FuelTankRightMainCapacity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets or sets the fuel tank external 2 quantity.
+ /// Gets or sets the fuel tank right main quantity.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTankExternal2Quantity { get; set; }
-
- // ==================================================================================================
- // END OF STRUCT PROPERTIES - BELOW ARE GET-ONLY COMPUTED PROPERTIES FOR OPENSKY
- // ==================================================================================================
+ public double FuelTankRightMainQuantity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the total quantity of fuel in all tanks.
+ /// Gets or sets the fuel tank right tip capacity.
///
/// -------------------------------------------------------------------------------------------------
- public double TotalQuantity
- {
- get
- {
- var total = 0.0;
- foreach (var quantity in Quantities)
- {
- total += quantity.Value;
- }
-
- return total;
- }
- }
+ public double FuelTankRightTipCapacity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the fuel tank capacities dictionary.
+ /// Gets or sets the fuel tank right tip quantity.
///
/// -------------------------------------------------------------------------------------------------
- public Dictionary Capacities =>
- new()
- {
- { FuelTank.Center, this.FuelTankCenterCapacity },
- { FuelTank.Center2, this.FuelTankCenter2Capacity },
- { FuelTank.Center3, this.FuelTankCenter3Capacity },
- { FuelTank.LeftMain, this.FuelTankLeftMainCapacity },
- { FuelTank.LeftAux, this.FuelTankLeftAuxCapacity },
- { FuelTank.LeftTip, this.FuelTankLeftTipCapacity },
- { FuelTank.RightMain, this.FuelTankRightMainCapacity },
- { FuelTank.RightAux, this.FuelTankRightAuxCapacity },
- { FuelTank.RightTip, this.FuelTankRightTipCapacity },
- { FuelTank.External1, this.FuelTankExternal1Capacity },
- { FuelTank.External2, this.FuelTankExternal2Capacity }
- };
+ public double FuelTankRightTipQuantity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
@@ -245,6 +216,25 @@ public double TotalQuantity
{ FuelTank.External2, this.FuelTankExternal2Quantity }
};
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the total quantity of fuel in all tanks.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double TotalQuantity
+ {
+ get
+ {
+ var total = 0.0;
+ foreach (var quantity in this.Quantities)
+ {
+ total += quantity.Value;
+ }
+
+ return total;
+ }
+ }
+
/// -------------------------------------------------------------------------------------------------
///
/// Updates the quantities from a modified dictionary.
@@ -271,48 +261,4 @@ public void UpdateQuantitiesFromDictionary(Dictionary modified
this.FuelTankExternal2Quantity = modifiedDictionary[FuelTank.External2];
}
}
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The fuel tanks struct SimConnect properties definition.
- ///
- ///
- /// sushi.at, 18/03/2021.
- ///
- /// -------------------------------------------------------------------------------------------------
- public static class FuelTanksDefinition
- {
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets the definition list of sim properties.
- ///
- /// -------------------------------------------------------------------------------------------------
- public static List Definition =>
- new()
- {
- new SimVar("FUEL TANK CENTER CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK CENTER2 CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK CENTER3 CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK LEFT MAIN CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK LEFT AUX CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK LEFT TIP CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK RIGHT MAIN CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK RIGHT AUX CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK RIGHT TIP CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK EXTERNAL1 CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK EXTERNAL2 CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
-
- new SimVar("FUEL TANK CENTER QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK CENTER2 QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK CENTER3 QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK LEFT MAIN QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK LEFT AUX QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK LEFT TIP QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK RIGHT MAIN QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK RIGHT AUX QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK RIGHT TIP QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK EXTERNAL1 QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TANK EXTERNAL2 QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- };
- }
}
\ No newline at end of file
diff --git a/OpenSky.Agent.Simulator/Models/LandingAnalysis.cs b/OpenSky.Agent.Simulator/Models/LandingAnalysis.cs
new file mode 100644
index 0000000..88c7054
--- /dev/null
+++ b/OpenSky.Agent.Simulator/Models/LandingAnalysis.cs
@@ -0,0 +1,126 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace OpenSky.Agent.Simulator.Models
+{
+ using Microsoft.Maps.MapControl.WPF;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Landing analysis model.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public class LandingAnalysis
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The true airspeed.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double AirspeedTrue { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The altitude in feet.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Altitude { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The bank angle in degrees.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double BankAngle { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The g-force.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Gforce { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The ground speed.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double GroundSpeed { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The landing rate in feet per minute.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double LandingRate => this.LandingRateSeconds * 60;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The vertical speed during touchdown (feet/s).
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double LandingRateSeconds { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The latitude in degrees.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Latitude { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The current map location.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public Location Location => new(this.Latitude, this.Longitude, this.Altitude);
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The longitude in degrees.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Longitude { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Is the plane on the ground?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool OnGround { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The sidewards speed of the plane (feet/s).
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double SpeedLat { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The forward speed of the plane (feet/s).
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double SpeedLong { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The cross wind (knots).
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double WindLat { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The headwind/tailwind (knots).
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double WindLong { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/Models/LandingReportNotification.cs b/OpenSky.Agent.Simulator/Models/LandingReportNotification.cs
similarity index 99%
rename from OpenSky.AgentMSFS/Models/LandingReportNotification.cs
rename to OpenSky.Agent.Simulator/Models/LandingReportNotification.cs
index 64764d0..927db77 100644
--- a/OpenSky.AgentMSFS/Models/LandingReportNotification.cs
+++ b/OpenSky.Agent.Simulator/Models/LandingReportNotification.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Models
+namespace OpenSky.Agent.Simulator.Models
{
using System.Collections.Generic;
using System.Linq;
diff --git a/OpenSky.AgentMSFS/Models/MapPositionUpdate.cs b/OpenSky.Agent.Simulator/Models/MapPositionUpdate.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Models/MapPositionUpdate.cs
rename to OpenSky.Agent.Simulator/Models/MapPositionUpdate.cs
index 79f21f8..cb8cd74 100644
--- a/OpenSky.AgentMSFS/Models/MapPositionUpdate.cs
+++ b/OpenSky.Agent.Simulator/Models/MapPositionUpdate.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Models
+namespace OpenSky.Agent.Simulator.Models
{
using Microsoft.Maps.MapControl.WPF;
diff --git a/OpenSky.Agent.Simulator/Models/PayloadStations.cs b/OpenSky.Agent.Simulator/Models/PayloadStations.cs
new file mode 100644
index 0000000..5f6a58d
--- /dev/null
+++ b/OpenSky.Agent.Simulator/Models/PayloadStations.cs
@@ -0,0 +1,379 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace OpenSky.Agent.Simulator.Models
+{
+ using System.Collections.Generic;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Payload stations model.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public class PayloadStations
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets the number of payload stations.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public int Count { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 1.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public string Name1 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 10.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name10 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 11.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name11 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 12.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name12 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 13.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name13 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 14.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name14 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 15.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name15 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 16.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name16 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 17.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name17 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 18.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name18 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 19.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name19 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 2.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public string Name2 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 20.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name20 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 3.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name3 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 4.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name4 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 5.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name5 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 6.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name6 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 7.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name7 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 8.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name8 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station name 9.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+
+ public string Name9 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the payload stations names list.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public List Names =>
+ new()
+ {
+ this.Name1?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name2?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name3?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name4?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name5?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name6?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name7?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name8?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name9?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name10?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name11?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name12?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name13?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name14?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name15?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name16?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name17?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name18?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name19?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ this.Name20?.Replace("TT:MENU.PAYLOAD.", string.Empty),
+ };
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the total payload weight across all stations.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double TotalWeight
+ {
+ get
+ {
+ var total = 0.0;
+ for (var i = 1; i < this.Count + 1; i++)
+ {
+ var propInfo = this.GetType().GetProperty($"Weight{i}");
+ if (propInfo != null)
+ {
+ total += (double)propInfo.GetValue(this);
+ }
+ }
+
+ return total;
+ }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 1.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight1 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 10.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight10 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 11.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight11 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 12.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight12 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 13.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight13 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 14.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight14 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 15.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight15 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 16.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight16 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 17.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight17 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 18.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight18 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 19.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight19 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 2.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight2 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 20.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight20 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 3.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight3 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 4.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight4 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 5.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight5 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 6.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight6 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 7.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight7 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 8.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight8 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The payload station weight 9.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Weight9 { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/OpenSky.Agent.Simulator/Models/PrimaryTracking.cs b/OpenSky.Agent.Simulator/Models/PrimaryTracking.cs
new file mode 100644
index 0000000..a1c1f15
--- /dev/null
+++ b/OpenSky.Agent.Simulator/Models/PrimaryTracking.cs
@@ -0,0 +1,177 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace OpenSky.Agent.Simulator.Models
+{
+ using System.Device.Location;
+
+ using Microsoft.Maps.MapControl.WPF;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Primary flight tracking model (checked often).
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public class PrimaryTracking
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The indicated airspeed in knots.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double AirspeedIndicated { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// True airspeed in knots.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double AirspeedTrue { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The altitude in feet.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Altitude { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The bank angle in degrees.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double BankAngle { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets a value indicating whether the aircraft crashed.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool Crash { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the geo coordinate.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public GeoCoordinate GeoCoordinate => new(this.Latitude, this.Longitude, this.Altitude);
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The g-force.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double GForce { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Ground speed in knots.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double GroundSpeed { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The magnetic heading.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Heading { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The indicated altitude in feet.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double IndicatedAltitude { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The latitude in degrees.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Latitude { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The longitude in degrees.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Longitude { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The current map location.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public Location MapLocation => new(this.Latitude, this.Longitude, this.Altitude);
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Is the plane on the ground?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool OnGround { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The over-speed warning.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool OverspeedWarning { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The pitch angle in degrees.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double PitchAngle { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The radio height in feet.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double RadioHeight { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The simulation rate.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double SimulationRate { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Is slew mode active?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool SlewActive { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The stall warning.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool StallWarning { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The vertical speed in feet per minute.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double VerticalSpeed => this.VerticalSpeedSeconds * 60;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The vertical speed in feet per second.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double VerticalSpeedSeconds { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/SimConnect/Helpers/ProcessLandingAnalysis.cs b/OpenSky.Agent.Simulator/Models/ProcessLandingAnalysis.cs
similarity index 92%
rename from OpenSky.AgentMSFS/SimConnect/Helpers/ProcessLandingAnalysis.cs
rename to OpenSky.Agent.Simulator/Models/ProcessLandingAnalysis.cs
index 09bccbd..8e27640 100644
--- a/OpenSky.AgentMSFS/SimConnect/Helpers/ProcessLandingAnalysis.cs
+++ b/OpenSky.Agent.Simulator/Models/ProcessLandingAnalysis.cs
@@ -1,13 +1,11 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Helpers
+namespace OpenSky.Agent.Simulator.Models
{
- using OpenSky.AgentMSFS.SimConnect.Structs;
-
/// -------------------------------------------------------------------------------------------------
///
/// Process landing analysis (for queue processing).
diff --git a/OpenSky.AgentMSFS/SimConnect/Helpers/ProcessPrimaryTracking.cs b/OpenSky.Agent.Simulator/Models/ProcessPrimaryTracking.cs
similarity index 92%
rename from OpenSky.AgentMSFS/SimConnect/Helpers/ProcessPrimaryTracking.cs
rename to OpenSky.Agent.Simulator/Models/ProcessPrimaryTracking.cs
index 6f1367b..2579760 100644
--- a/OpenSky.AgentMSFS/SimConnect/Helpers/ProcessPrimaryTracking.cs
+++ b/OpenSky.Agent.Simulator/Models/ProcessPrimaryTracking.cs
@@ -1,13 +1,11 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Helpers
+namespace OpenSky.Agent.Simulator.Models
{
- using OpenSky.AgentMSFS.SimConnect.Structs;
-
/// -------------------------------------------------------------------------------------------------
///
/// Process primary tracking (for queue processing)
diff --git a/OpenSky.AgentMSFS/SimConnect/Helpers/ProcessSecondaryTracking.cs b/OpenSky.Agent.Simulator/Models/ProcessSecondaryTracking.cs
similarity index 92%
rename from OpenSky.AgentMSFS/SimConnect/Helpers/ProcessSecondaryTracking.cs
rename to OpenSky.Agent.Simulator/Models/ProcessSecondaryTracking.cs
index 96c4891..7d2447d 100644
--- a/OpenSky.AgentMSFS/SimConnect/Helpers/ProcessSecondaryTracking.cs
+++ b/OpenSky.Agent.Simulator/Models/ProcessSecondaryTracking.cs
@@ -1,13 +1,11 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Helpers
+namespace OpenSky.Agent.Simulator.Models
{
- using OpenSky.AgentMSFS.SimConnect.Structs;
-
/// -------------------------------------------------------------------------------------------------
///
/// Process secondary tracking (for queue processing)
diff --git a/OpenSky.Agent.Simulator/Models/SecondaryTracking.cs b/OpenSky.Agent.Simulator/Models/SecondaryTracking.cs
new file mode 100644
index 0000000..3e8b25f
--- /dev/null
+++ b/OpenSky.Agent.Simulator/Models/SecondaryTracking.cs
@@ -0,0 +1,247 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace OpenSky.Agent.Simulator.Models
+{
+ using System;
+
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.FlightLogXML;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Secondary flight tracking model (checked less often).
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public class SecondaryTracking
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Is the APU running?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool ApuGenerator { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Is the auto pilot engaged?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool AutoPilot { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Is crash detection turned on?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool CrashDetection { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Is the electrical master battery turned on?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool ElectricalMasterBattery { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The engine1 combustion flag.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool EngineCombustion1 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The engine1 combustion flag.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool EngineCombustion2 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The engine1 combustion flag.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool EngineCombustion3 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The engine1 combustion flag.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool EngineCombustion4 { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Is there a running engine?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool EngineRunning => this.EngineCombustion1 || this.EngineCombustion2 || this.EngineCombustion3 || this.EngineCombustion4;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Flaps handle percentage.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FlapsHandle { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Flaps (trailing) percentage.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double FlapsPercentage { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gear handle in down position?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool GearHandle { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gear extended percentage.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double GearPercentage { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Are the beacon lights on?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool LightBeacon { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Are the landing lights on?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool LightLanding { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Are the nav lights on?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool LightNav { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Are the strobe lights on?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool LightStrobe { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Are the taxi lights on?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool LightTaxi { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// No smoking sign on?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool NoSmokingSign { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Is the parking brake set?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool ParkingBrake { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Pushback status.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public Pushback Pushback { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Seat belt sign on?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool SeatBeltSign { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Are the spoilers armed?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool SpoilersArmed { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The time of day.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public TimeOfDay TimeOfDay { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Is unlimited fuel turned on?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool UnlimitedFuel { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The UTC date/time.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public DateTime UtcDateTime
+ {
+ get
+ {
+ try
+ {
+ return new DateTime(this.UtcYear, this.UtcMonth, this.UtcDay).AddSeconds(this.UtcTime);
+ }
+ catch
+ {
+ return DateTime.MinValue;
+ }
+ }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The UTC day of the month.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public int UtcDay { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The UTC month of the year.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public int UtcMonth { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The UTC time in seconds since midnight.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double UtcTime { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The UTC year.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public int UtcYear { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/Models/SimbriefWaypointMarker.cs b/OpenSky.Agent.Simulator/Models/SimbriefWaypointMarker.cs
similarity index 99%
rename from OpenSky.AgentMSFS/Models/SimbriefWaypointMarker.cs
rename to OpenSky.Agent.Simulator/Models/SimbriefWaypointMarker.cs
index 0edc02b..1fd5f8e 100644
--- a/OpenSky.AgentMSFS/Models/SimbriefWaypointMarker.cs
+++ b/OpenSky.Agent.Simulator/Models/SimbriefWaypointMarker.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Models
+namespace OpenSky.Agent.Simulator.Models
{
using System.ComponentModel;
using System.Windows;
diff --git a/OpenSky.Agent.Simulator/Models/SlewAircraftIntoPosition.cs b/OpenSky.Agent.Simulator/Models/SlewAircraftIntoPosition.cs
new file mode 100644
index 0000000..961be38
--- /dev/null
+++ b/OpenSky.Agent.Simulator/Models/SlewAircraftIntoPosition.cs
@@ -0,0 +1,122 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace OpenSky.Agent.Simulator.Models
+{
+ using System.Device.Location;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Slew aircraft into position model.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public class SlewAircraftIntoPosition
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// True airspeed in knots.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double AirspeedTrue { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The bank angle in degrees.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double BankAngle { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the geo coordinate.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public GeoCoordinate GeoCoordinate => new(this.Latitude, this.Longitude, this.RadioHeight);
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The magnetic heading.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Heading { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The latitude in degrees.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Latitude { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The longitude in degrees.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double Longitude { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Is the plane on the ground?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool OnGround { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The pitch angle in degrees.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double PitchAngle { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The radio height in feet.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double RadioHeight { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The vertical speed in feet per second.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public double VerticalSpeedSeconds { get; set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Initializes this object from the given from primary tracking struct.
+ ///
+ ///
+ /// sushi.at, 02/04/2021.
+ ///
+ ///
+ /// The primary tracking struct.
+ ///
+ ///
+ /// A SlewPlaneIntoPosition struct.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static SlewAircraftIntoPosition FromPrimaryTracking(PrimaryTracking primary)
+ {
+ var slew = new SlewAircraftIntoPosition
+ {
+ Latitude = primary.Latitude,
+ Longitude = primary.Longitude,
+ RadioHeight = primary.RadioHeight,
+ Heading = primary.Heading,
+ AirspeedTrue = primary.AirspeedTrue,
+ PitchAngle = primary.PitchAngle,
+ BankAngle = primary.BankAngle,
+ VerticalSpeedSeconds = primary.VerticalSpeedSeconds,
+ OnGround = primary.OnGround
+ };
+ return slew;
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/Models/TrackingCondition.cs b/OpenSky.Agent.Simulator/Models/TrackingCondition.cs
similarity index 99%
rename from OpenSky.AgentMSFS/Models/TrackingCondition.cs
rename to OpenSky.Agent.Simulator/Models/TrackingCondition.cs
index 0b558b5..9261533 100644
--- a/OpenSky.AgentMSFS/Models/TrackingCondition.cs
+++ b/OpenSky.Agent.Simulator/Models/TrackingCondition.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Models
+namespace OpenSky.Agent.Simulator.Models
{
using System.ComponentModel;
using System.Runtime.CompilerServices;
diff --git a/OpenSky.AgentMSFS/Models/TrackingConditions.cs b/OpenSky.Agent.Simulator/Models/TrackingConditions.cs
similarity index 95%
rename from OpenSky.AgentMSFS/Models/TrackingConditions.cs
rename to OpenSky.Agent.Simulator/Models/TrackingConditions.cs
index 1219d55..83330cf 100644
--- a/OpenSky.AgentMSFS/Models/TrackingConditions.cs
+++ b/OpenSky.Agent.Simulator/Models/TrackingConditions.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Models
+namespace OpenSky.Agent.Simulator.Models
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Models/TrackingEventLogEntry.cs b/OpenSky.Agent.Simulator/Models/TrackingEventLogEntry.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Models/TrackingEventLogEntry.cs
rename to OpenSky.Agent.Simulator/Models/TrackingEventLogEntry.cs
index b8e0fbb..6a37874 100644
--- a/OpenSky.AgentMSFS/Models/TrackingEventLogEntry.cs
+++ b/OpenSky.Agent.Simulator/Models/TrackingEventLogEntry.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Models
+namespace OpenSky.Agent.Simulator.Models
{
using System;
using System.Windows.Media;
@@ -13,7 +13,7 @@ namespace OpenSky.AgentMSFS.Models
using Microsoft.Maps.MapControl.WPF;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Simulator.Tools;
using OpenSky.FlightLogXML;
/// -------------------------------------------------------------------------------------------------
diff --git a/OpenSky.AgentMSFS/Models/TrackingEventMarker.cs b/OpenSky.Agent.Simulator/Models/TrackingEventMarker.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Models/TrackingEventMarker.cs
rename to OpenSky.Agent.Simulator/Models/TrackingEventMarker.cs
index 5c46acb..05f9172 100644
--- a/OpenSky.AgentMSFS/Models/TrackingEventMarker.cs
+++ b/OpenSky.Agent.Simulator/Models/TrackingEventMarker.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Models
+namespace OpenSky.Agent.Simulator.Models
{
using System;
using System.Device.Location;
@@ -19,8 +19,7 @@ namespace OpenSky.AgentMSFS.Models
using Microsoft.Maps.MapControl.WPF;
- using OpenSky.AgentMSFS.SimConnect.Structs;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Simulator.Tools;
using OpenSkyApi;
@@ -199,7 +198,8 @@ public TrackingEventMarker(Airport airport, Color markerColor, Color textColor)
{
this.SetValue(ZIndexProperty, 998);
- var outerBorder = new Border { BorderBrush = new SolidColorBrush(markerColor), CornerRadius = new CornerRadius(1.5), BorderThickness = new Thickness(5), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch };
+ var outerBorder = new Border
+ { BorderBrush = new SolidColorBrush(markerColor), CornerRadius = new CornerRadius(1.5), BorderThickness = new Thickness(5), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch };
this.Children.Add(outerBorder);
var widthBinding = new Binding { Source = this, Path = new PropertyPath("ActualWidth"), Mode = BindingMode.OneWay };
BindingOperations.SetBinding(outerBorder, WidthProperty, widthBinding);
@@ -385,17 +385,17 @@ public TrackingEventMarker(Runway runway)
/// -------------------------------------------------------------------------------------------------
///
- /// Gets a value indicating whether this is an airport marker (we don't save those).
+ /// Gets a value indicating whether this is an airport detail marker (box or runways - we don't save those and they have a different zoom level setting).
///
/// -------------------------------------------------------------------------------------------------
- public bool IsAirportMarker => this.marker.IsAirportMarker;
+ public bool IsAirportDetailMarker { get; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets a value indicating whether this is an airport detail marker (box or runways - we don't save those and they have a different zoom level setting).
+ /// Gets a value indicating whether this is an airport marker (we don't save those).
///
/// -------------------------------------------------------------------------------------------------
- public bool IsAirportDetailMarker { get; }
+ public bool IsAirportMarker => this.marker.IsAirportMarker;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Models/VerticalProfile.cs b/OpenSky.Agent.Simulator/Models/VerticalProfile.cs
similarity index 93%
rename from OpenSky.AgentMSFS/Models/VerticalProfile.cs
rename to OpenSky.Agent.Simulator/Models/VerticalProfile.cs
index e094ee3..1c58bcc 100644
--- a/OpenSky.AgentMSFS/Models/VerticalProfile.cs
+++ b/OpenSky.Agent.Simulator/Models/VerticalProfile.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Models
+namespace OpenSky.Agent.Simulator.Models
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/SimConnect/Structs/WeightAndBalance.cs b/OpenSky.Agent.Simulator/Models/WeightAndBalance.cs
similarity index 73%
rename from OpenSky.AgentMSFS/SimConnect/Structs/WeightAndBalance.cs
rename to OpenSky.Agent.Simulator/Models/WeightAndBalance.cs
index f879b51..38492c3 100644
--- a/OpenSky.AgentMSFS/SimConnect/Structs/WeightAndBalance.cs
+++ b/OpenSky.Agent.Simulator/Models/WeightAndBalance.cs
@@ -1,135 +1,125 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect.Structs
+namespace OpenSky.Agent.Simulator.Models
{
- using System.Collections.Generic;
-
- using CTrue.FsConnect;
-
- using Microsoft.FlightSimulator.SimConnect;
-
/// -------------------------------------------------------------------------------------------------
///
- /// The weight and balance struct.
+ /// Weight and balance model.
///
///
- /// sushi.at, 20/03/2021.
+ /// sushi.at, 31/01/2022.
///
/// -------------------------------------------------------------------------------------------------
- public struct WeightAndBalance
+ public class WeightAndBalance
{
/// -------------------------------------------------------------------------------------------------
///
- /// Empty weight in pounds.
+ /// The center of gravity aft limit.
///
/// -------------------------------------------------------------------------------------------------
- public double EmptyWeight { get; set; }
+ public double CgAftLimit { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Total weight in pounds.
+ /// The center of gravity forward limit.
///
/// -------------------------------------------------------------------------------------------------
- public double TotalWeight { get; set; }
+ public double CgFwdLimit { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Max gross weight in pounds.
+ /// The center of gravity (longitudinal)
///
/// -------------------------------------------------------------------------------------------------
- public double MaxGrossWeight { get; set; }
+ public double CgPercent { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Fuel total capacity in gallons.
+ /// The center of gravity (lateral)
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTotalCapacity { get; set; }
+ public double CgPercentLateral { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Fuel total quantity on board in gallons.
+ /// Empty weight in pounds.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelTotalQuantity { get; set; }
+ public double EmptyWeight { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// Fuel weight (pounds/gallon).
+ /// Fuel total capacity in gallons.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelWeightPerGallon { get; set; }
+ public double FuelTotalCapacity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// The center of gravity aft limit.
+ /// Fuel total quantity on board in gallons.
///
/// -------------------------------------------------------------------------------------------------
- public double CgAftLimit { get; set; }
+ public double FuelTotalQuantity { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// The center of gravity forward limit.
+ /// The fuel weight in pounds.
///
/// -------------------------------------------------------------------------------------------------
- public double CgFwdLimit { get; set; }
+ public double FuelWeight => this.FuelTotalQuantity * this.FuelWeightPerGallon;
/// -------------------------------------------------------------------------------------------------
///
- /// The center of gravity (longitudinal)
+ /// Fuel weight (pounds/gallon).
///
/// -------------------------------------------------------------------------------------------------
- public double CgPercent { get; set; }
+ public double FuelWeightPerGallon { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// The center of gravity (lateral)
+ /// The maximum fuel weight in pounds.
///
/// -------------------------------------------------------------------------------------------------
- public double CgPercentLateral { get; set; }
-
- // ==================================================================================================
- // END OF STRUCT PROPERTIES - BELOW ARE GET-ONLY COMPUTED PROPERTIES FOR OPENSKY
- // ==================================================================================================
+ public double MaxFuelWeight => this.FuelTotalCapacity * this.FuelWeightPerGallon;
/// -------------------------------------------------------------------------------------------------
///
- /// The fuel weight in pounds.
+ /// Max gross weight in pounds.
///
/// -------------------------------------------------------------------------------------------------
- public double FuelWeight => this.FuelTotalQuantity * this.FuelWeightPerGallon;
+ public double MaxGrossWeight { get; set; }
/// -------------------------------------------------------------------------------------------------
///
- /// The maximum fuel weight in pounds.
+ /// The maximum payload weight in pounds.
///
/// -------------------------------------------------------------------------------------------------
- public double MaxFuelWeight => this.FuelTotalCapacity * this.FuelWeightPerGallon;
+ public double MaxPayloadWeight => this.MaxGrossWeight - this.EmptyWeight - this.FuelWeight;
/// -------------------------------------------------------------------------------------------------
///
- /// The payload weight in pounds.
+ /// Gets the payload percentage out of maximum allowed.
///
/// -------------------------------------------------------------------------------------------------
- public double PayloadWeight => this.TotalWeight - this.EmptyWeight - this.FuelWeight;
+ public double PayloadPercentOfMax => this.MaxPayloadWeight != 0 ? this.PayloadWeight / this.MaxPayloadWeight : 0;
/// -------------------------------------------------------------------------------------------------
///
- /// The maximum payload weight in pounds.
+ /// The payload weight in pounds.
///
/// -------------------------------------------------------------------------------------------------
- public double MaxPayloadWeight => this.MaxGrossWeight - this.EmptyWeight - this.FuelWeight;
+ public double PayloadWeight => this.TotalWeight - this.EmptyWeight - this.FuelWeight;
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the payload percentage out of maximum allowed.
+ /// Total weight in pounds.
///
/// -------------------------------------------------------------------------------------------------
- public double PayloadPercentOfMax => this.MaxPayloadWeight != 0 ? this.PayloadWeight / this.MaxPayloadWeight : 0;
+ public double TotalWeight { get; set; }
/// -------------------------------------------------------------------------------------------------
///
@@ -138,35 +128,4 @@ public struct WeightAndBalance
/// -------------------------------------------------------------------------------------------------
public double TotalWeightPercentOfMax => this.MaxGrossWeight != 0 ? this.TotalWeight / this.MaxGrossWeight : 0;
}
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The weight and balance struct SimConnect properties definition.
- ///
- ///
- /// sushi.at, 20/03/2021.
- ///
- /// -------------------------------------------------------------------------------------------------
- public static class WeightAndBalanceDefinition
- {
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets the definition list of sim properties.
- ///
- /// -------------------------------------------------------------------------------------------------
- public static List Definition =>
- new()
- {
- new SimVar("EMPTY WEIGHT", "Pounds", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("TOTAL WEIGHT", "Pounds", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("MAX GROSS WEIGHT", "Pounds", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TOTAL CAPACITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL TOTAL QUANTITY", "Gallons", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("FUEL WEIGHT PER GALLON", "Pounds", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("CG AFT LIMIT", "Percent over 100", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("CG FWD LIMIT", "Percent over 100", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("CG PERCENT", "Percent over 100", SIMCONNECT_DATATYPE.FLOAT64),
- new SimVar("CG PERCENT LATERAL", "Percent over 100", SIMCONNECT_DATATYPE.FLOAT64),
- };
- }
}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/OpenAPIs/ModelExtensions/AircraftType.cs b/OpenSky.Agent.Simulator/OpenAPIs/ModelExtensions/AircraftType.cs
similarity index 85%
rename from OpenSky.AgentMSFS/OpenAPIs/ModelExtensions/AircraftType.cs
rename to OpenSky.Agent.Simulator/OpenAPIs/ModelExtensions/AircraftType.cs
index 72eb7f0..32c0d2a 100644
--- a/OpenSky.AgentMSFS/OpenAPIs/ModelExtensions/AircraftType.cs
+++ b/OpenSky.Agent.Simulator/OpenAPIs/ModelExtensions/AircraftType.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
@@ -10,8 +10,6 @@ namespace OpenSkyApi
{
using System;
- using OpenSky.AgentMSFS.SimConnect;
-
/// -------------------------------------------------------------------------------------------------
///
/// Aircraft type model - local extensions.
@@ -152,34 +150,34 @@ public override int GetHashCode()
/// -------------------------------------------------------------------------------------------------
public bool MatchesAircraftInSimulator()
{
- if (SimConnect.Instance.Connected)
+ if (OpenSky.Agent.Simulator.Simulator.Instance.Connected)
{
- if (!string.Equals(!string.IsNullOrEmpty(SimConnect.Instance.PlaneIdentity.AtcTypeProperty) ? SimConnect.Instance.PlaneIdentity.AtcTypeProperty : "MISSING", this.AtcType, StringComparison.InvariantCultureIgnoreCase))
+ if (!string.Equals(!string.IsNullOrEmpty(OpenSky.Agent.Simulator.Simulator.Instance.AircraftIdentity.AtcType) ? OpenSky.Agent.Simulator.Simulator.Instance.AircraftIdentity.AtcType : "MISSING", this.AtcType, StringComparison.InvariantCultureIgnoreCase))
{
return false;
}
- if (!string.Equals(!string.IsNullOrEmpty(SimConnect.Instance.PlaneIdentity.AtcModelProperty) ? SimConnect.Instance.PlaneIdentity.AtcModelProperty : "MISSING", this.AtcModel, StringComparison.InvariantCultureIgnoreCase))
+ if (!string.Equals(!string.IsNullOrEmpty(OpenSky.Agent.Simulator.Simulator.Instance.AircraftIdentity.AtcModel) ? OpenSky.Agent.Simulator.Simulator.Instance.AircraftIdentity.AtcModel : "MISSING", this.AtcModel, StringComparison.InvariantCultureIgnoreCase))
{
return false;
}
- if (SimConnect.Instance.PlaneIdentity.EngineType != this.EngineType)
+ if (OpenSky.Agent.Simulator.Simulator.Instance.AircraftIdentity.EngineType != this.EngineType)
{
return false;
}
- if (SimConnect.Instance.PlaneIdentity.EngineCount != this.EngineCount)
+ if (OpenSky.Agent.Simulator.Simulator.Instance.AircraftIdentity.EngineCount != this.EngineCount)
{
return false;
}
- if (SimConnect.Instance.PlaneIdentity.FlapsAvailable != this.FlapsAvailable)
+ if (OpenSky.Agent.Simulator.Simulator.Instance.AircraftIdentity.FlapsAvailable != this.FlapsAvailable)
{
return false;
}
- if (SimConnect.Instance.PlaneIdentity.GearRetractable != this.IsGearRetractable)
+ if (OpenSky.Agent.Simulator.Simulator.Instance.AircraftIdentity.GearRetractable != this.IsGearRetractable)
{
return false;
}
@@ -187,17 +185,17 @@ public bool MatchesAircraftInSimulator()
// Skip these checks if detailed checks are TEMPORARILY disabled
if (!this.DetailedChecksDisabled)
{
- if (Math.Abs(SimConnect.Instance.WeightAndBalance.EmptyWeight - this.EmptyWeight) > 0.5)
+ if (Math.Abs(OpenSky.Agent.Simulator.Simulator.Instance.WeightAndBalance.EmptyWeight - this.EmptyWeight) > 0.5)
{
return false;
}
- if (Math.Abs(SimConnect.Instance.WeightAndBalance.FuelTotalCapacity - this.FuelTotalCapacity) > 0.5)
+ if (Math.Abs(OpenSky.Agent.Simulator.Simulator.Instance.WeightAndBalance.FuelTotalCapacity - this.FuelTotalCapacity) > 0.5)
{
return false;
}
- if (Math.Abs(SimConnect.Instance.WeightAndBalance.MaxGrossWeight - this.MaxGrossWeight) > 0.5)
+ if (Math.Abs(OpenSky.Agent.Simulator.Simulator.Instance.WeightAndBalance.MaxGrossWeight - this.MaxGrossWeight) > 0.5)
{
return false;
}
diff --git a/OpenSky.AgentMSFS/OpenAPIs/ModelExtensions/Airport.cs b/OpenSky.Agent.Simulator/OpenAPIs/ModelExtensions/Airport.cs
similarity index 99%
rename from OpenSky.AgentMSFS/OpenAPIs/ModelExtensions/Airport.cs
rename to OpenSky.Agent.Simulator/OpenAPIs/ModelExtensions/Airport.cs
index 60ee8a7..b74959c 100644
--- a/OpenSky.AgentMSFS/OpenAPIs/ModelExtensions/Airport.cs
+++ b/OpenSky.Agent.Simulator/OpenAPIs/ModelExtensions/Airport.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
diff --git a/OpenSky.AgentMSFS/OpenAPIs/ModelExtensions/Flight.cs b/OpenSky.Agent.Simulator/OpenAPIs/ModelExtensions/Flight.cs
similarity index 99%
rename from OpenSky.AgentMSFS/OpenAPIs/ModelExtensions/Flight.cs
rename to OpenSky.Agent.Simulator/OpenAPIs/ModelExtensions/Flight.cs
index b1324e7..bebb8a1 100644
--- a/OpenSky.AgentMSFS/OpenAPIs/ModelExtensions/Flight.cs
+++ b/OpenSky.Agent.Simulator/OpenAPIs/ModelExtensions/Flight.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
diff --git a/OpenSky.AgentMSFS/OpenAPIs/OpenSkyService.cs b/OpenSky.Agent.Simulator/OpenAPIs/OpenSkyService.cs
similarity index 57%
rename from OpenSky.AgentMSFS/OpenAPIs/OpenSkyService.cs
rename to OpenSky.Agent.Simulator/OpenAPIs/OpenSkyService.cs
index f3d4477..4bda408 100644
--- a/OpenSky.AgentMSFS/OpenAPIs/OpenSkyService.cs
+++ b/OpenSky.Agent.Simulator/OpenAPIs/OpenSkyService.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
@@ -10,8 +10,6 @@ namespace OpenSkyApi
{
using System.Net.Http;
- using OpenSky.AgentMSFS.Properties;
-
/// -------------------------------------------------------------------------------------------------
///
/// OpenSky API service client.
@@ -21,21 +19,8 @@ namespace OpenSkyApi
///
///
/// -------------------------------------------------------------------------------------------------
- public partial class OpenSkyService
+ public abstract partial class OpenSkyService
{
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Initializes static members of the class.
- ///
- ///
- /// sushi.at, 01/06/2021.
- ///
- /// -------------------------------------------------------------------------------------------------
- static OpenSkyService()
- {
- Instance = new OpenSkyService(new HttpClient());
- }
-
/// -------------------------------------------------------------------------------------------------
///
/// Initializes a new instance of the class.
@@ -47,18 +32,10 @@ static OpenSkyService()
/// The HTTP client.
///
/// -------------------------------------------------------------------------------------------------
- private OpenSkyService(HttpClient httpClient) : base(httpClient)
+ protected OpenSkyService(HttpClient httpClient) : base(httpClient)
{
- this.BaseUrl = Settings.Default.OpenSkyAPIUrl;
this._httpClient = httpClient;
this._settings = new System.Lazy(this.CreateSerializerSettings);
}
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets the single static instance.
- ///
- /// -------------------------------------------------------------------------------------------------
- public static OpenSkyService Instance { get; }
}
}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/OpenAPIs/OpenSkyServiceBase.cs b/OpenSky.Agent.Simulator/OpenAPIs/OpenSkyServiceBase.cs
similarity index 59%
rename from OpenSky.AgentMSFS/OpenAPIs/OpenSkyServiceBase.cs
rename to OpenSky.Agent.Simulator/OpenAPIs/OpenSkyServiceBase.cs
index 96d3544..c9440e9 100644
--- a/OpenSky.AgentMSFS/OpenAPIs/OpenSkyServiceBase.cs
+++ b/OpenSky.Agent.Simulator/OpenAPIs/OpenSkyServiceBase.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
@@ -10,17 +10,10 @@ namespace OpenSkyApi
{
using System;
using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Net;
using System.Net.Http;
- using System.Text;
using System.Threading;
using System.Threading.Tasks;
- using OpenSky.AgentMSFS;
- using OpenSky.AgentMSFS.Properties;
-
/// -------------------------------------------------------------------------------------------------
///
/// OpenSky service client base class (implements auto-token refresh and JWT bearer.
@@ -29,28 +22,23 @@ namespace OpenSkyApi
/// sushi.at, 01/06/2021.
///
/// -------------------------------------------------------------------------------------------------
- public class OpenSkyServiceBase
+ public abstract class OpenSkyServiceBase
{
/// -------------------------------------------------------------------------------------------------
///
/// The HTTP client.
///
/// -------------------------------------------------------------------------------------------------
- private readonly HttpClient httpClient;
+ protected readonly HttpClient httpClient;
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The refresh token mutex.
- ///
- /// -------------------------------------------------------------------------------------------------
- private readonly Mutex refreshTokenMutex = new(false);
+
/// -------------------------------------------------------------------------------------------------
///
/// JSON serializer settings.
///
/// -------------------------------------------------------------------------------------------------
- private readonly Lazy settings;
+ protected readonly Lazy settings;
/// -------------------------------------------------------------------------------------------------
///
@@ -60,7 +48,7 @@ public class OpenSkyServiceBase
/// sushi.at, 01/06/2021.
///
/// -------------------------------------------------------------------------------------------------
- public OpenSkyServiceBase()
+ protected OpenSkyServiceBase()
{
}
@@ -75,7 +63,7 @@ public OpenSkyServiceBase()
/// The HTTP client.
///
/// -------------------------------------------------------------------------------------------------
- public OpenSkyServiceBase(HttpClient httpClient)
+ protected OpenSkyServiceBase(HttpClient httpClient)
{
this.httpClient = httpClient;
@@ -110,53 +98,7 @@ public OpenSkyServiceBase(HttpClient httpClient)
/// An asynchronous result that yields the create HTTP request message.
///
/// -------------------------------------------------------------------------------------------------
- protected async Task CreateHttpRequestMessageAsync(CancellationToken cancellationToken)
- {
- var msg = new HttpRequestMessage();
-
- // Check if the token needs to be refreshed
- if (UserSessionService.Instance.CheckTokenNeedsRefresh())
- {
- try
- {
- await this.RefreshToken(cancellationToken);
- }
- catch (HttpRequestException ex)
- {
- if (ex.InnerException is WebException webEx)
- {
- if (webEx.Status is WebExceptionStatus.ConnectFailure or WebExceptionStatus.NameResolutionFailure or WebExceptionStatus.SendFailure or WebExceptionStatus.ReceiveFailure)
- {
- // Server not available? Try again later
- Debug.WriteLine($"Error refreshing tokens: {ex}");
- throw;
- }
-
- Debug.WriteLine($"Error refreshing tokens: {ex}");
- UserSessionService.Instance.Logout();
- throw;
- }
-
- Debug.WriteLine($"Error refreshing tokens: {ex}");
- UserSessionService.Instance.Logout();
- throw;
- }
- catch (Exception ex)
- {
- Debug.WriteLine($"Error refreshing tokens: {ex}");
- UserSessionService.Instance.Logout();
- throw;
- }
- }
-
- // Add the JWT token to the authorization header
- if (UserSessionService.Instance.IsUserLoggedIn)
- {
- msg.Headers.Add("Authorization", $"Bearer {UserSessionService.Instance.OpenSkyApiToken}");
- }
-
- return msg;
- }
+ protected abstract Task CreateHttpRequestMessageAsync(CancellationToken cancellationToken);
/// -------------------------------------------------------------------------------------------------
///
@@ -254,108 +196,7 @@ private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
/// An asynchronous result.
///
/// -------------------------------------------------------------------------------------------------
- private async Task RefreshToken(CancellationToken cancellationToken)
- {
- try
- {
- if (!this.refreshTokenMutex.WaitOne(30 * 1000))
- {
- // Timeout refreshing token
- Debug.WriteLine("Timeout waiting for refresh token mutex.");
- return;
- }
-
- // Now that we have the mutex, check if another refresh was successful in the meantime
- if (!UserSessionService.Instance.CheckTokenNeedsRefresh())
- {
- return;
- }
-
- var requestBody = new RefreshToken
- {
- Token = UserSessionService.Instance.OpenSkyApiToken,
- Refresh = UserSessionService.Instance.RefreshToken
- };
-
- var urlBuilder = new StringBuilder();
- var baseUrl = Settings.Default.OpenSkyAPIUrl;
- urlBuilder.Append(baseUrl != null ? baseUrl.TrimEnd('/') : "").Append("/Authentication/refreshToken");
-
- using var request = new HttpRequestMessage();
- var content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(requestBody, this.settings.Value));
- content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
- request.Content = content;
- request.Method = new HttpMethod("POST");
- request.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
-
- var url = urlBuilder.ToString();
- request.RequestUri = new Uri(url, UriKind.RelativeOrAbsolute);
-
- var response = await this.httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
- try
- {
- var headers = response.Headers.ToDictionary(h => h.Key, h => h.Value);
- if (response.Content is { Headers: { } })
- {
- foreach (var header in response.Content.Headers)
- {
- headers[header.Key] = header.Value;
- }
- }
-
- var status = (int)response.StatusCode;
- if (status == 200)
- {
- var objectResponse = await this.ReadObjectResponseAsync(response, headers, cancellationToken).ConfigureAwait(false);
- if (objectResponse.Object == null)
- {
- throw new ApiException("Response was null which was not expected.", status, objectResponse.Text, headers, null);
- }
-
- if (!objectResponse.Object.IsError)
- {
- UserSessionService.Instance.TokensWereRefreshed(objectResponse.Object.Data);
- }
- else
- {
- // Check if another refresh caused a server side concurrency issue but the other request completed the refresh successfully
- if (!UserSessionService.Instance.CheckTokenNeedsRefresh())
- {
- return;
- }
-
- throw new ApiException($"Unable to refresh OpenSky token: {objectResponse.Object.Message}", 401, objectResponse.Text, headers, null);
- }
- }
- else
- {
- // ReSharper disable once ConditionIsAlwaysTrueOrFalse
- var responseData = response.Content == null ? null : await response.Content.ReadAsStringAsync().ConfigureAwait(false);
- throw new ApiException("The HTTP status code of the response was not expected (" + status + ").", status, responseData, headers, null);
- }
- }
- finally
- {
- response.Dispose();
- }
- }
- catch (AbandonedMutexException)
- {
- //Ignore and retry
- await this.RefreshToken(cancellationToken);
- }
- finally
- {
- try
- {
- this.refreshTokenMutex.ReleaseMutex();
- }
- catch
- {
- // Ignore
- }
- }
- }
+ protected abstract Task RefreshToken(CancellationToken cancellationToken);
// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/OpenAPIs/ValidationProblemDetails.cs b/OpenSky.Agent.Simulator/OpenAPIs/ValidationProblemDetails.cs
similarity index 98%
rename from OpenSky.AgentMSFS/OpenAPIs/ValidationProblemDetails.cs
rename to OpenSky.Agent.Simulator/OpenAPIs/ValidationProblemDetails.cs
index ec31d4f..e9ea248 100644
--- a/OpenSky.AgentMSFS/OpenAPIs/ValidationProblemDetails.cs
+++ b/OpenSky.Agent.Simulator/OpenAPIs/ValidationProblemDetails.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.OpenAPIs
+namespace OpenSky.Agent.Simulator.OpenAPIs
{
using System;
using System.Collections.Generic;
diff --git a/OpenSky.AgentMSFS/OpenAPIs/swagger.cs b/OpenSky.Agent.Simulator/OpenAPIs/swagger.cs
similarity index 95%
rename from OpenSky.AgentMSFS/OpenAPIs/swagger.cs
rename to OpenSky.Agent.Simulator/OpenAPIs/swagger.cs
index 502bc07..d8f2284 100644
--- a/OpenSky.AgentMSFS/OpenAPIs/swagger.cs
+++ b/OpenSky.Agent.Simulator/OpenAPIs/swagger.cs
@@ -4198,6 +4198,229 @@ public async System.Threading.Tasks.Task LittleNavmapMS
}
}
+ /// Free money :)
+ /// Success
+ /// A server side error occurred.
+ public System.Threading.Tasks.Task BobsYourUncleAsync()
+ {
+ return BobsYourUncleAsync(System.Threading.CancellationToken.None);
+ }
+
+ /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
+ /// Free money :)
+ /// Success
+ /// A server side error occurred.
+ public async System.Threading.Tasks.Task BobsYourUncleAsync(System.Threading.CancellationToken cancellationToken)
+ {
+ var urlBuilder_ = new System.Text.StringBuilder();
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/bobsYourUncle");
+
+ var client_ = _httpClient;
+ var disposeClient_ = false;
+ try
+ {
+ using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
+ {
+ request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "text/plain");
+ request_.Method = new System.Net.Http.HttpMethod("POST");
+ request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
+
+ PrepareRequest(client_, request_, urlBuilder_);
+ var url_ = urlBuilder_.ToString();
+ request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
+ PrepareRequest(client_, request_, url_);
+
+ var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
+ var disposeResponse_ = true;
+ try
+ {
+ var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
+ if (response_.Content != null && response_.Content.Headers != null)
+ {
+ foreach (var item_ in response_.Content.Headers)
+ headers_[item_.Key] = item_.Value;
+ }
+
+ ProcessResponse(client_, response_);
+
+ var status_ = (int)response_.StatusCode;
+ if (status_ == 200)
+ {
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false);
+ if (objectResponse_.Object == null)
+ {
+ throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
+ }
+ return objectResponse_.Object;
+ }
+ else
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
+ }
+ }
+ finally
+ {
+ if (disposeResponse_)
+ response_.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (disposeClient_)
+ client_.Dispose();
+ }
+ }
+
+ /// Get the current account balances.
+ /// Success
+ /// A server side error occurred.
+ public System.Threading.Tasks.Task GetAccountBalancesAsync()
+ {
+ return GetAccountBalancesAsync(System.Threading.CancellationToken.None);
+ }
+
+ /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
+ /// Get the current account balances.
+ /// Success
+ /// A server side error occurred.
+ public async System.Threading.Tasks.Task GetAccountBalancesAsync(System.Threading.CancellationToken cancellationToken)
+ {
+ var urlBuilder_ = new System.Text.StringBuilder();
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/balances");
+
+ var client_ = _httpClient;
+ var disposeClient_ = false;
+ try
+ {
+ using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
+ {
+ request_.Method = new System.Net.Http.HttpMethod("GET");
+ request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
+
+ PrepareRequest(client_, request_, urlBuilder_);
+ var url_ = urlBuilder_.ToString();
+ request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
+ PrepareRequest(client_, request_, url_);
+
+ var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
+ var disposeResponse_ = true;
+ try
+ {
+ var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
+ if (response_.Content != null && response_.Content.Headers != null)
+ {
+ foreach (var item_ in response_.Content.Headers)
+ headers_[item_.Key] = item_.Value;
+ }
+
+ ProcessResponse(client_, response_);
+
+ var status_ = (int)response_.StatusCode;
+ if (status_ == 200)
+ {
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false);
+ if (objectResponse_.Object == null)
+ {
+ throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
+ }
+ return objectResponse_.Object;
+ }
+ else
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
+ }
+ }
+ finally
+ {
+ if (disposeResponse_)
+ response_.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (disposeClient_)
+ client_.Dispose();
+ }
+ }
+
+ /// Get financial overview (with transactions of the last 30 days)
+ /// Success
+ /// A server side error occurred.
+ public System.Threading.Tasks.Task GetFinancialOverviewAsync()
+ {
+ return GetFinancialOverviewAsync(System.Threading.CancellationToken.None);
+ }
+
+ /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
+ /// Get financial overview (with transactions of the last 30 days)
+ /// Success
+ /// A server side error occurred.
+ public async System.Threading.Tasks.Task GetFinancialOverviewAsync(System.Threading.CancellationToken cancellationToken)
+ {
+ var urlBuilder_ = new System.Text.StringBuilder();
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/overview");
+
+ var client_ = _httpClient;
+ var disposeClient_ = false;
+ try
+ {
+ using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
+ {
+ request_.Method = new System.Net.Http.HttpMethod("GET");
+ request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
+
+ PrepareRequest(client_, request_, urlBuilder_);
+ var url_ = urlBuilder_.ToString();
+ request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
+ PrepareRequest(client_, request_, url_);
+
+ var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
+ var disposeResponse_ = true;
+ try
+ {
+ var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
+ if (response_.Content != null && response_.Content.Headers != null)
+ {
+ foreach (var item_ in response_.Content.Headers)
+ headers_[item_.Key] = item_.Value;
+ }
+
+ ProcessResponse(client_, response_);
+
+ var status_ = (int)response_.StatusCode;
+ if (status_ == 200)
+ {
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false);
+ if (objectResponse_.Object == null)
+ {
+ throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
+ }
+ return objectResponse_.Object;
+ }
+ else
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
+ }
+ }
+ finally
+ {
+ if (disposeResponse_)
+ response_.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (disposeClient_)
+ client_.Dispose();
+ }
+ }
+
/// Abort flight, return to planning stage (with potential penalties depending on flight phase
/// and location)
/// Identifier for the flight (plan).
@@ -5951,22 +6174,22 @@ public async System.Threading.Tasks.Task
}
}
- /// Get world population overview.
+ /// Get world statistics overview.
/// Success
/// A server side error occurred.
- public System.Threading.Tasks.Task GetWorldPopulationOverviewAsync()
+ public System.Threading.Tasks.Task GetWorldStatisticsOverviewAsync()
{
- return GetWorldPopulationOverviewAsync(System.Threading.CancellationToken.None);
+ return GetWorldStatisticsOverviewAsync(System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
- /// Get world population overview.
+ /// Get world statistics overview.
/// Success
/// A server side error occurred.
- public async System.Threading.Tasks.Task GetWorldPopulationOverviewAsync(System.Threading.CancellationToken cancellationToken)
+ public async System.Threading.Tasks.Task GetWorldStatisticsOverviewAsync(System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/WorldPopulation");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/WorldStatistics");
var client_ = _httpClient;
var disposeClient_ = false;
@@ -5998,7 +6221,7 @@ public async System.Threading.Tasks.Task Get
var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -6045,7 +6268,7 @@ public async System.Threading.Tasks.Task PopulateAirportWithA
throw new System.ArgumentNullException("icao");
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/WorldPopulation/populateAircraft/{icao}");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/WorldStatistics/populateAircraft/{icao}");
urlBuilder_.Replace("{icao}", System.Uri.EscapeDataString(ConvertToString(icao, System.Globalization.CultureInfo.InvariantCulture)));
var client_ = _httpClient;
@@ -6208,10 +6431,55 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu
}
}
+ /// Account balances model.
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.2.1.0 (Newtonsoft.Json v11.0.0.0)")]
+ public partial class AccountBalances
+ {
+ /// Gets or sets the account balance (of the user).
+ [Newtonsoft.Json.JsonProperty("accountBalance", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public long AccountBalance { get; set; }
+
+ /// Gets or sets the airline account balance (if user has the permission).
+ [Newtonsoft.Json.JsonProperty("airlineAccountBalance", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public long? AirlineAccountBalance { get; set; }
+
+
+ }
+
+ /// API standard response model.
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.2.1.0 (Newtonsoft.Json v11.0.0.0)")]
+ public partial class AccountBalancesApiResponse
+ {
+ [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public AccountBalances Data { get; set; }
+
+ /// Gets or sets the error details (NULL if no error).
+ [Newtonsoft.Json.JsonProperty("errorDetails", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string ErrorDetails { get; set; }
+
+ /// Gets or sets a value indicating whether this response is reporting an error.
+ [Newtonsoft.Json.JsonProperty("isError", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public bool IsError { get; set; }
+
+ /// Gets or sets the message.
+ [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string Message { get; set; }
+
+ /// Gets or sets the status.
+ [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string Status { get; set; }
+
+
+ }
+
/// Account overview model.
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.2.1.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class AccountOverview
{
+ /// Gets or sets the name of the airline (if the user is a member of one).
+ [Newtonsoft.Json.JsonProperty("airlineName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string AirlineName { get; set; }
+
/// Gets or sets the Date/Time of when the user joined.
[Newtonsoft.Json.JsonProperty("joined", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.DateTimeOffset Joined { get; set; }
@@ -6293,6 +6561,14 @@ public partial class Aircraft
[Newtonsoft.Json.JsonProperty("latitude", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double Latitude { get; set; }
+ /// Gets or sets the life time expense (for the current owner only).
+ [Newtonsoft.Json.JsonProperty("lifeTimeExpense", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public long LifeTimeExpense { get; set; }
+
+ /// Gets or sets the life time income (for the current owner only).
+ [Newtonsoft.Json.JsonProperty("lifeTimeIncome", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public long LifeTimeIncome { get; set; }
+
/// Gets or sets the Date/Time until the aircraft is loading payload (cargo or pax).
[Newtonsoft.Json.JsonProperty("loadingUntil", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.DateTimeOffset? LoadingUntil { get; set; }
@@ -6731,7 +7007,7 @@ public partial class AirlineMemberAirlinePermissionHashSetDictionaryApiResponse
}
- /// Airline roles. 10 = BuyAircraft, 11 = SellAircraft, 12 = RentAircraft, 13 = RentOutAircraft, 14 = AssignAircraft, 15 = RenameAircraft, 20 = BuyFBO, 21 = SellFBO, 22 = RentFBO, 23 = RentOutFBO, 24 = RenameFBO, 25 = OrderFuel, 30 = AcceptJobs, 31 = Dispatch, 32 = OutsourceJobs, 33 = AbortJobs, 40 = ModifyAircraft, 41 = MaintainAircraft, 42 = ReplaceAircraftParts, 43 = PerformGroundOperations, 90 = ChangePermissions, 91 = BoardMember, 92 = AllPermissions
+ /// Airline roles. 10 = BuyAircraft, 11 = SellAircraft, 12 = RentAircraft, 13 = RentOutAircraft, 14 = AssignAircraft, 15 = RenameAircraft, 20 = BuyFBO, 21 = SellFBO, 22 = RentFBO, 23 = RentOutFBO, 24 = RenameFBO, 25 = OrderFuel, 30 = AcceptJobs, 31 = Dispatch, 32 = OutsourceJobs, 33 = AbortJobs, 40 = ModifyAircraft, 41 = MaintainAircraft, 42 = ReplaceAircraftParts, 43 = PerformGroundOperations, 50 = FinancialRecords, 90 = ChangePermissions, 91 = BoardMember, 92 = AllPermissions
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.2.1.0 (Newtonsoft.Json v11.0.0.0)")]
public enum AirlinePermission
{
@@ -6775,6 +7051,8 @@ public enum AirlinePermission
PerformGroundOperations = 43,
+ FinancialRecords = 50,
+
ChangePermissions = 90,
BoardMember = 91,
@@ -6822,6 +7100,10 @@ public partial class Airport
[Newtonsoft.Json.JsonProperty("atisFrequency", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? AtisFrequency { get; set; }
+ /// Gets or sets the AV gas price in SkyBucks/Gallon.
+ [Newtonsoft.Json.JsonProperty("avGasPrice", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public float AvGasPrice { get; set; }
+
/// Gets or sets the city.
[Newtonsoft.Json.JsonProperty("city", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.StringLength(50)]
@@ -6860,6 +7142,10 @@ public partial class Airport
[Newtonsoft.Json.JsonProperty("isMilitary", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool IsMilitary { get; set; }
+ /// Gets or sets the jet fuel price in SkyBucks/Gallon.
+ [Newtonsoft.Json.JsonProperty("jetFuelPrice", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public float JetFuelPrice { get; set; }
+
/// Gets or sets the latitude of the airport.
[Newtonsoft.Json.JsonProperty("latitude", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double Latitude { get; set; }
@@ -7771,6 +8057,132 @@ public partial class FinalReport
public string FlightLog { get; set; }
+ }
+
+ /// Financial categories. 0 = None, 1 = Aircraft, 2 = Fuel, 3 = Maintenance, 4 = AirportFees, 5 = Salaries, 6 = Loan, 7 = Interest, 8 = Shares, 9 = Dividend, 10 = FBO, 11 = Cargo, 12 = Passengers, 13 = SpecialtyJobs, 14 = Fines
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.2.1.0 (Newtonsoft.Json v11.0.0.0)")]
+ public enum FinancialCategory
+ {
+ None = 0,
+
+ Aircraft = 1,
+
+ Fuel = 2,
+
+ Maintenance = 3,
+
+ AirportFees = 4,
+
+ Salaries = 5,
+
+ Loan = 6,
+
+ Interest = 7,
+
+ Shares = 8,
+
+ Dividend = 9,
+
+ FBO = 10,
+
+ Cargo = 11,
+
+ Passengers = 12,
+
+ SpecialtyJobs = 13,
+
+ Fines = 14,
+
+ }
+
+ /// Financial overview model.
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.2.1.0 (Newtonsoft.Json v11.0.0.0)")]
+ public partial class FinancialOverview
+ {
+ /// Gets or sets the account balance (of the user).
+ [Newtonsoft.Json.JsonProperty("accountBalance", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public long AccountBalance { get; set; }
+
+ /// Gets or sets the airline account balance (if user has the permission).
+ [Newtonsoft.Json.JsonProperty("airlineAccountBalance", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public long? AirlineAccountBalance { get; set; }
+
+ /// Gets or sets the recent airline financial records (if user has the permission).
+ [Newtonsoft.Json.JsonProperty("recentAirlineFinancialRecords", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.Collections.Generic.ICollection RecentAirlineFinancialRecords { get; set; }
+
+ /// Gets or sets the recent financial records (of the user).
+ [Newtonsoft.Json.JsonProperty("recentFinancialRecords", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.Collections.Generic.ICollection RecentFinancialRecords { get; set; }
+
+
+ }
+
+ /// API standard response model.
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.2.1.0 (Newtonsoft.Json v11.0.0.0)")]
+ public partial class FinancialOverviewApiResponse
+ {
+ [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public FinancialOverview Data { get; set; }
+
+ /// Gets or sets the error details (NULL if no error).
+ [Newtonsoft.Json.JsonProperty("errorDetails", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string ErrorDetails { get; set; }
+
+ /// Gets or sets a value indicating whether this response is reporting an error.
+ [Newtonsoft.Json.JsonProperty("isError", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public bool IsError { get; set; }
+
+ /// Gets or sets the message.
+ [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string Message { get; set; }
+
+ /// Gets or sets the status.
+ [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string Status { get; set; }
+
+
+ }
+
+ /// Financial record model.
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.2.1.0 (Newtonsoft.Json v11.0.0.0)")]
+ public partial class FinancialRecord
+ {
+ /// Gets or sets the aircraft registry (optional, if record relates to an aircraft).
+ [Newtonsoft.Json.JsonProperty("aircraftRegistry", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ [System.ComponentModel.DataAnnotations.StringLength(10, MinimumLength = 5)]
+ public string AircraftRegistry { get; set; }
+
+ [Newtonsoft.Json.JsonProperty("category", Required = Newtonsoft.Json.Required.Always)]
+ public FinancialCategory Category { get; set; }
+
+ /// Gets or sets the child records.
+ [Newtonsoft.Json.JsonProperty("childRecords", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.Collections.Generic.ICollection ChildRecords { get; set; }
+
+ /// Gets or sets the description of the record.
+ [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Always)]
+ [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
+ public string Description { get; set; }
+
+ /// Gets or sets the expense amount in SkyBucks.
+ [Newtonsoft.Json.JsonProperty("expense", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public long Expense { get; set; }
+
+ /// Gets or sets the identifier for the financial record.
+ [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)]
+ [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
+ public System.Guid Id { get; set; }
+
+ /// Gets or sets the income amount in SkyBucks.
+ [Newtonsoft.Json.JsonProperty("income", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public long Income { get; set; }
+
+ /// Gets or sets the timestamp of the record.
+ [Newtonsoft.Json.JsonProperty("timestamp", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.DateTimeOffset Timestamp { get; set; }
+
+
}
/// Flight model.
@@ -8774,7 +9186,7 @@ public partial class PieChartValue
/// Gets or sets the value.
[Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public int Value { get; set; }
+ public long Value { get; set; }
}
@@ -9563,9 +9975,9 @@ public partial class WorldMapFlightIEnumerableApiResponse
}
- /// World population overview model.
+ /// World statistics overview model.
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.2.1.0 (Newtonsoft.Json v11.0.0.0)")]
- public partial class WorldPopulationOverview
+ public partial class WorldStatisticsOverview
{
/// Gets or sets a pie chart series for aircraft categories.
[Newtonsoft.Json.JsonProperty("aircraftCategories", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
@@ -9583,10 +9995,38 @@ public partial class WorldPopulationOverview
[Newtonsoft.Json.JsonProperty("approachTypes", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection ApproachTypes { get; set; }
+ /// Gets or sets the completed flights.
+ [Newtonsoft.Json.JsonProperty("completedFlights", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public int CompletedFlights { get; set; }
+
+ /// Gets or sets a pie chart series for flight aircraft categories.
+ [Newtonsoft.Json.JsonProperty("flightAircraftCategories", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.Collections.Generic.ICollection FlightAircraftCategories { get; set; }
+
+ /// Gets or sets a pie chart series for flight operators.
+ [Newtonsoft.Json.JsonProperty("flightOperators", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.Collections.Generic.ICollection FlightOperators { get; set; }
+
/// Gets or sets a pie chart series for fuel availability at airports.
[Newtonsoft.Json.JsonProperty("fuelAvailability", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection FuelAvailability { get; set; }
+ /// Gets or sets a pie chart series for job categories.
+ [Newtonsoft.Json.JsonProperty("jobAircraftCategories", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.Collections.Generic.ICollection JobAircraftCategories { get; set; }
+
+ /// Gets or sets a pie chart series for job operators.
+ [Newtonsoft.Json.JsonProperty("jobOperators", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.Collections.Generic.ICollection JobOperators { get; set; }
+
+ /// Gets or sets the jobs generated.
+ [Newtonsoft.Json.JsonProperty("jobsGenerated", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public int JobsGenerated { get; set; }
+
+ /// Gets or sets a pie chart series for job types.
+ [Newtonsoft.Json.JsonProperty("jobTypes", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.Collections.Generic.ICollection JobTypes { get; set; }
+
/// Gets or sets a pie chart series for runway lights.
[Newtonsoft.Json.JsonProperty("runwayLights", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection RunwayLights { get; set; }
@@ -9607,6 +10047,10 @@ public partial class WorldPopulationOverview
[Newtonsoft.Json.JsonProperty("totalApproaches", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int TotalApproaches { get; set; }
+ /// Gets or sets the total number of jobs.
+ [Newtonsoft.Json.JsonProperty("totalJobs", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public int TotalJobs { get; set; }
+
/// Gets or sets the total number of runways.
[Newtonsoft.Json.JsonProperty("totalRunways", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int TotalRunways { get; set; }
@@ -9616,10 +10060,10 @@ public partial class WorldPopulationOverview
/// API standard response model.
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.2.1.0 (Newtonsoft.Json v11.0.0.0)")]
- public partial class WorldPopulationOverviewApiResponse
+ public partial class WorldStatisticsOverviewApiResponse
{
[Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public WorldPopulationOverview Data { get; set; }
+ public WorldStatisticsOverview Data { get; set; }
/// Gets or sets the error details (NULL if no error).
[Newtonsoft.Json.JsonProperty("errorDetails", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
diff --git a/OpenSky.AgentMSFS/OpenAPIs/swagger.json b/OpenSky.Agent.Simulator/OpenAPIs/swagger.json
similarity index 94%
rename from OpenSky.AgentMSFS/OpenAPIs/swagger.json
rename to OpenSky.Agent.Simulator/OpenAPIs/swagger.json
index cb13e19..881ad01 100644
--- a/OpenSky.AgentMSFS/OpenAPIs/swagger.json
+++ b/OpenSky.Agent.Simulator/OpenAPIs/swagger.json
@@ -2283,6 +2283,102 @@
}
}
},
+ "/bobsYourUncle": {
+ "post": {
+ "tags": [
+ "Financial"
+ ],
+ "summary": "Free money :)",
+ "description": "sushi.at, 25/01/2022.",
+ "operationId": "BobsYourUncle",
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "$ref": "#/components/schemas/StringApiResponse"
+ }
+ },
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/StringApiResponse"
+ }
+ },
+ "text/json": {
+ "schema": {
+ "$ref": "#/components/schemas/StringApiResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/balances": {
+ "get": {
+ "tags": [
+ "Financial"
+ ],
+ "summary": "Get the current account balances.",
+ "description": "sushi.at, 25/01/2022.",
+ "operationId": "GetAccountBalances",
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "$ref": "#/components/schemas/AccountBalancesApiResponse"
+ }
+ },
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AccountBalancesApiResponse"
+ }
+ },
+ "text/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AccountBalancesApiResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/overview": {
+ "get": {
+ "tags": [
+ "Financial"
+ ],
+ "summary": "Get financial overview (with transactions of the last 30 days)",
+ "description": "sushi.at, 24/01/2022.",
+ "operationId": "GetFinancialOverview",
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "$ref": "#/components/schemas/FinancialOverviewApiResponse"
+ }
+ },
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/FinancialOverviewApiResponse"
+ }
+ },
+ "text/json": {
+ "schema": {
+ "$ref": "#/components/schemas/FinancialOverviewApiResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
"/Flight/abort/{flightID}": {
"post": {
"tags": [
@@ -3243,31 +3339,31 @@
}
}
},
- "/WorldPopulation": {
+ "/WorldStatistics": {
"get": {
"tags": [
- "WorldPopulation"
+ "WorldStatistics"
],
- "summary": "Get world population overview.",
+ "summary": "Get world statistics overview.",
"description": "sushi.at, 02/07/2021.",
- "operationId": "GetWorldPopulationOverview",
+ "operationId": "GetWorldStatisticsOverview",
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
- "$ref": "#/components/schemas/WorldPopulationOverviewApiResponse"
+ "$ref": "#/components/schemas/WorldStatisticsOverviewApiResponse"
}
},
"application/json": {
"schema": {
- "$ref": "#/components/schemas/WorldPopulationOverviewApiResponse"
+ "$ref": "#/components/schemas/WorldStatisticsOverviewApiResponse"
}
},
"text/json": {
"schema": {
- "$ref": "#/components/schemas/WorldPopulationOverviewApiResponse"
+ "$ref": "#/components/schemas/WorldStatisticsOverviewApiResponse"
}
}
}
@@ -3275,10 +3371,10 @@
}
}
},
- "/WorldPopulation/populateAircraft/{icao}": {
+ "/WorldStatistics/populateAircraft/{icao}": {
"post": {
"tags": [
- "WorldPopulation"
+ "WorldStatistics"
],
"summary": "Manually request to populate an airport and return info text results.",
"description": "sushi.at, 05/07/2021.",
@@ -3321,9 +3417,61 @@
},
"components": {
"schemas": {
+ "AccountBalances": {
+ "type": "object",
+ "properties": {
+ "accountBalance": {
+ "type": "integer",
+ "description": "Gets or sets the account balance (of the user).",
+ "format": "int64"
+ },
+ "airlineAccountBalance": {
+ "type": "integer",
+ "description": "Gets or sets the airline account balance (if user has the permission).",
+ "format": "int64",
+ "nullable": true
+ }
+ },
+ "additionalProperties": false,
+ "description": "Account balances model."
+ },
+ "AccountBalancesApiResponse": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/components/schemas/AccountBalances"
+ },
+ "errorDetails": {
+ "type": "string",
+ "description": "Gets or sets the error details (NULL if no error).",
+ "nullable": true
+ },
+ "isError": {
+ "type": "boolean",
+ "description": "Gets or sets a value indicating whether this response is reporting an error."
+ },
+ "message": {
+ "type": "string",
+ "description": "Gets or sets the message.",
+ "nullable": true
+ },
+ "status": {
+ "type": "string",
+ "description": "Gets or sets the status.",
+ "nullable": true
+ }
+ },
+ "additionalProperties": false,
+ "description": "API standard response model."
+ },
"AccountOverview": {
"type": "object",
"properties": {
+ "airlineName": {
+ "type": "string",
+ "description": "Gets or sets the name of the airline (if the user is a member of one).",
+ "nullable": true
+ },
"joined": {
"type": "string",
"description": "Gets or sets the Date/Time of when the user joined.",
@@ -3426,6 +3574,16 @@
"format": "double",
"readOnly": true
},
+ "lifeTimeExpense": {
+ "type": "integer",
+ "description": "Gets or sets the life time expense (for the current owner only).",
+ "format": "int64"
+ },
+ "lifeTimeIncome": {
+ "type": "integer",
+ "description": "Gets or sets the life time income (for the current owner only).",
+ "format": "int64"
+ },
"loadingUntil": {
"type": "string",
"description": "Gets or sets the Date/Time until the aircraft is loading payload (cargo or pax).",
@@ -3994,12 +4152,13 @@
41,
42,
43,
+ 50,
90,
91,
92
],
"type": "integer",
- "description": "Airline roles. 10 = BuyAircraft, 11 = SellAircraft, 12 = RentAircraft, 13 = RentOutAircraft, 14 = AssignAircraft, 15 = RenameAircraft, 20 = BuyFBO, 21 = SellFBO, 22 = RentFBO, 23 = RentOutFBO, 24 = RenameFBO, 25 = OrderFuel, 30 = AcceptJobs, 31 = Dispatch, 32 = OutsourceJobs, 33 = AbortJobs, 40 = ModifyAircraft, 41 = MaintainAircraft, 42 = ReplaceAircraftParts, 43 = PerformGroundOperations, 90 = ChangePermissions, 91 = BoardMember, 92 = AllPermissions",
+ "description": "Airline roles. 10 = BuyAircraft, 11 = SellAircraft, 12 = RentAircraft, 13 = RentOutAircraft, 14 = AssignAircraft, 15 = RenameAircraft, 20 = BuyFBO, 21 = SellFBO, 22 = RentFBO, 23 = RentOutFBO, 24 = RenameFBO, 25 = OrderFuel, 30 = AcceptJobs, 31 = Dispatch, 32 = OutsourceJobs, 33 = AbortJobs, 40 = ModifyAircraft, 41 = MaintainAircraft, 42 = ReplaceAircraftParts, 43 = PerformGroundOperations, 50 = FinancialRecords, 90 = ChangePermissions, 91 = BoardMember, 92 = AllPermissions",
"format": "int32",
"x-enumNames": [
"BuyAircraft",
@@ -4022,6 +4181,7 @@
"MaintainAircraft",
"ReplaceAircraftParts",
"PerformGroundOperations",
+ "FinancialRecords",
"ChangePermissions",
"BoardMember",
"AllPermissions"
@@ -4047,6 +4207,7 @@
"MaintainAircraft",
"ReplaceAircraftParts",
"PerformGroundOperations",
+ "FinancialRecords",
"ChangePermissions",
"BoardMember",
"AllPermissions"
@@ -4105,6 +4266,11 @@
"format": "int32",
"nullable": true
},
+ "avGasPrice": {
+ "type": "number",
+ "description": "Gets or sets the AV gas price in SkyBucks/Gallon.",
+ "format": "float"
+ },
"city": {
"maxLength": 50,
"minLength": 0,
@@ -4147,6 +4313,11 @@
"type": "boolean",
"description": "Gets or sets a value indicating whether the airport is a military one."
},
+ "jetFuelPrice": {
+ "type": "number",
+ "description": "Gets or sets the jet fuel price in SkyBucks/Gallon.",
+ "format": "float"
+ },
"latitude": {
"type": "number",
"description": "Gets or sets the latitude of the airport.",
@@ -5406,6 +5577,179 @@
"additionalProperties": false,
"description": "Flight final report model."
},
+ "FinancialCategory": {
+ "enum": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14
+ ],
+ "type": "integer",
+ "description": "Financial categories. 0 = None, 1 = Aircraft, 2 = Fuel, 3 = Maintenance, 4 = AirportFees, 5 = Salaries, 6 = Loan, 7 = Interest, 8 = Shares, 9 = Dividend, 10 = FBO, 11 = Cargo, 12 = Passengers, 13 = SpecialtyJobs, 14 = Fines",
+ "format": "int32",
+ "x-enumNames": [
+ "None",
+ "Aircraft",
+ "Fuel",
+ "Maintenance",
+ "AirportFees",
+ "Salaries",
+ "Loan",
+ "Interest",
+ "Shares",
+ "Dividend",
+ "FBO",
+ "Cargo",
+ "Passengers",
+ "SpecialtyJobs",
+ "Fines"
+ ],
+ "x-enum-varnames": [
+ "None",
+ "Aircraft",
+ "Fuel",
+ "Maintenance",
+ "AirportFees",
+ "Salaries",
+ "Loan",
+ "Interest",
+ "Shares",
+ "Dividend",
+ "FBO",
+ "Cargo",
+ "Passengers",
+ "SpecialtyJobs",
+ "Fines"
+ ]
+ },
+ "FinancialOverview": {
+ "type": "object",
+ "properties": {
+ "accountBalance": {
+ "type": "integer",
+ "description": "Gets or sets the account balance (of the user).",
+ "format": "int64"
+ },
+ "airlineAccountBalance": {
+ "type": "integer",
+ "description": "Gets or sets the airline account balance (if user has the permission).",
+ "format": "int64",
+ "nullable": true
+ },
+ "recentAirlineFinancialRecords": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/FinancialRecord"
+ },
+ "description": "Gets or sets the recent airline financial records (if user has the permission).",
+ "nullable": true
+ },
+ "recentFinancialRecords": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/FinancialRecord"
+ },
+ "description": "Gets or sets the recent financial records (of the user).",
+ "nullable": true
+ }
+ },
+ "additionalProperties": false,
+ "description": "Financial overview model."
+ },
+ "FinancialOverviewApiResponse": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/components/schemas/FinancialOverview"
+ },
+ "errorDetails": {
+ "type": "string",
+ "description": "Gets or sets the error details (NULL if no error).",
+ "nullable": true
+ },
+ "isError": {
+ "type": "boolean",
+ "description": "Gets or sets a value indicating whether this response is reporting an error."
+ },
+ "message": {
+ "type": "string",
+ "description": "Gets or sets the message.",
+ "nullable": true
+ },
+ "status": {
+ "type": "string",
+ "description": "Gets or sets the status.",
+ "nullable": true
+ }
+ },
+ "additionalProperties": false,
+ "description": "API standard response model."
+ },
+ "FinancialRecord": {
+ "required": [
+ "category",
+ "description",
+ "id"
+ ],
+ "type": "object",
+ "properties": {
+ "aircraftRegistry": {
+ "maxLength": 10,
+ "minLength": 5,
+ "type": "string",
+ "description": "Gets or sets the aircraft registry (optional, if record relates to an aircraft).",
+ "nullable": true
+ },
+ "category": {
+ "$ref": "#/components/schemas/FinancialCategory"
+ },
+ "childRecords": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/FinancialRecord"
+ },
+ "description": "Gets or sets the child records.",
+ "nullable": true
+ },
+ "description": {
+ "type": "string",
+ "description": "Gets or sets the description of the record."
+ },
+ "expense": {
+ "type": "integer",
+ "description": "Gets or sets the expense amount in SkyBucks.",
+ "format": "int64"
+ },
+ "id": {
+ "type": "string",
+ "description": "Gets or sets the identifier for the financial record.",
+ "format": "uuid"
+ },
+ "income": {
+ "type": "integer",
+ "description": "Gets or sets the income amount in SkyBucks.",
+ "format": "int64"
+ },
+ "timestamp": {
+ "type": "string",
+ "description": "Gets or sets the timestamp of the record.",
+ "format": "date-time"
+ }
+ },
+ "additionalProperties": false,
+ "description": "Financial record model."
+ },
"Flight": {
"required": [
"id"
@@ -6693,7 +7037,7 @@
"value": {
"type": "integer",
"description": "Gets or sets the value.",
- "format": "int32"
+ "format": "int64"
}
},
"additionalProperties": false,
@@ -7670,7 +8014,7 @@
"additionalProperties": false,
"description": "API standard response model."
},
- "WorldPopulationOverview": {
+ "WorldStatisticsOverview": {
"type": "object",
"properties": {
"aircraftCategories": {
@@ -7705,6 +8049,27 @@
"description": "Gets or sets a pie chart series for approach types.",
"nullable": true
},
+ "completedFlights": {
+ "type": "integer",
+ "description": "Gets or sets the completed flights.",
+ "format": "int32"
+ },
+ "flightAircraftCategories": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PieChartValue"
+ },
+ "description": "Gets or sets a pie chart series for flight aircraft categories.",
+ "nullable": true
+ },
+ "flightOperators": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PieChartValue"
+ },
+ "description": "Gets or sets a pie chart series for flight operators.",
+ "nullable": true
+ },
"fuelAvailability": {
"type": "array",
"items": {
@@ -7713,6 +8078,35 @@
"description": "Gets or sets a pie chart series for fuel availability at airports.",
"nullable": true
},
+ "jobAircraftCategories": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PieChartValue"
+ },
+ "description": "Gets or sets a pie chart series for job categories.",
+ "nullable": true
+ },
+ "jobOperators": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PieChartValue"
+ },
+ "description": "Gets or sets a pie chart series for job operators.",
+ "nullable": true
+ },
+ "jobsGenerated": {
+ "type": "integer",
+ "description": "Gets or sets the jobs generated.",
+ "format": "int32"
+ },
+ "jobTypes": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PieChartValue"
+ },
+ "description": "Gets or sets a pie chart series for job types.",
+ "nullable": true
+ },
"runwayLights": {
"type": "array",
"items": {
@@ -7744,6 +8138,11 @@
"description": "Gets or sets the total number of approaches.",
"format": "int32"
},
+ "totalJobs": {
+ "type": "integer",
+ "description": "Gets or sets the total number of jobs.",
+ "format": "int32"
+ },
"totalRunways": {
"type": "integer",
"description": "Gets or sets the total number of runways.",
@@ -7751,13 +8150,13 @@
}
},
"additionalProperties": false,
- "description": "World population overview model."
+ "description": "World statistics overview model."
},
- "WorldPopulationOverviewApiResponse": {
+ "WorldStatisticsOverviewApiResponse": {
"type": "object",
"properties": {
"data": {
- "$ref": "#/components/schemas/WorldPopulationOverview"
+ "$ref": "#/components/schemas/WorldStatisticsOverview"
},
"errorDetails": {
"type": "string",
diff --git a/OpenSky.Agent.Simulator/OpenSky.Agent.Simulator.csproj b/OpenSky.Agent.Simulator/OpenSky.Agent.Simulator.csproj
new file mode 100644
index 0000000..c3dc59c
--- /dev/null
+++ b/OpenSky.Agent.Simulator/OpenSky.Agent.Simulator.csproj
@@ -0,0 +1,166 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {30C467E8-2EEE-41E5-BE01-0142A61BA171}
+ Library
+ Properties
+ OpenSky.Agent.Simulator
+ OpenSky.Agent.Simulator
+ v4.8
+ 512
+ true
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ bin\Debug\OpenSky.Agent.Simulator.xml
+ latest
+ x64
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ bin\Release\OpenSky.Agent.Simulator.xml
+ latest
+ x64
+
+
+
+ ..\packages\JetBrains.Annotations.2021.3.0\lib\net20\JetBrains.Annotations.dll
+
+
+ ..\packages\Microsoft.Maps.MapControl.WPF.1.0.0.3\lib\net40-Client\Microsoft.Maps.MapControl.WPF.dll
+
+
+ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\packages\OpenSky.FlightLogXML.0.1.5\lib\net48\OpenSky.FlightLogXML.dll
+
+
+ ..\packages\MSFT.ParallelExtensionsExtras.1.2.0\lib\ParallelExtensionsExtras.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ..\packages\TomsToolbox.Essentials.2.7.4\lib\net45\TomsToolbox.Essentials.dll
+
+
+
+ ..\packages\XDMessaging.Lite.5.0.6\lib\net452\XDMessaging.Lite.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OpenSkyApi
+ OpenSkyService
+ NSwagCSharp
+ http://localhost:5000/swagger/v1/swagger.json
+ /ClientBaseClass:OpenSkyServiceBase /UseHttpRequestMessageCreationMethod:true
+
+
+
+
+
+
+
+
+
+ Designer
+ MSBuild:Compile
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OpenSky.Agent.Simulator/OpenSky.Agent.Simulator.csproj.DotSettings b/OpenSky.Agent.Simulator/OpenSky.Agent.Simulator.csproj.DotSettings
new file mode 100644
index 0000000..4887f94
--- /dev/null
+++ b/OpenSky.Agent.Simulator/OpenSky.Agent.Simulator.csproj.DotSettings
@@ -0,0 +1,2 @@
+
+ CSharp100
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/OpenSkyColors.cs b/OpenSky.Agent.Simulator/OpenSkyColors.cs
similarity index 98%
rename from OpenSky.AgentMSFS/OpenSkyColors.cs
rename to OpenSky.Agent.Simulator/OpenSkyColors.cs
index 1c1a8c6..6013802 100644
--- a/OpenSky.AgentMSFS/OpenSkyColors.cs
+++ b/OpenSky.Agent.Simulator/OpenSkyColors.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS
+namespace OpenSky.Agent.Simulator
{
using System.Windows;
using System.Windows.Media;
diff --git a/OpenSky.Agent.Simulator/OpenSkyColors.xaml b/OpenSky.Agent.Simulator/OpenSkyColors.xaml
new file mode 100644
index 0000000..87c900e
--- /dev/null
+++ b/OpenSky.Agent.Simulator/OpenSkyColors.xaml
@@ -0,0 +1,27 @@
+
+
+
+ #05826c
+
+ #08c6a4
+
+ DarkRed
+
+ #CC0000
+
+ #29323c
+
+ #1a1e22
+
+ Yellow
+
+ DarkOrange
+
+ Orange
+
+ Black
+
+ White
+
+
diff --git a/OpenSky.Agent.Simulator/Properties/AssemblyInfo.cs b/OpenSky.Agent.Simulator/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..744cf75
--- /dev/null
+++ b/OpenSky.Agent.Simulator/Properties/AssemblyInfo.cs
@@ -0,0 +1,21 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("OpenSky.Agent.Simulator")]
+[assembly: AssemblyDescription("OpenSky Agent Simulator Interface Library")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("OpenSky")]
+[assembly: AssemblyProduct("OpenSky")]
+[assembly: AssemblyCopyright("OpenSky project 2021-2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: ComVisible(false)]
+[assembly: Guid("30c467e8-2eee-41e5-be01-0142a61ba171")]
+[assembly: AssemblyVersion("0.4.0")]
+[assembly: AssemblyFileVersion("0.4.0")]
\ No newline at end of file
diff --git a/OpenSky.Agent.Simulator/Simulator.Data.cs b/OpenSky.Agent.Simulator/Simulator.Data.cs
new file mode 100644
index 0000000..52d5d02
--- /dev/null
+++ b/OpenSky.Agent.Simulator/Simulator.Data.cs
@@ -0,0 +1,242 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace OpenSky.Agent.Simulator
+{
+ using OpenSky.Agent.Simulator.Models;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Simulator interface - data structures.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public partial class Simulator
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The last aircraft identity data received from the simulator.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private AircraftIdentity aircraftIdentity;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The last fuel tanks data received from the simulator.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private FuelTanks fuelTanks;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The last landing analysis data received from the simulator.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private LandingAnalysis landingAnalysis;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The last payload stations data received from the simulator.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private PayloadStations payloadStations;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The last primary tracking data received from the simulator.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private PrimaryTracking primaryTracking;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The last secondary tracking data received from the simulator.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private SecondaryTracking secondaryTracking;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The last slew aircraft into position data received from the simulator.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private SlewAircraftIntoPosition slewAircraftIntoPosition;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The last weight and balance data received from the simulator.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private WeightAndBalance weightAndBalance;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the aircraft identity data.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public AircraftIdentity AircraftIdentity
+ {
+ get => this.aircraftIdentity;
+
+ set
+ {
+ if (Equals(this.aircraftIdentity, value))
+ {
+ return;
+ }
+
+ this.aircraftIdentity = value;
+ this.OnPropertyChanged();
+ }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the fuel tanks data.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public FuelTanks FuelTanks
+ {
+ get => this.fuelTanks;
+
+ set
+ {
+ if (Equals(this.fuelTanks, value))
+ {
+ return;
+ }
+
+ this.fuelTanks = value;
+ this.OnPropertyChanged();
+ }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the landing analysis data.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public LandingAnalysis LandingAnalysis
+ {
+ get => this.landingAnalysis;
+
+ set
+ {
+ if (Equals(this.landingAnalysis, value))
+ {
+ return;
+ }
+
+ this.landingAnalysis = value;
+ this.OnPropertyChanged();
+ }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the payload stations data.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public PayloadStations PayloadStations
+ {
+ get => this.payloadStations;
+
+ set
+ {
+ if (Equals(this.payloadStations, value))
+ {
+ return;
+ }
+
+ this.payloadStations = value;
+ this.OnPropertyChanged();
+ }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the primary tracking data.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public PrimaryTracking PrimaryTracking
+ {
+ get => this.primaryTracking;
+
+ set
+ {
+ if (Equals(this.primaryTracking, value))
+ {
+ return;
+ }
+
+ this.primaryTracking = value;
+ this.OnPropertyChanged();
+ }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the secondary tracking data.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public SecondaryTracking SecondaryTracking
+ {
+ get => this.secondaryTracking;
+
+ set
+ {
+ if (Equals(this.secondaryTracking, value))
+ {
+ return;
+ }
+
+ this.secondaryTracking = value;
+ this.OnPropertyChanged();
+ }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the slew aircraft into position data.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public SlewAircraftIntoPosition SlewAircraftIntoPosition
+ {
+ get => this.slewAircraftIntoPosition;
+
+ protected set
+ {
+ if (Equals(this.slewAircraftIntoPosition, value))
+ {
+ return;
+ }
+
+ this.slewAircraftIntoPosition = value;
+ this.OnPropertyChanged();
+ }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the weight and balance data.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public WeightAndBalance WeightAndBalance
+ {
+ get => this.weightAndBalance;
+
+ set
+ {
+ if (Equals(this.weightAndBalance, value))
+ {
+ return;
+ }
+
+ this.weightAndBalance = value;
+ this.OnPropertyChanged();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/SimConnect/SimConnect.Flight.cs b/OpenSky.Agent.Simulator/Simulator.Flight.cs
similarity index 90%
rename from OpenSky.AgentMSFS/SimConnect/SimConnect.Flight.cs
rename to OpenSky.Agent.Simulator/Simulator.Flight.cs
index e8ac7d9..ce15ac9 100644
--- a/OpenSky.AgentMSFS/SimConnect/SimConnect.Flight.cs
+++ b/OpenSky.Agent.Simulator/Simulator.Flight.cs
@@ -1,13 +1,12 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect
+namespace OpenSky.Agent.Simulator
{
using System;
- using System.Collections.Generic;
using System.Device.Location;
using System.Diagnostics;
using System.IO;
@@ -21,27 +20,22 @@ namespace OpenSky.AgentMSFS.SimConnect
using Microsoft.Maps.MapControl.WPF;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.SimConnect.Enums;
- using OpenSky.AgentMSFS.SimConnect.Helpers;
- using OpenSky.AgentMSFS.SimConnect.Structs;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Models;
+ using OpenSky.Agent.Simulator.Tools;
using OpenSky.FlightLogXML;
using OpenSkyApi;
using PositionReport = OpenSkyApi.PositionReport;
- using TrackingEventMarker = Models.TrackingEventMarker;
+ using TrackingEventMarker = OpenSky.Agent.Simulator.Models.TrackingEventMarker;
/// -------------------------------------------------------------------------------------------------
- ///
- /// Simconnect client - flight tracking code.
- ///
- ///
- /// sushi.at, 17/03/2021.
- ///
+ ///
+ /// Simulator interface - flight.
+ ///
/// -------------------------------------------------------------------------------------------------
- public partial class SimConnect
+ public partial class Simulator
{
/// -------------------------------------------------------------------------------------------------
///
@@ -115,13 +109,6 @@ public partial class SimConnect
/// -------------------------------------------------------------------------------------------------
private DateTime lastPositionReportUpload = DateTime.MinValue;
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The pause info string.
- ///
- /// -------------------------------------------------------------------------------------------------
- private string pauseInfo;
-
/// -------------------------------------------------------------------------------------------------
///
/// The time saved because of simulation rate above 1 (equals warp delay at the end of the flight).
@@ -257,12 +244,14 @@ public Flight Flight
this.trackingEventMarkers.Add(runwayMarker);
this.TrackingEventMarkerAdded?.Invoke(this, runwayMarker);
}
+
foreach (var runway in value.Origin.Runways)
{
var runwayMarker = new TrackingEventMarker(runway);
this.trackingEventMarkers.Add(runwayMarker);
this.TrackingEventMarkerAdded?.Invoke(this, runwayMarker);
}
+
foreach (var runway in value.Destination.Runways)
{
var runwayMarker = new TrackingEventMarker(runway);
@@ -272,17 +261,18 @@ public Flight Flight
}
};
- this.TrackingConditions[(int)Models.TrackingConditions.Fuel].Expected = $"{value.FuelGallons:F1} gal, {value.FuelGallons * 3.78541:F1} liters ▶ {value.FuelGallons * value.Aircraft.Type.FuelWeightPerGallon:F1} lbs, {value.FuelGallons * value.Aircraft.Type.FuelWeightPerGallon * 0.453592:F1} kg";
- this.TrackingConditions[(int)Models.TrackingConditions.Payload].Expected = $"{value.PayloadPounds:F1} lbs, {value.PayloadPounds * 0.453592:F1} kg";
- this.TrackingConditions[(int)Models.TrackingConditions.PlaneModel].Expected = $"{value.Aircraft.Type.Name} (v{value.Aircraft.Type.VersionNumber})";
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Fuel].Expected =
+ $"{value.FuelGallons:F1} gal, {value.FuelGallons * 3.78541:F1} liters ▶ {value.FuelGallons * value.Aircraft.Type.FuelWeightPerGallon:F1} lbs, {value.FuelGallons * value.Aircraft.Type.FuelWeightPerGallon * 0.453592:F1} kg";
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Payload].Expected = $"{value.PayloadPounds:F1} lbs, {value.PayloadPounds * 0.453592:F1} kg";
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.PlaneModel].Expected = $"{value.Aircraft.Type.Name} (v{value.Aircraft.Type.VersionNumber})";
- this.TrackingConditions[(int)Models.TrackingConditions.Fuel].AutoSet = !value.Aircraft.Type.RequiresManualFuelling;
- this.TrackingConditions[(int)Models.TrackingConditions.Payload].AutoSet = !value.Aircraft.Type.RequiresManualLoading;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Fuel].AutoSet = !value.Aircraft.Type.RequiresManualFuelling;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Payload].AutoSet = !value.Aircraft.Type.RequiresManualLoading;
if (!value.Resume)
{
Debug.WriteLine("Preparing to track new flight");
- this.flightLoadingTempStructs = null;
+ this.flightLoadingTempModels = null;
this.TrackingStatus = TrackingStatus.Preparing;
Application.Current.Dispatcher.BeginInvoke(addAirports);
@@ -316,7 +306,7 @@ public Flight Flight
this.CheckCloudSave();
this.LoadFlight();
- this.flightLoadingTempStructs = new FlightLoadingTempStructs
+ this.flightLoadingTempModels = new FlightLoadingTempModels
{
FuelTanks = new FuelTanks
{
@@ -333,7 +323,7 @@ public Flight Flight
FuelTankExternal2Quantity = value.FuelTankExternal2Quantity ?? 0
},
PayloadStations = new PayloadStations(), // todo restore payload stations once we have that, all 0s for now
- SlewPlaneIntoPosition = new SlewPlaneIntoPosition
+ SlewAircraftIntoPosition = new SlewAircraftIntoPosition
{
Latitude = value.Latitude ?? 0,
Longitude = value.Longitude ?? 0,
@@ -347,13 +337,14 @@ public Flight Flight
}
};
- this.TrackingConditions[(int)Models.TrackingConditions.Fuel].Expected = $"{this.flightLoadingTempStructs.FuelTanks.TotalQuantity:F1} gal, {this.flightLoadingTempStructs.FuelTanks.TotalQuantity * 3.78541:F1} liters ▶ {this.flightLoadingTempStructs.FuelTanks.TotalQuantity * value.Aircraft.Type.FuelWeightPerGallon:F1} lbs, {this.flightLoadingTempStructs.FuelTanks.TotalQuantity * value.Aircraft.Type.FuelWeightPerGallon * 0.453592:F1} kg";
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Fuel].Expected =
+ $"{this.flightLoadingTempModels.FuelTanks.TotalQuantity:F1} gal, {this.flightLoadingTempModels.FuelTanks.TotalQuantity * 3.78541:F1} liters ▶ {this.flightLoadingTempModels.FuelTanks.TotalQuantity * value.Aircraft.Type.FuelWeightPerGallon:F1} lbs, {this.flightLoadingTempModels.FuelTanks.TotalQuantity * value.Aircraft.Type.FuelWeightPerGallon * 0.453592:F1} kg";
}
}
else
{
Debug.WriteLine("Flight set to NULL, stopping tracking");
- this.flightLoadingTempStructs = null;
+ this.flightLoadingTempModels = null;
this.StopTracking(false);
this.lastFlightLogAutoSave = DateTime.MinValue;
this.simbriefOfpLoaded = false;
@@ -370,44 +361,17 @@ public Flight Flight
}
}
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets the pause info string.
- ///
- /// -------------------------------------------------------------------------------------------------
- public string PauseInfo
- {
- get => this.pauseInfo;
-
- private set
- {
- if (Equals(this.pauseInfo, value))
- {
- return;
- }
-
- this.pauseInfo = value;
- this.OnPropertyChanged();
- }
- }
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Gets the tracking conditions.
- ///
- /// -------------------------------------------------------------------------------------------------
- public Dictionary TrackingConditions { get; }
-
/// -------------------------------------------------------------------------------------------------
///
/// Gets the duration of the tracking session.
///
+ ///
/// -------------------------------------------------------------------------------------------------
public string TrackingDuration
{
get => this.trackingDuration;
- private set
+ protected set
{
if (Equals(this.trackingDuration, value))
{
@@ -428,7 +392,7 @@ public TrackingStatus TrackingStatus
{
get => this.trackingStatus;
- private set
+ protected set
{
if (Equals(this.trackingStatus, value))
{
@@ -464,7 +428,7 @@ public string WarpInfo
{
get => this.warpInfo;
- private set
+ protected set
{
if (Equals(this.warpInfo, value))
{
@@ -483,10 +447,14 @@ private set
///
/// sushi.at, 22/03/2021.
///
+ ///
+ /// Thrown when an exception error condition occurs.
+ ///
+ ///
/// -------------------------------------------------------------------------------------------------
public void StartTracking()
{
- Debug.WriteLine("SimConnect asked to start/resume tracking...");
+ Debug.WriteLine("Simulator asked to start/resume tracking...");
if (!this.CanStartTracking)
{
throw new Exception("Not all tracking conditions met, cannot start tracking.");
@@ -563,7 +531,7 @@ public void StopTracking(bool resumeLater)
this.TrackingConditions[(int)condition].Reset();
}
- this.TrackingConditions[(int)Models.TrackingConditions.RealismSettings].Expected = "No slew, No unlimited fuel,\r\nCrash detection, SimRate=1";
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.RealismSettings].Expected = "No slew, No unlimited fuel,\r\nCrash detection, SimRate=1";
}
if (!resumeLater)
@@ -586,7 +554,7 @@ public void StopTracking(bool resumeLater)
// Abort flight
try
{
- var result = OpenSkyService.Instance.AbortFlightAsync(this.Flight.Id).Result;
+ var result = this.openSkyServiceInstance.AbortFlightAsync(this.Flight.Id).Result;
if (result.IsError)
{
Debug.WriteLine("Error aborting flight on OpenSky: " + result.Message + "\r\n" + result.ErrorDetails);
@@ -651,11 +619,11 @@ public void StopTracking(bool resumeLater)
this.PauseFlight();
- this.flightLoadingTempStructs = new FlightLoadingTempStructs
+ this.flightLoadingTempModels = new FlightLoadingTempModels
{
FuelTanks = this.FuelTanks,
PayloadStations = this.PayloadStations,
- SlewPlaneIntoPosition = SlewPlaneIntoPosition.FromPrimaryTracking(this.PrimaryTracking)
+ SlewAircraftIntoPosition = SlewAircraftIntoPosition.FromPrimaryTracking(this.PrimaryTracking)
};
}
catch (Exception ex)
@@ -676,6 +644,89 @@ public void StopTracking(bool resumeLater)
}
}
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Check if there is a (newer) cloud save for this flight.
+ ///
+ ///
+ /// sushi.at, 14/11/2021.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private void CheckCloudSave()
+ {
+ Debug.WriteLine($"Checking if cloud-save for flight {this.Flight?.Id} is more recent than local save...");
+ try
+ {
+ if (this.Flight == null)
+ {
+ throw new Exception("No flight loaded that could be restored!");
+ }
+
+ if (!this.Flight.HasAutoSaveLog || !this.Flight.LastAutoSave.HasValue)
+ {
+ // Flight has no cloud-save
+ return;
+ }
+
+ if (!this.flightSaveMutex.WaitOne(30 * 1000))
+ {
+ throw new Exception("Timeout waiting for save flight mutex.");
+ }
+
+ var flightSaveDirectory = "%localappdata%\\OpenSky\\Flights\\";
+ flightSaveDirectory = Environment.ExpandEnvironmentVariables(flightSaveDirectory);
+ var saveFileName = $"{flightSaveDirectory}\\opensky-flight-{this.Flight.Id}.save";
+
+ var downloadCloudSave = false;
+ if (!File.Exists(saveFileName))
+ {
+ downloadCloudSave = true;
+ }
+ else
+ {
+ var localSaveTime = File.GetLastWriteTimeUtc(saveFileName);
+ if (this.Flight.LastAutoSave.Value.UtcDateTime > localSaveTime)
+ {
+ downloadCloudSave = true;
+ }
+ }
+
+ if (downloadCloudSave)
+ {
+ var result = this.openSkyServiceInstance.DownloadFlightAutoSaveAsync(this.Flight.Id).Result;
+ if (!result.IsError)
+ {
+ var base64 = result.Data;
+ if (base64 != null)
+ {
+ var binary = Convert.FromBase64String(base64);
+ File.WriteAllBytes(saveFileName, binary);
+ }
+ }
+ else
+ {
+ Debug.WriteLine("Error downloading cloud save: " + result.Message + "\r\n" + result.ErrorDetails);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Error downloading cloud save: " + ex);
+ throw;
+ }
+ finally
+ {
+ try
+ {
+ this.flightSaveMutex.ReleaseMutex();
+ }
+ catch
+ {
+ // Ignore
+ }
+ }
+ }
+
/// -------------------------------------------------------------------------------------------------
///
/// Delete save file for current flight.
@@ -754,7 +805,7 @@ private void FinishUpFlightTracking()
AirspeedTrue = this.PrimaryTracking.AirspeedTrue,
Altitude = this.PrimaryTracking.Altitude,
BankAngle = this.PrimaryTracking.BankAngle,
- FlightPhase = this.PrimaryTracking.CrashSequence != CrashSequence.Off ? FlightPhase.Crashed : this.FlightPhase,
+ FlightPhase = this.PrimaryTracking.Crash ? FlightPhase.Crashed : this.FlightPhase,
GroundSpeed = this.PrimaryTracking.GroundSpeed,
Heading = this.PrimaryTracking.Heading,
Latitude = this.PrimaryTracking.Latitude,
@@ -778,8 +829,8 @@ private void FinishUpFlightTracking()
FuelTankExternal2Quantity = this.FuelTanks.FuelTankExternal2Quantity
};
- this.RefreshStructNow(Requests.FuelTanks);
- this.RefreshStructNow(Requests.PayloadStations);
+ this.RefreshModelNow(Requests.FuelTanks);
+ this.RefreshModelNow(Requests.PayloadStations);
Thread.Sleep(500);
var saveFile = this.GenerateSaveFile();
@@ -805,10 +856,11 @@ private void FinishUpFlightTracking()
FlightLog = base64String
};
- var result = OpenSkyService.Instance.CompleteFlightAsync(finalReport).Result;
+ var result = this.openSkyServiceInstance.CompleteFlightAsync(finalReport).Result;
if (result.IsError)
{
Debug.WriteLine("Error submitting final flight report: " + result.Message + "\r\n" + result.ErrorDetails);
+
// todo how to handle this? save to a special file or only offer retry? Or does the user have to resume from the last save?
}
else
@@ -825,6 +877,7 @@ private void FinishUpFlightTracking()
catch (Exception ex)
{
Debug.WriteLine("Error submitting final flight report: " + ex);
+
// todo how to handle this? save to a special file or only offer retry? Or does the user have to resume from the last save?
}
finally
@@ -854,89 +907,6 @@ private void FinishUpFlightTracking()
}
}
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Check if there is a (newer) cloud save for this flight.
- ///
- ///
- /// sushi.at, 14/11/2021.
- ///
- /// -------------------------------------------------------------------------------------------------
- private void CheckCloudSave()
- {
- Debug.WriteLine($"Checking if cloud-save for flight {this.Flight?.Id} is more recent than local save...");
- try
- {
- if (this.Flight == null)
- {
- throw new Exception("No flight loaded that could be restored!");
- }
-
- if (!this.Flight.HasAutoSaveLog || !this.Flight.LastAutoSave.HasValue)
- {
- // Flight has no cloud-save
- return;
- }
-
- if (!this.flightSaveMutex.WaitOne(30 * 1000))
- {
- throw new Exception("Timeout waiting for save flight mutex.");
- }
-
- var flightSaveDirectory = "%localappdata%\\OpenSky\\Flights\\";
- flightSaveDirectory = Environment.ExpandEnvironmentVariables(flightSaveDirectory);
- var saveFileName = $"{flightSaveDirectory}\\opensky-flight-{this.Flight.Id}.save";
-
- var downloadCloudSave = false;
- if (!File.Exists(saveFileName))
- {
- downloadCloudSave = true;
- }
- else
- {
- var localSaveTime = File.GetLastWriteTimeUtc(saveFileName);
- if (this.Flight.LastAutoSave.Value.UtcDateTime > localSaveTime)
- {
- downloadCloudSave = true;
- }
- }
-
- if (downloadCloudSave)
- {
- var result = OpenSkyService.Instance.DownloadFlightAutoSaveAsync(this.Flight.Id).Result;
- if (!result.IsError)
- {
- var base64 = result.Data;
- if (base64 != null)
- {
- var binary = Convert.FromBase64String(base64);
- File.WriteAllBytes(saveFileName, binary);
- }
- }
- else
- {
- Debug.WriteLine("Error downloading cloud save: " + result.Message + "\r\n" + result.ErrorDetails);
- }
- }
- }
- catch (Exception ex)
- {
- Debug.WriteLine("Error downloading cloud save: " + ex);
- throw;
- }
- finally
- {
- try
- {
- this.flightSaveMutex.ReleaseMutex();
- }
- catch
- {
- // Ignore
- }
- }
- }
-
/// -------------------------------------------------------------------------------------------------
///
/// Loads the tracking details of a saved flight.
@@ -1002,6 +972,47 @@ private void LoadFlight()
}
}
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Pause the current flight on OpenSky.
+ ///
+ ///
+ /// sushi.at, 15/11/2021.
+ ///
+ ///
+ /// Thrown when an exception error condition occurs.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private void PauseFlight()
+ {
+ if (this.Flight == null)
+ {
+ throw new Exception("No flight loaded that could be paused.");
+ }
+
+ new Thread(
+ () =>
+ {
+ try
+ {
+ var result = this.openSkyServiceInstance.PauseFlightAsync(this.Flight.Id).Result;
+ if (result.IsError)
+ {
+ Debug.WriteLine("Error pausing flight: " + result.Message + "\r\n" + result.ErrorDetails);
+ }
+ else
+ {
+ this.Flight = null;
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Error pausing flight: " + ex);
+ }
+ })
+ { Name = "SimConnect.Flight.Pause" }.Start();
+ }
+
/// -------------------------------------------------------------------------------------------------
///
/// Saves the current flight.
@@ -1032,8 +1043,8 @@ private void SaveFlight()
throw new Exception("Timeout waiting for save flight mutex.");
}
- this.RefreshStructNow(Requests.FuelTanks);
- this.RefreshStructNow(Requests.PayloadStations);
+ this.RefreshModelNow(Requests.FuelTanks);
+ this.RefreshModelNow(Requests.PayloadStations);
Thread.Sleep(500);
Debug.WriteLine($"Saving flight {this.Flight?.Id}");
@@ -1092,7 +1103,7 @@ private void SaveFlight()
}
}
})
- { Name = "SimConnect.Flight.SaveFlight" }.Start();
+ { Name = "SimConnect.Flight.SaveFlight" }.Start();
}
/// -------------------------------------------------------------------------------------------------
@@ -1145,10 +1156,10 @@ private void TrackFlight(ProcessPrimaryTracking ppt)
// todo Check if user has paused the sim (but didn't use the pause button we provide) ... check if lat/lon isn't changing while in flight
- if (this.PrimaryTracking.CrashSequence != CrashSequence.Off)
+ if (this.PrimaryTracking.Crash)
{
// Plane crashed
- this.AddTrackingEvent(ppt.New, this.SecondaryTracking, FlightTrackingEventType.Crashed, Colors.DarkRed, "Aircraft crashed");
+ this.AddTrackingEvent(ppt.New, this.SecondaryTracking, FlightTrackingEventType.Crashed, OpenSkyColors.OpenSkyRed, "Aircraft crashed");
// todo play some ELT sound? to be proper annoying :)
this.FinishUpFlightTracking();
@@ -1175,47 +1186,6 @@ private void TrackFlight(ProcessPrimaryTracking ppt)
}
}
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Pause the current flight on OpenSky.
- ///
- ///
- /// sushi.at, 15/11/2021.
- ///
- ///
- /// Thrown when an exception error condition occurs.
- ///
- /// -------------------------------------------------------------------------------------------------
- private void PauseFlight()
- {
- if (this.Flight == null)
- {
- throw new Exception("No flight loaded that could be paused.");
- }
-
- new Thread(
- () =>
- {
- try
- {
- var result = OpenSkyService.Instance.PauseFlightAsync(this.Flight.Id).Result;
- if (result.IsError)
- {
- Debug.WriteLine("Error pausing flight: " + result.Message + "\r\n" + result.ErrorDetails);
- }
- else
- {
- this.Flight = null;
- }
- }
- catch (Exception ex)
- {
- Debug.WriteLine("Error pausing flight: " + ex);
- }
- })
- { Name = "SimConnect.Flight.Pause" }.Start();
- }
-
/// -------------------------------------------------------------------------------------------------
///
/// Upload auto-save to OpenSky.
@@ -1260,7 +1230,7 @@ private void UploadAutoSave()
var bytes = File.ReadAllBytes(saveFileName);
var base64String = Convert.ToBase64String(bytes);
- var result = OpenSkyService.Instance.UploadFlightAutoSaveAsync(this.Flight.Id, base64String).Result;
+ var result = this.openSkyServiceInstance.UploadFlightAutoSaveAsync(this.Flight.Id, base64String).Result;
if (!result.IsError)
{
this.lastAutoSaveUpload = DateTime.UtcNow;
@@ -1299,7 +1269,7 @@ private void UploadAutoSave()
}
}
})
- { Name = "SimConnect.Flight.UploadAutoSave" }.Start();
+ { Name = "SimConnect.Flight.UploadAutoSave" }.Start();
}
/// -------------------------------------------------------------------------------------------------
@@ -1333,7 +1303,7 @@ private void UploadPositionReport()
AirspeedTrue = this.PrimaryTracking.AirspeedTrue,
Altitude = this.PrimaryTracking.Altitude,
BankAngle = this.PrimaryTracking.BankAngle,
- FlightPhase = this.PrimaryTracking.CrashSequence != CrashSequence.Off ? FlightPhase.Crashed : this.FlightPhase,
+ FlightPhase = this.PrimaryTracking.Crash ? FlightPhase.Crashed : this.FlightPhase,
GroundSpeed = this.PrimaryTracking.GroundSpeed,
Heading = this.PrimaryTracking.Heading,
Latitude = this.PrimaryTracking.Latitude,
@@ -1357,7 +1327,7 @@ private void UploadPositionReport()
FuelTankExternal2Quantity = this.FuelTanks.FuelTankExternal2Quantity
};
- var result = OpenSkyService.Instance.PositionReportAsync(positionReport).Result;
+ var result = this.openSkyServiceInstance.PositionReportAsync(positionReport).Result;
if (!result.IsError)
{
@@ -1388,7 +1358,7 @@ private void UploadPositionReport()
}
}
})
- { Name = "SimConnect.Flight.UploadPositionReport" }.Start();
+ { Name = "SimConnect.Flight.UploadPositionReport" }.Start();
}
}
}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/SimConnect/SimConnect.GroundHandling.cs b/OpenSky.Agent.Simulator/Simulator.GroundHandling.cs
similarity index 98%
rename from OpenSky.AgentMSFS/SimConnect/SimConnect.GroundHandling.cs
rename to OpenSky.Agent.Simulator/Simulator.GroundHandling.cs
index e4ca16f..2cbf162 100644
--- a/OpenSky.AgentMSFS/SimConnect/SimConnect.GroundHandling.cs
+++ b/OpenSky.Agent.Simulator/Simulator.GroundHandling.cs
@@ -1,27 +1,27 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect
+namespace OpenSky.Agent.Simulator
{
using System;
using System.Diagnostics;
using System.Threading;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Tools;
using OpenSky.FlightLogXML;
using TomsToolbox.Essentials;
/// -------------------------------------------------------------------------------------------------
///
- /// Simconnect client - ground handling code.
+ /// Simulator interface - ground handling.
///
/// -------------------------------------------------------------------------------------------------
- public partial class SimConnect
+ public partial class Simulator
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.PositionReports.cs b/OpenSky.Agent.Simulator/Simulator.Markers.cs
similarity index 56%
rename from OpenSky.AgentMSFS/SimConnect/SimConnect.Process.PositionReports.cs
rename to OpenSky.Agent.Simulator/Simulator.Markers.cs
index 84d9fc8..14f3ba2 100644
--- a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.PositionReports.cs
+++ b/OpenSky.Agent.Simulator/Simulator.Markers.cs
@@ -1,35 +1,47 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect
+namespace OpenSky.Agent.Simulator
{
using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
using System.Device.Location;
+ using System.Diagnostics;
using System.Windows;
+ using System.Windows.Media;
using JetBrains.Annotations;
using Microsoft.Maps.MapControl.WPF;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.SimConnect.Structs;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Models;
+ using OpenSky.Agent.Simulator.Tools;
+ using OpenSky.FlightLogXML;
using OpenSkyApi;
+ using TrackingEventLogEntry = OpenSky.Agent.Simulator.Models.TrackingEventLogEntry;
+ using TrackingEventMarker = OpenSky.Agent.Simulator.Models.TrackingEventMarker;
+
/// -------------------------------------------------------------------------------------------------
- ///
- /// Simconnect client - position reports code.
- ///
- ///
- /// sushi.at, 17/03/2021.
- ///
+ ///
+ /// Simulator interface - map markers.
+ ///
/// -------------------------------------------------------------------------------------------------
- public partial class SimConnect
+ public partial class Simulator
{
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The tracking event markers.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private readonly List trackingEventMarkers = new();
+
/// -------------------------------------------------------------------------------------------------
///
/// The last distance comparison used for a position report.
@@ -53,6 +65,20 @@ public partial class SimConnect
[CanBeNull]
private GeoCoordinate lastPositionReport;
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Occurs when the plane's location changed.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public event EventHandler LocationChanged;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Occurs when SimConnect adds a new tracking event marker.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public event EventHandler TrackingEventMarkerAdded;
+
/// -------------------------------------------------------------------------------------------------
///
/// Gets the aircraft trail locations collection to draw a poly line on the map.
@@ -81,6 +107,96 @@ private set
}
}
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the tracking event log entries.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public ObservableCollection TrackingEventLogEntries { get; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Replay simbrief waypoint and tracking event markers (new tracking view was opened).
+ ///
+ ///
+ /// sushi.at, 18/03/2021.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public void ReplayMapMarkers()
+ {
+ Debug.WriteLine("SimConnect is replaying map markers to listeners...");
+
+ UpdateGUIDelegate restoreMarkers = () =>
+ {
+ foreach (var waypointMarker in this.simbriefWaypointMarkers)
+ {
+ this.SimbriefWaypointMarkerAdded?.Invoke(this, waypointMarker);
+ }
+
+ lock (this.trackingEventMarkers)
+ {
+ foreach (var trackingEventMarker in this.trackingEventMarkers)
+ {
+ this.TrackingEventMarkerAdded?.Invoke(this, trackingEventMarker);
+ }
+ }
+ };
+ Application.Current.Dispatcher.BeginInvoke(restoreMarkers);
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Add a tracking event to the map and log.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The primary Simconnect tracking data.
+ ///
+ ///
+ /// The secondary Simconnect tracking data.
+ ///
+ ///
+ /// The flight tracking event type.
+ ///
+ ///
+ /// The color to use for the marker.
+ ///
+ ///
+ /// The event text (what happened?).
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private void AddTrackingEvent(PrimaryTracking primary, SecondaryTracking secondary, FlightTrackingEventType type, Color color, string text)
+ {
+ if (this.TrackingStatus != TrackingStatus.Tracking && this.TrackingStatus != TrackingStatus.GroundOperations)
+ {
+ return;
+ }
+
+ UpdateGUIDelegate addTrackingEvent = () =>
+ {
+ Debug.WriteLine($"Adding tracking event: {text}");
+ if (this.lastNonPositionReportMarker == null || this.lastNonPositionReportMarker.GetDistanceTo(primary) >= 20)
+ {
+ lock (this.trackingEventMarkers)
+ {
+ var newMarker = new TrackingEventMarker(primary, secondary, this.WeightAndBalance.FuelTotalQuantity, 16, color, text);
+ this.lastNonPositionReportMarker = newMarker;
+ this.trackingEventMarkers.Add(newMarker);
+ this.TrackingEventMarkerAdded?.Invoke(this, newMarker);
+ }
+ }
+ else
+ {
+ this.lastNonPositionReportMarker.AddEventToMarker(DateTime.UtcNow, text);
+ }
+
+ this.TrackingEventLogEntries.Add(new TrackingEventLogEntry(type, DateTime.UtcNow, color, text, primary.MapLocation));
+ };
+ Application.Current.Dispatcher.BeginInvoke(addTrackingEvent);
+ }
+
/// -------------------------------------------------------------------------------------------------
///
/// Adds a position report to the map if needed (poly line point and position report point if requested).
@@ -139,7 +255,7 @@ private void AddPositionReport(PrimaryTracking primary)
}
else
{
- var radioHeight = this.PlaneIdentity.EngineType is EngineType.Jet or EngineType.Turboprop ? 2500 : 1000;
+ var radioHeight = this.AircraftIdentity.EngineType is EngineType.Jet or EngineType.Turboprop ? 2500 : 1000;
if (primary.RadioHeight < radioHeight)
{
if (this.IsTurning)
diff --git a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.ChangeOverTime.cs b/OpenSky.Agent.Simulator/Simulator.Process.ChangeOverTime.cs
similarity index 94%
rename from OpenSky.AgentMSFS/SimConnect/SimConnect.Process.ChangeOverTime.cs
rename to OpenSky.Agent.Simulator/Simulator.Process.ChangeOverTime.cs
index 4399575..a8c8659 100644
--- a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.ChangeOverTime.cs
+++ b/OpenSky.Agent.Simulator/Simulator.Process.ChangeOverTime.cs
@@ -1,28 +1,24 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect
+namespace OpenSky.Agent.Simulator
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.SimConnect.Structs;
+ using OpenSky.Agent.Simulator.Models;
/// -------------------------------------------------------------------------------------------------
- ///
- /// Simconnect client - change over time tracking code.
- ///
- ///
- /// sushi.at, 17/03/2021.
- ///
+ ///
+ /// Simulator interface - change over time processing.
+ ///
/// -------------------------------------------------------------------------------------------------
- public partial class SimConnect
+ public partial class Simulator
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.FlightPhases.cs b/OpenSky.Agent.Simulator/Simulator.Process.FlightPhases.cs
similarity index 94%
rename from OpenSky.AgentMSFS/SimConnect/SimConnect.Process.FlightPhases.cs
rename to OpenSky.Agent.Simulator/Simulator.Process.FlightPhases.cs
index e2ad08c..cee0c20 100644
--- a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.FlightPhases.cs
+++ b/OpenSky.Agent.Simulator/Simulator.Process.FlightPhases.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect
+namespace OpenSky.Agent.Simulator
{
using System;
using System.Device.Location;
@@ -12,21 +12,18 @@ namespace OpenSky.AgentMSFS.SimConnect
using System.Media;
using System.Reflection;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.SimConnect.Enums;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Models;
using OpenSky.FlightLogXML;
using OpenSkyApi;
/// -------------------------------------------------------------------------------------------------
- ///
- /// Simconnect client - data processing code.
- ///
- ///
- /// sushi.at, 17/03/2021.
- ///
+ ///
+ /// Simulator interface - flight phase processing.
+ ///
/// -------------------------------------------------------------------------------------------------
- public partial class SimConnect
+ public partial class Simulator
{
/// -------------------------------------------------------------------------------------------------
///
@@ -202,11 +199,10 @@ private void TransitionFlightPhase()
{
Debug.WriteLine("Tracking aborted, sim returned to main menu.");
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSnegative.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSnegative.wav"));
player.Play();
SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedSimMainMenu);
this.StopTracking(false);
- this.fsConnect.SetText("Tracking aborted, sim returned to main menu.", 5);
}
}
@@ -216,7 +212,7 @@ private void TransitionFlightPhase()
if (unknownFlightPhase)
{
this.FlightPhase = FlightPhase.PreFlight;
- this.NextFlightStep = this.TrackingStatus == TrackingStatus.GroundOperations ? "Next step: Wait for ground handling to complete" : $"Next step: Turn on the engine{(this.PlaneIdentity.EngineCount > 1 ? "s" : string.Empty)}";
+ this.NextFlightStep = this.TrackingStatus == TrackingStatus.GroundOperations ? "Next step: Wait for ground handling to complete" : $"Next step: Turn on the engine{(this.AircraftIdentity.EngineCount > 1 ? "s" : string.Empty)}";
newNextStepFlashing = this.TrackingStatus != TrackingStatus.GroundOperations;
unknownFlightPhase = false;
}
@@ -259,7 +255,7 @@ private void TransitionFlightPhase()
}
// Takeoff
- var departureRadioHeight = this.PlaneIdentity.EngineType is EngineType.Jet or EngineType.Turboprop ? 1000 : 100;
+ var departureRadioHeight = this.AircraftIdentity.EngineType is EngineType.Jet or EngineType.Turboprop ? 1000 : 100;
if (!this.WasAirborne && this.PrimaryTracking.GroundSpeed > 40 && this.PrimaryTracking.RadioHeight <= departureRadioHeight)
{
if (unknownFlightPhase)
@@ -290,7 +286,7 @@ private void TransitionFlightPhase()
}
// Climb
- var approachDistance = this.PlaneIdentity.EngineType is EngineType.Jet or EngineType.Turboprop ? 40 : 10;
+ var approachDistance = this.AircraftIdentity.EngineType is EngineType.Jet or EngineType.Turboprop ? 40 : 10;
if (distanceToDepartureAirport >= approachDistance && this.VerticalProfile == VerticalProfile.Climbing && !this.PrimaryTracking.OnGround)
{
if (unknownFlightPhase)
@@ -407,7 +403,7 @@ private void TransitionFlightPhase()
}
}
- if (this.PrimaryTracking.CrashSequence != CrashSequence.Off)
+ if (this.PrimaryTracking.Crash)
{
// todo save pre-crash flight phase to submit as part of crash report? implement this in the systems section?
diff --git a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.Landing.cs b/OpenSky.Agent.Simulator/Simulator.Process.Landing.cs
similarity index 76%
rename from OpenSky.AgentMSFS/SimConnect/SimConnect.Process.Landing.cs
rename to OpenSky.Agent.Simulator/Simulator.Process.Landing.cs
index a1abbe1..f3643b5 100644
--- a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.Landing.cs
+++ b/OpenSky.Agent.Simulator/Simulator.Process.Landing.cs
@@ -1,29 +1,25 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect
+namespace OpenSky.Agent.Simulator
{
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
- using System.Windows;
- using OpenSky.AgentMSFS.Properties;
-
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.SimConnect.Helpers;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Models;
using OpenSky.FlightLogXML;
/// -------------------------------------------------------------------------------------------------
///
- /// Simconnect client - landing analysis code.
+ /// Simulator interface - landing processing.
///
/// -------------------------------------------------------------------------------------------------
- public partial class SimConnect
+ public partial class Simulator
{
/// -------------------------------------------------------------------------------------------------
///
@@ -32,6 +28,13 @@ public partial class SimConnect
/// -------------------------------------------------------------------------------------------------
public ObservableCollection LandingReports { get; }
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Occurs when a landing should be reported (event parameter specifies triggering time).
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public event EventHandler LandingReported;
+
/// -------------------------------------------------------------------------------------------------
///
/// Check for and analyse landings.
@@ -71,13 +74,7 @@ private void CheckForAndAnalyseLanding(ProcessLandingAnalysis pla)
{
// First landing for this flight
this.AddTrackingEvent(this.PrimaryTracking, this.SecondaryTracking, FlightTrackingEventType.Touchdown, OpenSkyColors.OpenSkyTeal, "Touchdown");
-
- // Show landing report notification now?
- if (LandingReportNotification.AsSoonAsPossible.Equals(LandingReportNotification.Parse(Settings.Default.LandingReportNotification)))
- {
- UpdateGUIDelegate showNotification = () => new Views.LandingReport().Show();
- Application.Current.Dispatcher.BeginInvoke(showNotification);
- }
+ this.LandingReported?.Invoke(this, LandingReportNotification.AsSoonAsPossible);
}
}
}
diff --git a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.Lights.cs b/OpenSky.Agent.Simulator/Simulator.Process.Lights.cs
similarity index 86%
rename from OpenSky.AgentMSFS/SimConnect/SimConnect.Process.Lights.cs
rename to OpenSky.Agent.Simulator/Simulator.Process.Lights.cs
index 1754d1a..c1c1a6a 100644
--- a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.Lights.cs
+++ b/OpenSky.Agent.Simulator/Simulator.Process.Lights.cs
@@ -1,28 +1,25 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect
+namespace OpenSky.Agent.Simulator
{
using System.Diagnostics;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.SimConnect.Helpers;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Models;
using OpenSky.FlightLogXML;
using OpenSkyApi;
/// -------------------------------------------------------------------------------------------------
- ///
- /// Simconnect client - lights monitoring code.
- ///
- ///
- /// sushi.at, 17/03/2021.
- ///
+ ///
+ /// Simulator interface - lights.
+ ///
/// -------------------------------------------------------------------------------------------------
- public partial class SimConnect
+ public partial class Simulator
{
/// -------------------------------------------------------------------------------------------------
///
@@ -52,7 +49,6 @@ private void MonitorLights(ProcessSecondaryTracking pst)
if (!pst.New.LightBeacon && pst.New.EngineRunning && (this.TrackingStatus is TrackingStatus.GroundOperations or TrackingStatus.Tracking))
{
this.AddTrackingEvent(this.PrimaryTracking, pst.New, FlightTrackingEventType.BeaconOffEnginesOn, OpenSkyColors.OpenSkyRed, "Beacon turned off while engine was running");
- this.fsConnect.SetText("OpenSky Warning: Beacon turned off while engine was running", 5);
}
}
@@ -78,7 +74,7 @@ private void MonitorLights(ProcessSecondaryTracking pst)
if (this.TrackingStatus == TrackingStatus.Tracking)
{
- if (this.PlaneIdentity.EngineType is EngineType.Jet or EngineType.Turboprop)
+ if (this.AircraftIdentity.EngineType is EngineType.Jet or EngineType.Turboprop)
{
// 10000 feet landing lights (give 500 feet spare)
if (this.PrimaryTracking.IndicatedAltitude < 9500 && !this.PrimaryTracking.OnGround && !pst.New.LightLanding)
@@ -88,7 +84,6 @@ private void MonitorLights(ProcessSecondaryTracking pst)
Debug.WriteLine($"Landing lights 10K: indicated {this.PrimaryTracking.IndicatedAltitude}, alt {this.PrimaryTracking.Altitude}");
this.landingLightWarningActive = true;
this.AddTrackingEvent(this.PrimaryTracking, pst.New, FlightTrackingEventType.LandingLightsOffBelow10K, OpenSkyColors.OpenSkyRed, "Landing lights off below 10k feet");
- this.fsConnect.SetText("OpenSky Warning: Landing lights off below 10k feet", 5);
}
}
else
@@ -105,7 +100,6 @@ private void MonitorLights(ProcessSecondaryTracking pst)
{
this.landingLightWarningActive = true;
this.AddTrackingEvent(this.PrimaryTracking, pst.New, FlightTrackingEventType.LandingLightsOffBelow300AGL, OpenSkyColors.OpenSkyRed, "Landing lights off below 300 feet AGL");
- this.fsConnect.SetText("OpenSky Warning: Landing lights off below 300 feet AGL", 5);
}
}
else
diff --git a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.Systems.cs b/OpenSky.Agent.Simulator/Simulator.Process.Systems.cs
similarity index 84%
rename from OpenSky.AgentMSFS/SimConnect/SimConnect.Process.Systems.cs
rename to OpenSky.Agent.Simulator/Simulator.Process.Systems.cs
index e1e3d4e..fef07b6 100644
--- a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.Systems.cs
+++ b/OpenSky.Agent.Simulator/Simulator.Process.Systems.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect
+namespace OpenSky.Agent.Simulator
{
using System;
using System.Diagnostics;
@@ -12,25 +12,19 @@ namespace OpenSky.AgentMSFS.SimConnect
using System.Reflection;
using System.Windows;
- using OpenSky.AgentMSFS.Properties;
-
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.SimConnect.Enums;
- using OpenSky.AgentMSFS.SimConnect.Helpers;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Models;
+ using OpenSky.Agent.Simulator.Tools;
using OpenSky.FlightLogXML;
- using TrackingEventMarker = Models.TrackingEventMarker;
+ using TrackingEventMarker = OpenSky.Agent.Simulator.Models.TrackingEventMarker;
/// -------------------------------------------------------------------------------------------------
- ///
- /// Simconnect client - systems monitoring code.
- ///
- ///
- /// sushi.at, 17/03/2021.
- ///
+ ///
+ /// Simulator interface - systems processing.
+ ///
/// -------------------------------------------------------------------------------------------------
- public partial class SimConnect
+ public partial class Simulator
{
/// -------------------------------------------------------------------------------------------------
///
@@ -46,6 +40,13 @@ public partial class SimConnect
/// -------------------------------------------------------------------------------------------------
private DateTime lastStall = DateTime.MinValue;
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Is the 250 below 10000 speed limit warning currently active?
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private bool speedLimitWarningActive;
+
/// -------------------------------------------------------------------------------------------------
///
/// Monitor primary systems.
@@ -79,16 +80,30 @@ private void MonitorPrimarySystems(ProcessPrimaryTracking ppt)
}
}
+ // 10000 feet speed limit 250 knots (give 500 feet and 10 knots spare)
+ if (ppt.New.IndicatedAltitude < 9500 && !ppt.New.OnGround && ppt.New.AirspeedIndicated > 260)
+ {
+ if (!this.speedLimitWarningActive)
+ {
+ Debug.WriteLine($"Speed limit 250 below 10K: indicated {ppt.New.IndicatedAltitude}, alt {ppt.New.Altitude} => {ppt.New.AirspeedIndicated} knots");
+ this.speedLimitWarningActive = true;
+ this.AddTrackingEvent(ppt.New, this.SecondaryTracking, FlightTrackingEventType.SpeedLimit250Below10K, OpenSkyColors.OpenSkyRed, "Speed over 250 below 10k feet");
+ }
+ }
+ else
+ {
+ this.speedLimitWarningActive = false;
+ }
+
// Slew activated?
if (ppt.New.SlewActive && (this.TrackingStatus is TrackingStatus.GroundOperations or TrackingStatus.Tracking))
{
Debug.WriteLine("OpenSky Warning: Tracking aborted, slew detected.");
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSnegative.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSnegative.wav"));
player.Play();
SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedSlew);
this.StopTracking(false);
- this.fsConnect.SetText("OpenSky Warning: Tracking aborted, slew detected.", 5);
}
// Teleport to another position?
@@ -101,11 +116,10 @@ private void MonitorPrimarySystems(ProcessPrimaryTracking ppt)
{
Debug.WriteLine("OpenSky Warning: Tracking aborted, teleport detected.");
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSnegative.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSnegative.wav"));
player.Play();
SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedTeleport);
this.StopTracking(false);
- this.fsConnect.SetText("OpenSky Warning: Tracking aborted, teleport detected.", 5);
}
}
}
@@ -137,25 +151,27 @@ private void MonitorSecondarySystems(ProcessSecondaryTracking pst)
{
Debug.WriteLine("OpenSky Warning: Tracking aborted, you cannot start your engines while ground handling isn't complete!");
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSnegative.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSnegative.wav"));
player.PlaySync();
SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedEnginesGroundHandling);
this.StopTracking(false);
- this.fsConnect.SetText("OpenSky Warning: Tracking aborted, you cannot start your engines while ground handling isn't complete!", 5);
}
// Was the beacon light off when the engine was started?
if (pst.New.EngineRunning && !pst.New.LightBeacon && (this.TrackingStatus is TrackingStatus.GroundOperations or TrackingStatus.Tracking))
{
this.AddTrackingEvent(this.PrimaryTracking, pst.New, FlightTrackingEventType.BeaconOffEnginesOn, OpenSkyColors.OpenSkyRed, "Beacon turned off when engine was started");
- this.fsConnect.SetText("OpenSky Warning: Beacon turned off when engine was started", 5);
}
// Was the taxi or landing light on when turning on/off the engine?
if ((pst.New.LightTaxi || pst.New.LightLanding) && (this.TrackingStatus is TrackingStatus.GroundOperations or TrackingStatus.Tracking))
{
- this.AddTrackingEvent(this.PrimaryTracking, pst.New, FlightTrackingEventType.TaxiLandingLightsEngine, OpenSkyColors.OpenSkyRed, $"OpenSky Warning: Taxi and/or Landing light on when engine was turned {(pst.New.EngineRunning ? "on" : "off")}");
- this.fsConnect.SetText($"OpenSky Warning: Taxi and/or Landing light on when engine was turned {(pst.New.EngineRunning ? "on" : "off")}", 5);
+ this.AddTrackingEvent(
+ this.PrimaryTracking,
+ pst.New,
+ FlightTrackingEventType.TaxiLandingLightsEngine,
+ OpenSkyColors.OpenSkyRed,
+ $"OpenSky Warning: Taxi and/or Landing light on when engine was turned {(pst.New.EngineRunning ? "on" : "off")}");
}
// Was the engine turned off on the ground, not moving, while tracking? -> End tracking session, save reports and report to API
@@ -167,10 +183,9 @@ private void MonitorSecondarySystems(ProcessSecondaryTracking pst)
{
Debug.WriteLine("Engine was turned off, but the plane was never airborne, aborting...");
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSnegative.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSnegative.wav"));
player.PlaySync();
SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.EngineOffNeverAirborne);
- this.fsConnect.SetText("OpenSky Warning: Engine was turned off, but the plane was never airborne, aborting...", 5);
this.StopTracking(false);
}
else
@@ -183,7 +198,6 @@ private void MonitorSecondarySystems(ProcessSecondaryTracking pst)
if (!this.taxiInTurned)
{
this.AddTrackingEvent(this.PrimaryTracking, pst.New, FlightTrackingEventType.EngineOffRunway, OpenSkyColors.OpenSkyWarningOrange, "Engine turned off on the runway?");
- this.fsConnect.SetText("OpenSky Warning: Engine turned off on the runway?", 5);
}
this.taxiInStarted = false;
@@ -200,11 +214,7 @@ private void MonitorSecondarySystems(ProcessSecondaryTracking pst)
this.AddTrackingEvent(this.PrimaryTracking, pst.New, FlightTrackingEventType.TrackingStopped, OpenSkyColors.OpenSkyTealLight, "Flight tracking stopped");
// Show landing report notification now?
- if (LandingReportNotification.AfterTurningEnginesOff.Equals(LandingReportNotification.Parse(Settings.Default.LandingReportNotification)))
- {
- UpdateGUIDelegate showNotification = () => new Views.LandingReport().Show();
- Application.Current.Dispatcher.BeginInvoke(showNotification);
- }
+ this.LandingReported?.Invoke(this, LandingReportNotification.AfterTurningEnginesOff);
// Actually finish up the tracking session now
SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.FlightCompleteSubmitting);
@@ -218,11 +228,10 @@ private void MonitorSecondarySystems(ProcessSecondaryTracking pst)
{
Debug.WriteLine("OpenSky Warning: Tracking aborted, you cannot start your pushback while ground handling isn't complete!");
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSnegative.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSnegative.wav"));
player.PlaySync();
SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedPushbackGroundHandling);
this.StopTracking(false);
- this.fsConnect.SetText("OpenSky Warning: Tracking aborted, you cannot start your pushback while ground handling isn't complete!", 5);
}
// Pushback start?
@@ -308,11 +317,10 @@ private void MonitorSecondarySystems(ProcessSecondaryTracking pst)
{
Debug.WriteLine("OpenSky Warning: Tracking aborted, crash detection turned off!");
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSnegative.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSnegative.wav"));
player.PlaySync();
SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedCrashDetectOff);
this.StopTracking(false);
- this.fsConnect.SetText("OpenSky Warning: Tracking aborted, crash detection turned off!", 5);
}
// Was unlimited fuel turned on?
@@ -320,11 +328,10 @@ private void MonitorSecondarySystems(ProcessSecondaryTracking pst)
{
Debug.WriteLine("OpenSky Warning: Tracking aborted, unlimited fuel turned on!");
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSnegative.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSnegative.wav"));
player.PlaySync();
SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedUnlimitedFuel);
this.StopTracking(false);
- this.fsConnect.SetText("OpenSky Warning: Tracking aborted, unlimited fuel turned on!", 5);
}
// Was the time in the sim changed?
@@ -335,22 +342,20 @@ private void MonitorSecondarySystems(ProcessSecondaryTracking pst)
{
Debug.WriteLine("OpenSky Warning: Tracking aborted, time moved backwards!");
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSnegative.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSnegative.wav"));
player.PlaySync();
SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedTimeBackwards);
this.StopTracking(false);
- this.fsConnect.SetText("OpenSky Warning: Tracking aborted, time moved backwards!", 5);
}
if (timeDelta.TotalSeconds > 30)
{
Debug.WriteLine("OpenSky Warning: Tracking aborted, time changed in sim!");
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSnegative.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSnegative.wav"));
player.PlaySync();
SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedTimeChanged);
this.StopTracking(false);
- this.fsConnect.SetText("OpenSky Warning: Tracking aborted, time changed in sim!", 5);
}
}
}
diff --git a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.cs b/OpenSky.Agent.Simulator/Simulator.Process.cs
similarity index 51%
rename from OpenSky.AgentMSFS/SimConnect/SimConnect.Process.cs
rename to OpenSky.Agent.Simulator/Simulator.Process.cs
index 4bb979c..c7b6264 100644
--- a/OpenSky.AgentMSFS/SimConnect/SimConnect.Process.cs
+++ b/OpenSky.Agent.Simulator/Simulator.Process.cs
@@ -1,46 +1,32 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect
+namespace OpenSky.Agent.Simulator
{
using System;
using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
using System.Device.Location;
using System.Diagnostics;
using System.Media;
using System.Reflection;
using System.Threading;
- using System.Windows;
- using System.Windows.Media;
using JetBrains.Annotations;
using Microsoft.Maps.MapControl.WPF;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.SimConnect.Enums;
- using OpenSky.AgentMSFS.SimConnect.Helpers;
- using OpenSky.AgentMSFS.SimConnect.Structs;
- using OpenSky.AgentMSFS.Tools;
- using OpenSky.FlightLogXML;
-
- using TrackingEventLogEntry = Models.TrackingEventLogEntry;
- using TrackingEventMarker = Models.TrackingEventMarker;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Models;
/// -------------------------------------------------------------------------------------------------
- ///
- /// Simconnect client - data processing code.
- ///
- ///
- /// sushi.at, 13/03/2021.
- ///
+ ///
+ /// Simulator interface - data processing.
+ ///
/// -------------------------------------------------------------------------------------------------
- public partial class SimConnect
+ public partial class Simulator
{
/// -------------------------------------------------------------------------------------------------
///
@@ -48,7 +34,7 @@ public partial class SimConnect
///
/// -------------------------------------------------------------------------------------------------
[NotNull]
- private readonly ConcurrentQueue landingAnalysisProcessingQueue;
+ protected readonly ConcurrentQueue landingAnalysisProcessingQueue;
/// -------------------------------------------------------------------------------------------------
///
@@ -56,7 +42,7 @@ public partial class SimConnect
///
/// -------------------------------------------------------------------------------------------------
[NotNull]
- private readonly ConcurrentQueue primaryTrackingProcessingQueue;
+ protected readonly ConcurrentQueue primaryTrackingProcessingQueue;
/// -------------------------------------------------------------------------------------------------
///
@@ -64,35 +50,21 @@ public partial class SimConnect
///
/// -------------------------------------------------------------------------------------------------
[NotNull]
- private readonly ConcurrentQueue secondaryTrackingProcessingQueue;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The tracking event markers.
- ///
- /// -------------------------------------------------------------------------------------------------
- private readonly List trackingEventMarkers = new();
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Occurs when the plane's location changed.
- ///
- /// -------------------------------------------------------------------------------------------------
- public event EventHandler LocationChanged;
+ protected readonly ConcurrentQueue secondaryTrackingProcessingQueue;
/// -------------------------------------------------------------------------------------------------
///
- /// Occurs when SimConnect adds a new tracking event marker.
+ /// Gets the length of the landing analysis processing queue.
///
/// -------------------------------------------------------------------------------------------------
- public event EventHandler TrackingEventMarkerAdded;
+ public int LandingAnalysisProcessingQueueLength => this.landingAnalysisProcessingQueue.Count;
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the length of the landing analysis processing queue.
+ /// The last received/request date times dictionary.
///
/// -------------------------------------------------------------------------------------------------
- public int LandingAnalysisProcessingQueueLength => this.landingAnalysisProcessingQueue.Count;
+ public ObservableConcurrentDictionary LastReceivedTimes { get; }
/// -------------------------------------------------------------------------------------------------
///
@@ -103,183 +75,152 @@ public partial class SimConnect
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the length of the secondary tracking processing queue.
+ /// The sample rates/request dictionary.
///
/// -------------------------------------------------------------------------------------------------
- public int SecondaryTrackingProcessingQueueLength => this.secondaryTrackingProcessingQueue.Count;
+ public ObservableConcurrentDictionary SampleRates { get; }
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the tracking event log entries.
+ /// Gets the length of the secondary tracking processing queue.
///
/// -------------------------------------------------------------------------------------------------
- public ObservableCollection TrackingEventLogEntries { get; }
+ public int SecondaryTrackingProcessingQueueLength => this.secondaryTrackingProcessingQueue.Count;
/// -------------------------------------------------------------------------------------------------
///
- /// Add a tracking event to the map and log.
+ /// Refresh the request-associated data model object NOW, don't wait for normal refresh interval.
///
///
- /// sushi.at, 16/03/2021.
+ /// sushi.at, 31/01/2022.
///
- ///
- /// The primary Simconnect tracking data.
- ///
- ///
- /// The secondary Simconnect tracking data.
- ///
- ///
- /// The flight tracking event type.
- ///
- ///
- /// The color to use for the marker.
- ///
- ///
- /// The event text (what happened?).
+ ///
+ /// The request ID type to refresh.
///
/// -------------------------------------------------------------------------------------------------
- private void AddTrackingEvent(PrimaryTracking primary, SecondaryTracking secondary, FlightTrackingEventType type, Color color, string text)
+ public void RefreshModelNow(Requests request)
{
- if (this.TrackingStatus != TrackingStatus.Tracking && this.TrackingStatus != TrackingStatus.GroundOperations)
- {
- return;
- }
-
- UpdateGUIDelegate addTrackingEvent = () =>
- {
- Debug.WriteLine($"Adding tracking event: {text}");
- if (this.lastNonPositionReportMarker == null || this.lastNonPositionReportMarker.GetDistanceTo(primary) >= 20)
- {
- lock (this.trackingEventMarkers)
- {
- var newMarker = new TrackingEventMarker(primary, secondary, this.WeightAndBalance.FuelTotalQuantity, 16, color, text);
- this.lastNonPositionReportMarker = newMarker;
- this.trackingEventMarkers.Add(newMarker);
- this.TrackingEventMarkerAdded?.Invoke(this, newMarker);
- }
- }
- else
- {
- this.lastNonPositionReportMarker.AddEventToMarker(DateTime.UtcNow, text);
- }
-
- this.TrackingEventLogEntries.Add(new TrackingEventLogEntry(type, DateTime.UtcNow, color, text, primary.MapLocation));
- };
- Application.Current.Dispatcher.BeginInvoke(addTrackingEvent);
+ this.LastReceivedTimes[request] = null;
}
/// -------------------------------------------------------------------------------------------------
///
- /// Monitor tracking start conditions.
+ /// Monitor start/resume tracking conditions.
///
///
- /// sushi.at, 28/03/2021.
+ /// sushi.at, 31/01/2022.
///
- ///
- /// The secondary Simconnect tracking data (old and new).
+ ///
+ /// The secondary tracking data.
///
/// -------------------------------------------------------------------------------------------------
- private void MonitorTrackingStartConditions(ProcessSecondaryTracking pst)
+ protected void MonitorTrackingStartConditions(SecondaryTracking secondary)
{
if (this.Flight != null && this.TrackingStatus == TrackingStatus.Preparing || this.TrackingStatus == TrackingStatus.Resuming)
{
- this.TrackingConditions[(int)Models.TrackingConditions.DateTime].Expected = $"{DateTime.UtcNow.AddHours(this.Flight?.UtcOffset ?? 0):HH:mm dd.MM.yyyy}";
- this.TrackingConditions[(int)Models.TrackingConditions.DateTime].Current = $"{pst.New.UtcDateTime:HH:mm dd.MM.yyyy}";
- this.TrackingConditions[(int)Models.TrackingConditions.PlaneModel].Current = this.PlaneIdentity.Type;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.DateTime].Expected = $"{DateTime.UtcNow.AddHours(this.Flight?.UtcOffset ?? 0):HH:mm dd.MM.yyyy}";
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.DateTime].Current = $"{secondary.UtcDateTime:HH:mm dd.MM.yyyy}";
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.PlaneModel].Current = this.AircraftIdentity.Type;
- this.TrackingConditions[(int)Models.TrackingConditions.DateTime].ConditionMet =
- this.TrackingConditions[(int)Models.TrackingConditions.DateTime].AutoSet || Math.Abs((DateTime.UtcNow.AddHours(this.Flight?.UtcOffset ?? 0) - pst.New.UtcDateTime).TotalMinutes) < 1;
- this.TrackingConditions[(int)Models.TrackingConditions.PlaneModel].ConditionMet = this.Flight?.Aircraft.Type.MatchesAircraftInSimulator() ?? false;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.DateTime].ConditionMet =
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.DateTime].AutoSet || Math.Abs((DateTime.UtcNow.AddHours(this.Flight?.UtcOffset ?? 0) - secondary.UtcDateTime).TotalMinutes) < 1;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.PlaneModel].ConditionMet = this.Flight?.Aircraft.Type.MatchesAircraftInSimulator() ?? false;
if (this.TrackingStatus == TrackingStatus.Preparing)
{
- this.TrackingConditions[(int)Models.TrackingConditions.Fuel].Enabled = true;
- this.TrackingConditions[(int)Models.TrackingConditions.Payload].Enabled = true;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Fuel].Enabled = true;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Payload].Enabled = true;
- this.TrackingConditions[(int)Models.TrackingConditions.Fuel].Current = $"{this.WeightAndBalance.FuelTotalQuantity:F1} gal, {this.WeightAndBalance.FuelTotalQuantity * 3.78541:F1} liters ▶ {this.WeightAndBalance.FuelTotalQuantity * this.Flight?.Aircraft.Type.FuelWeightPerGallon:F1} lbs, {this.WeightAndBalance.FuelTotalQuantity * this.Flight?.Aircraft.Type.FuelWeightPerGallon * 0.453592:F1} kg";
- this.TrackingConditions[(int)Models.TrackingConditions.Payload].Current = $"{this.PayloadStations.TotalWeight:F1} lbs, {this.PayloadStations.TotalWeight * 0.453592:F1} kg";
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Fuel].Current =
+ $"{this.WeightAndBalance.FuelTotalQuantity:F1} gal, {this.WeightAndBalance.FuelTotalQuantity * 3.78541:F1} liters ▶ {this.WeightAndBalance.FuelTotalQuantity * this.Flight?.Aircraft.Type.FuelWeightPerGallon:F1} lbs, {this.WeightAndBalance.FuelTotalQuantity * this.Flight?.Aircraft.Type.FuelWeightPerGallon * 0.453592:F1} kg";
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Payload].Current = $"{this.PayloadStations.TotalWeight:F1} lbs, {this.PayloadStations.TotalWeight * 0.453592:F1} kg";
- this.TrackingConditions[(int)Models.TrackingConditions.Fuel].ConditionMet =
- this.TrackingConditions[(int)Models.TrackingConditions.Fuel].AutoSet || Math.Abs(this.WeightAndBalance.FuelTotalQuantity - this.Flight?.FuelGallons ?? 0) < 0.27; // Allow roughly 1 liter of margin
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Fuel].ConditionMet =
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Fuel].AutoSet || Math.Abs((int)(this.WeightAndBalance.FuelTotalQuantity - this.Flight?.FuelGallons ?? 0)) < 0.27; // Allow roughly 1 liter of margin
- this.TrackingConditions[(int)Models.TrackingConditions.Payload].ConditionMet =
- this.TrackingConditions[(int)Models.TrackingConditions.Payload].AutoSet || Math.Abs(this.PayloadStations.TotalWeight - this.Flight?.PayloadPounds ?? 0) < 2.2; // Allow 1 kg of margin
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Payload].ConditionMet =
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Payload].AutoSet || Math.Abs((int)(this.PayloadStations.TotalWeight - this.Flight?.PayloadPounds ?? 0)) < 2.2; // Allow 1 kg of margin
- this.TrackingConditions[(int)Models.TrackingConditions.RealismSettings].Expected = "No slew, No unlimited fuel,\r\nCrash detection, SimRate=1";
- this.TrackingConditions[(int)Models.TrackingConditions.RealismSettings].ConditionMet = !this.PrimaryTracking.SlewActive && !pst.New.UnlimitedFuel && pst.New.CrashDetection && Math.Abs(this.PrimaryTracking.SimulationRate - 1) == 0;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.RealismSettings].Expected = "No slew, No unlimited fuel,\r\nCrash detection, SimRate=1";
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.RealismSettings].ConditionMet =
+ !this.PrimaryTracking.SlewActive && !secondary.UnlimitedFuel && secondary.CrashDetection && Math.Abs((int)(this.PrimaryTracking.SimulationRate - 1)) == 0;
- this.TrackingConditions[(int)Models.TrackingConditions.Location].Current =
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Location].Current =
$"{this.PrimaryTracking.GeoCoordinate.GetDistanceTo(new GeoCoordinate(this.Flight?.Origin.Latitude ?? 0, this.Flight?.Origin.Longitude ?? 0)) / 1000:F2} km from starting location - {(this.PrimaryTracking.OnGround ? "On ground" : "Airborne")}";
- this.TrackingConditions[(int)Models.TrackingConditions.Location].ConditionMet = this.PrimaryTracking.GeoCoordinate.GetDistanceTo(new GeoCoordinate(this.Flight?.Origin.Latitude ?? 0, this.Flight?.Origin.Longitude ?? 0)) < 5000;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Location].ConditionMet =
+ this.PrimaryTracking.GeoCoordinate.GetDistanceTo(new GeoCoordinate(this.Flight?.Origin.Latitude ?? 0, this.Flight?.Origin.Longitude ?? 0)) < 5000;
}
if (this.TrackingStatus == TrackingStatus.Resuming)
{
if (this.Flight?.Aircraft.Type.RequiresManualFuelling != true)
{
- this.TrackingConditions[(int)Models.TrackingConditions.Fuel].Enabled = false;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Fuel].Enabled = false;
}
else
{
- this.TrackingConditions[(int)Models.TrackingConditions.Fuel].Enabled = true;
- this.TrackingConditions[(int)Models.TrackingConditions.Fuel].Current = $"{this.WeightAndBalance.FuelTotalQuantity:F1} gal, {this.WeightAndBalance.FuelTotalQuantity * 3.78541:F1} liters ▶ {this.WeightAndBalance.FuelTotalQuantity * this.Flight?.Aircraft.Type.FuelWeightPerGallon:F1} lbs, {this.WeightAndBalance.FuelTotalQuantity * this.Flight?.Aircraft.Type.FuelWeightPerGallon * 0.453592:F1} kg";
- this.TrackingConditions[(int)Models.TrackingConditions.Fuel].ConditionMet =
- this.TrackingConditions[(int)Models.TrackingConditions.Fuel].AutoSet || Math.Abs(this.WeightAndBalance.FuelTotalQuantity - this.flightLoadingTempStructs.FuelTanks.TotalQuantity) < 0.81; // Allow roughly 3 liters of margin, as it can be very hard to get this right otherwise
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Fuel].Enabled = true;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Fuel].Current =
+ $"{this.WeightAndBalance.FuelTotalQuantity:F1} gal, {this.WeightAndBalance.FuelTotalQuantity * 3.78541:F1} liters ▶ {this.WeightAndBalance.FuelTotalQuantity * this.Flight?.Aircraft.Type.FuelWeightPerGallon:F1} lbs, {this.WeightAndBalance.FuelTotalQuantity * this.Flight?.Aircraft.Type.FuelWeightPerGallon * 0.453592:F1} kg";
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Fuel].ConditionMet =
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Fuel].AutoSet ||
+ Math.Abs(this.WeightAndBalance.FuelTotalQuantity - this.flightLoadingTempModels.FuelTanks.TotalQuantity) < 0.81; // Allow roughly 3 liters of margin, as it can be very hard to get this right otherwise
}
if (this.Flight?.Aircraft.Type.RequiresManualLoading != true)
{
- this.TrackingConditions[(int)Models.TrackingConditions.Payload].Enabled = false;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Payload].Enabled = false;
}
else
{
- this.TrackingConditions[(int)Models.TrackingConditions.Payload].Enabled = true;
- this.TrackingConditions[(int)Models.TrackingConditions.Payload].Current = $"{this.PayloadStations.TotalWeight:F1} lbs, {this.PayloadStations.TotalWeight * 0.453592:F1} kg";
- this.TrackingConditions[(int)Models.TrackingConditions.Payload].ConditionMet =
- this.TrackingConditions[(int)Models.TrackingConditions.Payload].AutoSet || Math.Abs((double)(this.PayloadStations.TotalWeight - this.Flight?.PayloadPounds)) < 2.2; // Allow 1 kg of margin
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Payload].Enabled = true;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Payload].Current = $"{this.PayloadStations.TotalWeight:F1} lbs, {this.PayloadStations.TotalWeight * 0.453592:F1} kg";
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Payload].ConditionMet =
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Payload].AutoSet || Math.Abs((double)(this.PayloadStations.TotalWeight - this.Flight?.PayloadPounds)) < 2.2; // Allow 1 kg of margin
}
- var currentLocation = $"{this.PrimaryTracking.GeoCoordinate.GetDistanceTo(this.flightLoadingTempStructs?.SlewPlaneIntoPosition.GeoCoordinate ?? new GeoCoordinate(0, 0, 0)) / 1000:F2} km from resume location";
- currentLocation += $"\r\nLatitude: {this.flightLoadingTempStructs?.SlewPlaneIntoPosition.Latitude:F4}";
- currentLocation += $"\r\nLongitude: {this.flightLoadingTempStructs?.SlewPlaneIntoPosition.Longitude:F4}";
- currentLocation += $"\r\nAltitude (AGL): {this.flightLoadingTempStructs?.SlewPlaneIntoPosition.RadioHeight:F0}";
+ var currentLocation = $"{this.PrimaryTracking.GeoCoordinate.GetDistanceTo(this.flightLoadingTempModels?.SlewAircraftIntoPosition.GeoCoordinate ?? new GeoCoordinate(0, 0, 0)) / 1000:F2} km from resume location";
+ currentLocation += $"\r\nLatitude: {this.flightLoadingTempModels?.SlewAircraftIntoPosition.Latitude:F4}";
+ currentLocation += $"\r\nLongitude: {this.flightLoadingTempModels?.SlewAircraftIntoPosition.Longitude:F4}";
+ currentLocation += $"\r\nAltitude (AGL): {this.flightLoadingTempModels?.SlewAircraftIntoPosition.RadioHeight:F0}";
- this.TrackingConditions[(int)Models.TrackingConditions.RealismSettings].Expected = "No unlimited fuel,\r\nCrash detection, SimRate=1";
- this.TrackingConditions[(int)Models.TrackingConditions.RealismSettings].ConditionMet = !pst.New.UnlimitedFuel && pst.New.CrashDetection && Math.Abs(this.PrimaryTracking.SimulationRate - 1) == 0;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.RealismSettings].Expected = "No unlimited fuel,\r\nCrash detection, SimRate=1";
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.RealismSettings].ConditionMet = !secondary.UnlimitedFuel && secondary.CrashDetection && Math.Abs((int)(this.PrimaryTracking.SimulationRate - 1)) == 0;
- this.TrackingConditions[(int)Models.TrackingConditions.Location].Current = currentLocation;
- this.TrackingConditions[(int)Models.TrackingConditions.Location].ConditionMet =
- (this.PrimaryTracking.GeoCoordinate.GetDistanceTo(this.flightLoadingTempStructs?.SlewPlaneIntoPosition.GeoCoordinate ?? new GeoCoordinate(0, 0, 0)) < 100) &&
- Math.Abs(this.PrimaryTracking.RadioHeight - this.flightLoadingTempStructs?.SlewPlaneIntoPosition.RadioHeight ?? -1000) < 50;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Location].Current = currentLocation;
+ this.TrackingConditions[(int)Agent.Simulator.Models.TrackingConditions.Location].ConditionMet =
+ (this.PrimaryTracking.GeoCoordinate.GetDistanceTo(this.flightLoadingTempModels?.SlewAircraftIntoPosition.GeoCoordinate ?? new GeoCoordinate(0, 0, 0)) < 100) &&
+ Math.Abs((int)(this.PrimaryTracking.RadioHeight - this.flightLoadingTempModels?.SlewAircraftIntoPosition.RadioHeight ?? -1000)) < 50;
}
}
}
/// -------------------------------------------------------------------------------------------------
///
- /// Process the landing analysis data (old vs new)
+ /// Process aircraft identity.
///
///
- /// sushi.at, 25/03/2021.
+ /// sushi.at, 31/01/2022.
///
/// -------------------------------------------------------------------------------------------------
- private void ProcessLandingAnalysis()
+ protected void ProcessAircraftIdentity()
{
- while (!this.close)
+ try
{
- while (this.landingAnalysisProcessingQueue.TryDequeue(out var pla))
+ // Make sure the player didn't use the dev mode to switch the plane
+ if (this.Flight != null && (this.TrackingStatus is TrackingStatus.GroundOperations or TrackingStatus.Tracking) && !this.Flight.Aircraft.Type.MatchesAircraftInSimulator())
{
- try
- {
- this.CheckForAndAnalyseLanding(pla);
- }
- catch (Exception ex)
- {
- Debug.WriteLine("Error processing landing analysis: " + ex);
- }
+ Debug.WriteLine("OpenSky Warning: Tracking aborted, aircraft type was changed.");
+ var assembly = Assembly.GetExecutingAssembly();
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSnegative.wav"));
+ player.PlaySync();
+ SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedAircraftType);
+ this.StopTracking(false);
}
-
- Thread.Sleep(500);
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Error processing plane identity: " + ex);
}
}
@@ -288,32 +229,31 @@ private void ProcessLandingAnalysis()
/// Process the payload stations.
///
///
- /// sushi.at, 26/11/2021.
+ /// sushi.at, 31/01/2022.
///
- ///
- /// The old payload stations.
+ ///
+ /// The older data.
///
- ///
- /// The new payload stations.
+ ///
+ /// The newer data.
///
/// -------------------------------------------------------------------------------------------------
- private void ProcessPayloadStations(PayloadStations oldPayload, PayloadStations newPayload)
+ protected void ProcessPayloadStations(PayloadStations older, PayloadStations newer)
{
try
{
if (this.Flight != null && (this.TrackingStatus is TrackingStatus.GroundOperations or TrackingStatus.Tracking))
{
- if (Math.Abs(oldPayload.TotalWeight - newPayload.TotalWeight) > 0.1)
+ if (Math.Abs(older.TotalWeight - newer.TotalWeight) > 0.1)
{
- if (Math.Abs(newPayload.TotalWeight - this.Flight.PayloadPounds) > this.Flight.Aircraft.Type.MaxPayloadDeltaAllowed)
+ if (Math.Abs(newer.TotalWeight - this.Flight.PayloadPounds) > this.Flight.Aircraft.Type.MaxPayloadDeltaAllowed)
{
Debug.WriteLine("OpenSky Warning: Tracking aborted, payload changed below required load.");
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSnegative.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSnegative.wav"));
player.PlaySync();
SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedPayloadChange);
this.StopTracking(false);
- this.fsConnect.SetText("OpenSky Warning: Tracking aborted, payload changed.", 5);
}
}
}
@@ -326,155 +266,166 @@ private void ProcessPayloadStations(PayloadStations oldPayload, PayloadStations
/// -------------------------------------------------------------------------------------------------
///
- /// Process the plane identity.
+ /// Process the weight and balance.
///
///
/// sushi.at, 28/03/2021.
///
+ ///
+ /// The old weight and balance.
+ ///
+ ///
+ /// The new weight and balance.
+ ///
/// -------------------------------------------------------------------------------------------------
- private void ProcessPlaneIdentity()
+ protected void ProcessWeightAndBalance(WeightAndBalance oldWB, WeightAndBalance newWB)
{
try
{
- // Make sure the player didn't use the dev mode to switch the plane
- if (this.Flight != null && (this.TrackingStatus is TrackingStatus.GroundOperations or TrackingStatus.Tracking) && !this.Flight.Aircraft.Type.MatchesAircraftInSimulator())
+ if (this.Flight != null && (this.TrackingStatus is TrackingStatus.GroundOperations or TrackingStatus.Tracking))
{
- Debug.WriteLine("OpenSky Warning: Tracking aborted, aircraft type was changed.");
- var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSnegative.wav"));
- player.PlaySync();
- SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedAircraftType);
- this.StopTracking(false);
- this.fsConnect.SetText("OpenSky Warning: Tracking aborted, aircraft type was changed.", 5);
+ // Did the fuel go up?
+ if (newWB.FuelTotalQuantity > oldWB.FuelTotalQuantity)
+ {
+ if (newWB.FuelTotalQuantity - oldWB.FuelTotalQuantity > 0.5)
+ {
+ Debug.WriteLine("OpenSky Warning: Tracking aborted, fuel increased.");
+ var assembly = Assembly.GetExecutingAssembly();
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSnegative.wav"));
+ player.PlaySync();
+ SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedFuelIncreased);
+ this.StopTracking(false);
+ }
+ else
+ {
+ Debug.WriteLine($"Small fuel jump detected: {newWB.FuelTotalQuantity - oldWB.FuelTotalQuantity} gallons");
+ }
+ }
}
}
catch (Exception ex)
{
- Debug.WriteLine("Error processing plane identity: " + ex);
+ Debug.WriteLine("Error processing weight and balance: " + ex);
}
}
/// -------------------------------------------------------------------------------------------------
///
- /// Process the primary tracking data (old vs new).
+ /// Process the landing analysis data (old vs new)
///
///
- /// sushi.at, 15/03/2021.
+ /// sushi.at, 25/03/2021.
///
/// -------------------------------------------------------------------------------------------------
- private void ProcessPrimaryTracking()
+ private void ProcessLandingAnalysis()
{
while (!this.close)
{
- Location newLocation = null;
- while (this.primaryTrackingProcessingQueue.TryDequeue(out var ppt))
+ while (this.landingAnalysisProcessingQueue.TryDequeue(out var pla))
{
try
{
- this.CheckChangesOverTime(ppt.New);
- this.MonitorPrimarySystems(ppt);
- this.AddPositionReport(ppt.New);
- this.TrackFlight(ppt);
-
- // Fire the location changed event?
- if (!ppt.Old.MapLocation.Equals(ppt.New.MapLocation))
- {
- newLocation = ppt.New.MapLocation;
- }
-
- // Are we close to landing?
- this.SampleRates[Requests.LandingAnalysis] = this.WasAirborne && ppt.New.RadioHeight < 500 ? 25 : 500;
- this.OnPropertyChanged(nameof(this.SampleRates));
+ this.CheckForAndAnalyseLanding(pla);
}
catch (Exception ex)
{
- Debug.WriteLine("Error processing primary tracking: " + ex);
+ Debug.WriteLine("Error processing landing analysis: " + ex);
}
}
- if (newLocation != null)
- {
- this.LocationChanged?.Invoke(this, newLocation);
- }
-
Thread.Sleep(500);
}
}
/// -------------------------------------------------------------------------------------------------
///
- /// Process the secondary tracking data (old vs new).
+ /// Process the primary tracking data (old vs new).
///
///
/// sushi.at, 15/03/2021.
///
/// -------------------------------------------------------------------------------------------------
- private void ProcessSecondaryTracking()
+ private void ProcessPrimaryTracking()
{
while (!this.close)
{
- while (this.secondaryTrackingProcessingQueue.TryDequeue(out var pst))
+ Location newLocation = null;
+ while (this.primaryTrackingProcessingQueue.TryDequeue(out var ppt))
{
try
{
- this.MonitorLights(pst);
- this.TransitionFlightPhase();
- this.MonitorSecondarySystems(pst);
- this.MonitorTrackingStartConditions(pst);
+ if (ppt.Old != null && ppt.New != null)
+ {
+ this.CheckChangesOverTime(ppt.New);
+ this.MonitorPrimarySystems(ppt);
+ this.AddPositionReport(ppt.New);
+ this.TrackFlight(ppt);
+
+ // Fire the location changed event?
+ if (!ppt.Old.MapLocation.Equals(ppt.New.MapLocation))
+ {
+ newLocation = ppt.New.MapLocation;
+ }
+
+ // Are we close to landing?
+ this.SampleRates[Requests.LandingAnalysis] = this.WasAirborne && ppt.New.RadioHeight < 500 ? 25 : 500;
+ this.OnPropertyChanged(nameof(this.SampleRates));
+ }
+ else
+ {
+ Debug.WriteLine("Dequeued primary tracking containing at least one NULL value.");
+ }
}
catch (Exception ex)
{
- Debug.WriteLine("Error processing secondary tracking: " + ex);
+ Debug.WriteLine("Error processing primary tracking: " + ex);
}
}
+ if (newLocation != null)
+ {
+ this.LocationChanged?.Invoke(this, newLocation);
+ }
+
Thread.Sleep(500);
}
}
/// -------------------------------------------------------------------------------------------------
///
- /// Process the weight and balance.
+ /// Process the secondary tracking data (old vs new).
///
///
- /// sushi.at, 28/03/2021.
+ /// sushi.at, 15/03/2021.
///
- ///
- /// The old weight and balance.
- ///
- ///
- /// The new weight and balance.
- ///
/// -------------------------------------------------------------------------------------------------
- private void ProcessWeightAndBalance(WeightAndBalance oldWB, WeightAndBalance newWB)
+ private void ProcessSecondaryTracking()
{
- try
+ while (!this.close)
{
- if (this.Flight != null && (this.TrackingStatus is TrackingStatus.GroundOperations or TrackingStatus.Tracking))
+ while (this.secondaryTrackingProcessingQueue.TryDequeue(out var pst))
{
- // Did the fuel go up?
- if (newWB.FuelTotalQuantity > oldWB.FuelTotalQuantity)
+ try
{
- if (newWB.FuelTotalQuantity - oldWB.FuelTotalQuantity > 0.5)
+ if (pst.Old != null && pst.New != null)
{
- Debug.WriteLine("OpenSky Warning: Tracking aborted, fuel increased.");
- var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSnegative.wav"));
- player.PlaySync();
- SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.AbortedFuelIncreased);
- this.StopTracking(false);
- this.fsConnect.SetText("OpenSky Warning: Tracking aborted, fuel increased.", 5);
+ this.MonitorLights(pst);
+ this.TransitionFlightPhase();
+ this.MonitorSecondarySystems(pst);
+ this.MonitorTrackingStartConditions(pst.New);
}
else
{
- Debug.WriteLine($"Small fuel jump detected: {newWB.FuelTotalQuantity - oldWB.FuelTotalQuantity} gallons");
+ Debug.WriteLine("Dequeued secondary tracking containing at least one NULL value.");
}
}
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Error processing secondary tracking: " + ex);
+ }
}
- }
- catch (Exception ex)
- {
- Debug.WriteLine("Error processing weight and balance: " + ex);
+
+ Thread.Sleep(500);
}
}
}
diff --git a/OpenSky.AgentMSFS/SimConnect/SimConnect.SaveLoadXML.cs b/OpenSky.Agent.Simulator/Simulator.SaveLoadXML.cs
similarity index 93%
rename from OpenSky.AgentMSFS/SimConnect/SimConnect.SaveLoadXML.cs
rename to OpenSky.Agent.Simulator/Simulator.SaveLoadXML.cs
index a1eb3e2..296b56f 100644
--- a/OpenSky.AgentMSFS/SimConnect/SimConnect.SaveLoadXML.cs
+++ b/OpenSky.Agent.Simulator/Simulator.SaveLoadXML.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect
+namespace OpenSky.Agent.Simulator
{
using System;
using System.Device.Location;
@@ -17,28 +17,110 @@ namespace OpenSky.AgentMSFS.SimConnect
using Microsoft.Maps.MapControl.WPF;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Models;
+ using OpenSky.Agent.Simulator.Tools;
using OpenSky.FlightLogXML;
using OpenSkyApi;
- using TrackingEventLogEntry = Models.TrackingEventLogEntry;
- using TrackingEventMarker = Models.TrackingEventMarker;
+ using TrackingEventLogEntry = OpenSky.Agent.Simulator.Models.TrackingEventLogEntry;
+ using TrackingEventMarker = OpenSky.Agent.Simulator.Models.TrackingEventMarker;
/// -------------------------------------------------------------------------------------------------
///
- /// Simconnect client - flight save/load code.
+ /// Simulator interface - save/load.
///
/// -------------------------------------------------------------------------------------------------
- public partial class SimConnect
+ public partial class Simulator
{
/// -------------------------------------------------------------------------------------------------
///
/// Identifier for the agent.
///
/// -------------------------------------------------------------------------------------------------
- private const string AgentIdentifier = "OpenSky.AgentMSFS";
+ private const string AgentIdentifier = "OpenSky.Agent";
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Generates a XML save file for the current flight.
+ ///
+ ///
+ /// sushi.at, 22/03/2021.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private XElement GenerateSaveFile()
+ {
+ if ((this.TrackingStatus != TrackingStatus.Tracking && this.TrackingStatus != TrackingStatus.GroundOperations) || this.Flight == null)
+ {
+ Debug.WriteLine("Not generating save file cause we are either not tracking or there is no active flight");
+ return null;
+ }
+
+ try
+ {
+ Debug.WriteLine("Generating flight save XML file...");
+ var log = new FlightLogXML.FlightLog
+ {
+ Agent = AgentIdentifier,
+ AgentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(),
+ OpenSkyUser = "TODO", //UserSessionService.Instance.Username, TODO restore/workaround
+ LocalTimeZone = TimeZoneInfo.Local.BaseUtcOffset.TotalHours,
+ TrackingStarted = this.trackingStarted ?? DateTime.MinValue,
+ TrackingStopped = DateTime.UtcNow,
+ WasAirborne = this.WasAirborne,
+ TimeSavedBecauseOfSimRate = this.timeSavedBecauseOfSimRate,
+ TotalPaused = this.totalPaused,
+
+ FlightID = this.Flight.Id,
+ AircraftRegistry = this.Flight.Aircraft.Registry,
+ UtcOffset = this.Flight.UtcOffset,
+
+ Origin = new FlightLogAirport
+ {
+ Icao = this.Flight.Origin.Icao,
+ Name = this.Flight.Origin.Name,
+ Latitude = this.Flight.Origin.Latitude,
+ Longitude = this.Flight.Origin.Longitude
+ },
+ Destination = new FlightLogAirport
+ {
+ Icao = this.Flight.Destination.Icao,
+ Name = this.Flight.Destination.Name,
+ Latitude = this.Flight.Destination.Latitude,
+ Longitude = this.Flight.Destination.Longitude
+ },
+ Alternate = new FlightLogAirport
+ {
+ Icao = this.Flight.Alternate.Icao,
+ Name = this.Flight.Alternate.Name,
+ Latitude = this.Flight.Alternate.Latitude,
+ Longitude = this.Flight.Alternate.Longitude
+ },
+
+ FuelGallons = this.Flight.FuelGallons ?? 0,
+ Payload = this.Flight.PayloadSummary,
+ PayloadPounds = this.Flight.PayloadPounds
+ };
+
+ log.TrackingEventLogEntries.AddRange(this.TrackingEventLogEntries);
+ lock (this.trackingEventMarkers)
+ {
+ log.TrackingEventMarkers.AddRange(this.trackingEventMarkers.Select(m => m.Marker));
+ }
+
+ log.PositionReports.AddRange(this.AircraftTrailLocations.Cast().Select(loc => loc.Position));
+ log.TouchDowns.AddRange(this.LandingReports);
+ log.NavLogWaypoints.AddRange(this.simbriefWaypointMarkers.Select(w => w.WayPoint));
+
+ return log.GenerateFlightLog();
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Flight save file creation failed: " + ex);
+ throw;
+ }
+ }
/// -------------------------------------------------------------------------------------------------
///
@@ -138,12 +220,14 @@ private void RestoreSaveFile(string saveFile)
this.trackingEventMarkers.Add(runwayMarker);
this.TrackingEventMarkerAdded?.Invoke(this, runwayMarker);
}
+
foreach (var runway in this.Flight.Origin.Runways)
{
var runwayMarker = new TrackingEventMarker(runway);
this.trackingEventMarkers.Add(runwayMarker);
this.TrackingEventMarkerAdded?.Invoke(this, runwayMarker);
}
+
foreach (var runway in this.Flight.Destination.Runways)
{
var runwayMarker = new TrackingEventMarker(runway);
@@ -200,93 +284,5 @@ private void RestoreSaveFile(string saveFile)
// Now that everything has been loaded, replay any and all map markers
this.ReplayMapMarkers();
}
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// The flight loading temporary structs.
- ///
- /// -------------------------------------------------------------------------------------------------
- private FlightLoadingTempStructs flightLoadingTempStructs;
-
- /// -------------------------------------------------------------------------------------------------
- ///
- /// Generates a XML save file for the current flight.
- ///
- ///
- /// sushi.at, 22/03/2021.
- ///
- /// -------------------------------------------------------------------------------------------------
- private XElement GenerateSaveFile()
- {
- if ((this.TrackingStatus != TrackingStatus.Tracking && this.TrackingStatus != TrackingStatus.GroundOperations) || this.Flight == null)
- {
- Debug.WriteLine("Not generating save file cause we are either not tracking or there is no active flight");
- return null;
- }
-
- try
- {
- Debug.WriteLine("Generating flight save XML file...");
- var log = new FlightLogXML.FlightLog
- {
- Agent = AgentIdentifier,
- AgentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(),
- OpenSkyUser = UserSessionService.Instance.Username,
- LocalTimeZone = TimeZoneInfo.Local.BaseUtcOffset.TotalHours,
- TrackingStarted = this.trackingStarted ?? DateTime.MinValue,
- TrackingStopped = DateTime.UtcNow,
- WasAirborne = this.WasAirborne,
- TimeSavedBecauseOfSimRate = this.timeSavedBecauseOfSimRate,
- TotalPaused = this.totalPaused,
-
- FlightID = this.Flight.Id,
- AircraftRegistry = this.Flight.Aircraft.Registry,
- UtcOffset = this.Flight.UtcOffset,
-
- Origin = new FlightLogAirport
- {
- Icao = this.Flight.Origin.Icao,
- Name = this.Flight.Origin.Name,
- Latitude = this.Flight.Origin.Latitude,
- Longitude = this.Flight.Origin.Longitude
- },
- Destination = new FlightLogAirport
- {
- Icao = this.Flight.Destination.Icao,
- Name = this.Flight.Destination.Name,
- Latitude = this.Flight.Destination.Latitude,
- Longitude = this.Flight.Destination.Longitude
- },
- Alternate = new FlightLogAirport
- {
- Icao = this.Flight.Alternate.Icao,
- Name = this.Flight.Alternate.Name,
- Latitude = this.Flight.Alternate.Latitude,
- Longitude = this.Flight.Alternate.Longitude
- },
-
- FuelGallons = this.Flight.FuelGallons ?? 0,
- Payload = this.Flight.PayloadSummary,
- PayloadPounds = this.Flight.PayloadPounds
- };
-
- log.TrackingEventLogEntries.AddRange(this.TrackingEventLogEntries);
- lock (this.trackingEventMarkers)
- {
- log.TrackingEventMarkers.AddRange(this.trackingEventMarkers.Select(m => m.Marker));
- }
-
- log.PositionReports.AddRange(this.AircraftTrailLocations.Cast().Select(loc => loc.Position));
- log.TouchDowns.AddRange(this.LandingReports);
- log.NavLogWaypoints.AddRange(this.simbriefWaypointMarkers.Select(w => w.WayPoint));
-
- return log.GenerateFlightLog();
- }
- catch (Exception ex)
- {
- Debug.WriteLine("Flight save file creation failed: " + ex);
- throw;
- }
- }
}
}
\ No newline at end of file
diff --git a/OpenSky.Agent.Simulator/Simulator.cs b/OpenSky.Agent.Simulator/Simulator.cs
new file mode 100644
index 0000000..e72442b
--- /dev/null
+++ b/OpenSky.Agent.Simulator/Simulator.cs
@@ -0,0 +1,374 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace OpenSky.Agent.Simulator
+{
+ using System;
+ using System.Collections.Concurrent;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Runtime.CompilerServices;
+ using System.Threading;
+
+ using JetBrains.Annotations;
+
+ using Microsoft.Maps.MapControl.WPF;
+
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Models;
+ using OpenSky.FlightLogXML;
+
+ using OpenSkyApi;
+
+ using TrackingEventLogEntry = OpenSky.Agent.Simulator.Models.TrackingEventLogEntry;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Simulator interface.
+ ///
+ ///
+ /// sushi.at, 30/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public abstract partial class Simulator : INotifyPropertyChanged
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Set to true to close the simulator client.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ protected bool close;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The flight loading temporary models.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ protected FlightLoadingTempModels flightLoadingTempModels;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The time the last pause started.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ protected DateTime? pauseStarted;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The total paused timespan.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ protected TimeSpan totalPaused = TimeSpan.Zero;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The OpenSky service instance.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private readonly OpenSkyService openSkyServiceInstance;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// True if we are connected to the simulator.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private bool connected;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The pause info string.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private string pauseInfo;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The OpenSky service instance.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ protected Simulator(OpenSkyService openSkyServiceInstance)
+ {
+ this.openSkyServiceInstance = openSkyServiceInstance;
+ this.primaryTrackingProcessingQueue = new ConcurrentQueue();
+ this.secondaryTrackingProcessingQueue = new ConcurrentQueue();
+ this.landingAnalysisProcessingQueue = new ConcurrentQueue();
+ this.TrackingEventLogEntries = new ObservableCollection();
+ this.AircraftTrailLocations = new LocationCollection();
+ this.SimbriefRouteLocations = new LocationCollection();
+ this.LandingReports = new ObservableCollection();
+
+ // Default values and init data structures
+ this.SampleRates = new ObservableConcurrentDictionary
+ {
+ { Requests.Primary, 50 },
+ { Requests.Secondary, 500 },
+ { Requests.FuelTanks, 15000 },
+ { Requests.PayloadStations, 15000 },
+ { Requests.PlaneIdentity, 15000 },
+ { Requests.WeightAndBalance, 15000 },
+ { Requests.LandingAnalysis, 500 }
+ };
+
+ this.LastReceivedTimes = new ObservableConcurrentDictionary();
+ foreach (Requests request in Enum.GetValues(typeof(Requests)))
+ {
+ this.LastReceivedTimes.Add(request, null);
+ }
+
+ this.TrackingConditions = new Dictionary
+ {
+ { (int)Agent.Simulator.Models.TrackingConditions.DateTime, new TrackingCondition { AutoSet = true } },
+ { (int)Agent.Simulator.Models.TrackingConditions.Fuel, new TrackingCondition { AutoSet = true } },
+ { (int)Agent.Simulator.Models.TrackingConditions.Payload, new TrackingCondition { AutoSet = true } },
+ { (int)Agent.Simulator.Models.TrackingConditions.PlaneModel, new TrackingCondition() },
+ { (int)Agent.Simulator.Models.TrackingConditions.RealismSettings, new TrackingCondition { Expected = "No slew, No unlimited fuel,\r\nCrash detection, SimRate=1" } },
+ { (int)Agent.Simulator.Models.TrackingConditions.Location, new TrackingCondition() }
+ };
+
+ // Start our worker threads
+ new Thread(this.ProcessPrimaryTracking) { Name = "Simulator.ProcessPrimaryTracking" }.Start();
+ new Thread(this.ProcessSecondaryTracking) { Name = "Simulator.ProcessSecondaryTracking" }.Start();
+ new Thread(this.ProcessLandingAnalysis) { Name = "Simulator.ProcessLandingAnalysis" }.Start();
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Occurs when a property value changes.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the simulator instance.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static Simulator Instance { get; private set; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets a value indicating whether the simulator is connected.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool Connected
+ {
+ get => this.connected;
+
+ protected set
+ {
+ if (Equals(this.connected, value))
+ {
+ return;
+ }
+
+ this.connected = value;
+ this.OnPropertyChanged();
+ }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets a value indicating whether the sim is paused (proper pause, not ESC menu and definitely
+ /// not active pause).
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public abstract bool IsPaused { get; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the pause info string.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public string PauseInfo
+ {
+ get => this.pauseInfo;
+
+ protected set
+ {
+ if (Equals(this.pauseInfo, value))
+ {
+ return;
+ }
+
+ this.pauseInfo = value;
+ this.OnPropertyChanged();
+ }
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the type of the simulator.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public abstract OpenSkyApi.Simulator SimulatorType { get; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the tracking conditions.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public Dictionary TrackingConditions { get; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Sets the simulator instance.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The simulator.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static void SetSimulatorInstance(Simulator simulator)
+ {
+ Instance = simulator;
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Close all connections and dispose the simulator client.
+ ///
+ ///
+ /// sushi.at, 13/03/2021.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public void Close()
+ {
+ Debug.WriteLine("SimConnect simulator interface closing down...");
+ if (this.TrackingStatus is TrackingStatus.GroundOperations or TrackingStatus.Tracking)
+ {
+ this.StopTracking(false);
+ }
+
+ this.close = true;
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Pauses the simulator (proper pause).
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// True to pause, false to un-pause.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public abstract void Pause(bool pause);
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Sets the aircraft registration in the simulator.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The registry to set.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public abstract void SetAircraftRegistry(string registry);
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Sets fuel and payload to values restored from a save file.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public abstract void SetFuelAndPayloadFromSave();
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Sets the fuel tanks quantities in the simulator.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The new fuel tank quantities to set.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public abstract void SetFuelTanks(FuelTanks newFuelTanks);
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Sets the payload station weights in the simulator.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The new payload station weights to set.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public abstract void SetPayloadStations(PayloadStations newPayloadStations);
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Sets slew to on or off.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// True to enable, false to disable.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public abstract void SetSlew(bool enable);
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Sets the UTC time in the sim.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The new UTC time.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public abstract void SetTime(DateTime time);
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Slew plane to flight position - flight object determines where, either moves plane to
+ /// starting position or to last reported flight position.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public abstract void SlewPlaneToFlightPosition();
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Executes the property changed action.
+ ///
+ ///
+ /// sushi.at, 13/03/2021.
+ ///
+ ///
+ /// (Optional) Name of the property.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ [NotifyPropertyChangedInvocator]
+ protected virtual void OnPropertyChanged([CallerMemberName] [CanBeNull] string propertyName = null)
+ {
+ this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/SimConnect/SimConnect.Simbrief.cs b/OpenSky.Agent.Simulator/Simulator.simBrief.cs
similarity index 97%
rename from OpenSky.AgentMSFS/SimConnect/SimConnect.Simbrief.cs
rename to OpenSky.Agent.Simulator/Simulator.simBrief.cs
index c88ad2f..9ceb7fb 100644
--- a/OpenSky.AgentMSFS/SimConnect/SimConnect.Simbrief.cs
+++ b/OpenSky.Agent.Simulator/Simulator.simBrief.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
+//
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.SimConnect
+namespace OpenSky.Agent.Simulator
{
using System;
using System.Collections.Generic;
@@ -15,15 +15,15 @@ namespace OpenSky.AgentMSFS.SimConnect
using Microsoft.Maps.MapControl.WPF;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Simulator.Models;
+ using OpenSky.Agent.Simulator.Tools;
/// -------------------------------------------------------------------------------------------------
///
- /// Simconnect client - simbrief flight plan import code.
+ /// Simulator interface - simBrief.
///
/// -------------------------------------------------------------------------------------------------
- public partial class SimConnect
+ public partial class Simulator
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/SpeechSoundPacks.cs b/OpenSky.Agent.Simulator/SpeechSoundPacks.cs
similarity index 95%
rename from OpenSky.AgentMSFS/SpeechSoundPacks.cs
rename to OpenSky.Agent.Simulator/SpeechSoundPacks.cs
index 72fdeba..5052dfc 100644
--- a/OpenSky.AgentMSFS/SpeechSoundPacks.cs
+++ b/OpenSky.Agent.Simulator/SpeechSoundPacks.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS
+namespace OpenSky.Agent.Simulator
{
using System;
using System.Collections.Generic;
@@ -16,8 +16,7 @@ namespace OpenSky.AgentMSFS
using System.Text.RegularExpressions;
using System.Threading;
- using OpenSky.AgentMSFS.Properties;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Simulator.Tools;
/// -------------------------------------------------------------------------------------------------
///
@@ -34,7 +33,7 @@ public class SpeechSoundPacks
/// The single static instance.
///
/// -------------------------------------------------------------------------------------------------
- public static readonly SpeechSoundPacks Instance;
+ public static SpeechSoundPacks Instance { get; private set; }
/// -------------------------------------------------------------------------------------------------
///
@@ -52,15 +51,21 @@ public class SpeechSoundPacks
/// -------------------------------------------------------------------------------------------------
///
- /// Initializes static members of the class.
+ /// Initializes the speech sound packs.
///
///
- /// sushi.at, 24/12/2021.
+ /// sushi.at, 31/01/2022.
///
+ ///
+ /// The selected sound pack.
+ ///
+ ///
+ /// The text to speech voice.
+ ///
/// -------------------------------------------------------------------------------------------------
- static SpeechSoundPacks()
+ public static void InitializeSpeechSoundPacks(string selectedSoundPack, string textToSpeechVoice)
{
- Instance = new SpeechSoundPacks();
+ Instance = new SpeechSoundPacks(selectedSoundPack, textToSpeechVoice);
}
/// -------------------------------------------------------------------------------------------------
@@ -70,21 +75,27 @@ static SpeechSoundPacks()
///
/// sushi.at, 24/12/2021.
///
+ ///
+ /// The selected sound pack.
+ ///
+ ///
+ /// The text to speech voice.
+ ///
/// -------------------------------------------------------------------------------------------------
- private SpeechSoundPacks()
+ private SpeechSoundPacks(string selectedSoundPack, string textToSpeechVoice)
{
try
{
// Load the initial sound pack setting
- this.SelectedSoundPack = Settings.Default.SoundPack;
+ this.SelectedSoundPack = selectedSoundPack;
// Initialize the speech synthesizer
this.speech = new SpeechSynthesizer();
- if (!string.IsNullOrEmpty(Settings.Default.TextToSpeechVoice))
+ if (!string.IsNullOrEmpty(textToSpeechVoice))
{
try
{
- this.speech.SelectVoice(Settings.Default.TextToSpeechVoice);
+ this.speech.SelectVoice(textToSpeechVoice);
}
catch (Exception ex)
{
diff --git a/OpenSky.AgentMSFS/Tools/ColorExtensions.cs b/OpenSky.Agent.Simulator/Tools/ColorExtensions.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Tools/ColorExtensions.cs
rename to OpenSky.Agent.Simulator/Tools/ColorExtensions.cs
index 6b423f5..03ae41d 100644
--- a/OpenSky.AgentMSFS/Tools/ColorExtensions.cs
+++ b/OpenSky.Agent.Simulator/Tools/ColorExtensions.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Tools
+namespace OpenSky.Agent.Simulator.Tools
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Tools/SleepScheduler.cs b/OpenSky.Agent.Simulator/Tools/SleepScheduler.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Tools/SleepScheduler.cs
rename to OpenSky.Agent.Simulator/Tools/SleepScheduler.cs
index 40db220..264048f 100644
--- a/OpenSky.AgentMSFS/Tools/SleepScheduler.cs
+++ b/OpenSky.Agent.Simulator/Tools/SleepScheduler.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Tools
+namespace OpenSky.Agent.Simulator.Tools
{
using System;
using System.Threading;
diff --git a/OpenSky.AgentMSFS/Tools/StringEnumExtension.cs b/OpenSky.Agent.Simulator/Tools/StringEnumExtension.cs
similarity index 96%
rename from OpenSky.AgentMSFS/Tools/StringEnumExtension.cs
rename to OpenSky.Agent.Simulator/Tools/StringEnumExtension.cs
index 2103b30..10b8174 100644
--- a/OpenSky.AgentMSFS/Tools/StringEnumExtension.cs
+++ b/OpenSky.Agent.Simulator/Tools/StringEnumExtension.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Tools
+namespace OpenSky.Agent.Simulator.Tools
{
using System;
diff --git a/OpenSky.Agent.Simulator/Tools/StringValueAttribute.cs b/OpenSky.Agent.Simulator/Tools/StringValueAttribute.cs
new file mode 100644
index 0000000..eedbf3e
--- /dev/null
+++ b/OpenSky.Agent.Simulator/Tools/StringValueAttribute.cs
@@ -0,0 +1,52 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace OpenSky.Agent.Simulator.Tools
+{
+ using System;
+
+ using JetBrains.Annotations;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// This attribute is used to represent a string value for a value in an enum.
+ ///
+ ///
+ /// sushi.at, 19/03/2021.
+ ///
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ [AttributeUsage(AttributeTargets.Field)]
+ public class StringValueAttribute : Attribute
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// sushi.at, 19/03/2021.
+ ///
+ ///
+ /// The string value to store.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public StringValueAttribute([NotNull] string value)
+ {
+ this.StringValue = value;
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets gets the string value.
+ ///
+ ///
+ /// The string value.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ [NotNull]
+ public string StringValue { get; protected set; }
+ }
+}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/Tools/UpdateGUIDelegate.cs b/OpenSky.Agent.Simulator/Tools/UpdateGUIDelegate.cs
similarity index 91%
rename from OpenSky.AgentMSFS/Tools/UpdateGUIDelegate.cs
rename to OpenSky.Agent.Simulator/Tools/UpdateGUIDelegate.cs
index f0feda5..3972cca 100644
--- a/OpenSky.AgentMSFS/Tools/UpdateGUIDelegate.cs
+++ b/OpenSky.Agent.Simulator/Tools/UpdateGUIDelegate.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Tools
+namespace OpenSky.Agent.Simulator.Tools
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.Agent.Simulator/packages.config b/OpenSky.Agent.Simulator/packages.config
new file mode 100644
index 0000000..5069735
--- /dev/null
+++ b/OpenSky.Agent.Simulator/packages.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS.sln b/OpenSky.Agent.sln
similarity index 56%
rename from OpenSky.AgentMSFS.sln
rename to OpenSky.Agent.sln
index b3ddceb..b5297e4 100644
--- a/OpenSky.AgentMSFS.sln
+++ b/OpenSky.Agent.sln
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31025.194
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSky.AgentMSFS", "OpenSky.AgentMSFS\OpenSky.AgentMSFS.csproj", "{26FAA45D-B4A3-4228-8AF3-E5811BCFC765}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSky.Agent", "OpenSky.Agent\OpenSky.Agent.csproj", "{26FAA45D-B4A3-4228-8AF3-E5811BCFC765}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3E7B79A5-C09B-488A-9C72-2E80F02C902B}"
ProjectSection(SolutionItems) = preProject
@@ -13,6 +13,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Installer", "Installer\Installer.wixproj", "{853790E9-5CAA-4EBC-B4C3-C563C3242F1D}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSky.Agent.SimConnectMSFS", "OpenSky.Agent.SimConnectMSFS\OpenSky.Agent.SimConnectMSFS.csproj", "{1F9CBEDE-669D-4510-BCA2-E6AD29D6A498}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSky.Agent.Simulator", "OpenSky.Agent.Simulator\OpenSky.Agent.Simulator.csproj", "{30C467E8-2EEE-41E5-BE01-0142A61BA171}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -35,6 +39,22 @@ Global
{853790E9-5CAA-4EBC-B4C3-C563C3242F1D}.Release|Any CPU.ActiveCfg = Release|x86
{853790E9-5CAA-4EBC-B4C3-C563C3242F1D}.Release|x86.ActiveCfg = Release|x86
{853790E9-5CAA-4EBC-B4C3-C563C3242F1D}.Release|x86.Build.0 = Release|x86
+ {1F9CBEDE-669D-4510-BCA2-E6AD29D6A498}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F9CBEDE-669D-4510-BCA2-E6AD29D6A498}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F9CBEDE-669D-4510-BCA2-E6AD29D6A498}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {1F9CBEDE-669D-4510-BCA2-E6AD29D6A498}.Debug|x86.Build.0 = Debug|Any CPU
+ {1F9CBEDE-669D-4510-BCA2-E6AD29D6A498}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F9CBEDE-669D-4510-BCA2-E6AD29D6A498}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F9CBEDE-669D-4510-BCA2-E6AD29D6A498}.Release|x86.ActiveCfg = Release|Any CPU
+ {1F9CBEDE-669D-4510-BCA2-E6AD29D6A498}.Release|x86.Build.0 = Release|Any CPU
+ {30C467E8-2EEE-41E5-BE01-0142A61BA171}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {30C467E8-2EEE-41E5-BE01-0142A61BA171}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {30C467E8-2EEE-41E5-BE01-0142A61BA171}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {30C467E8-2EEE-41E5-BE01-0142A61BA171}.Debug|x86.Build.0 = Debug|Any CPU
+ {30C467E8-2EEE-41E5-BE01-0142A61BA171}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {30C467E8-2EEE-41E5-BE01-0142A61BA171}.Release|Any CPU.Build.0 = Release|Any CPU
+ {30C467E8-2EEE-41E5-BE01-0142A61BA171}.Release|x86.ActiveCfg = Release|Any CPU
+ {30C467E8-2EEE-41E5-BE01-0142A61BA171}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/OpenSky.AgentMSFS.sln.DotSettings b/OpenSky.Agent.sln.DotSettings
similarity index 99%
rename from OpenSky.AgentMSFS.sln.DotSettings
rename to OpenSky.Agent.sln.DotSettings
index 85d00e8..fee4d16 100644
--- a/OpenSky.AgentMSFS.sln.DotSettings
+++ b/OpenSky.Agent.sln.DotSettings
@@ -493,6 +493,7 @@ OpenSky project $CURRENT_YEAR$
JQL
LDAP
MD
+ MSFS
MT
NTLM
OFP
@@ -591,6 +592,7 @@ OpenSky project $CURRENT_YEAR$
True
True
True
+ True
True
True
True
diff --git a/OpenSky.AgentMSFS/App.config.debug b/OpenSky.Agent/App.config.debug
similarity index 72%
rename from OpenSky.AgentMSFS/App.config.debug
rename to OpenSky.Agent/App.config.debug
index 476f5ac..05f35e9 100644
--- a/OpenSky.AgentMSFS/App.config.debug
+++ b/OpenSky.Agent/App.config.debug
@@ -2,17 +2,17 @@
-
+
-
+
-
+
True
@@ -46,10 +46,13 @@
-
+
+ SimConnectMSFS
+
+
-
+
http://localhost:5001/apptoken/0932018B-FB9C-4B59-B898-C4244EAC6D0B
@@ -57,11 +60,11 @@
http://localhost:5000
- https://api.github.com/repos/opensky-to/agent-msfs/releases/latest
+ https://api.github.com/repos/opensky-to/agent/releases/latest
http://localhost:5001/changepassword
-
+
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/App.config.release b/OpenSky.Agent/App.config.release
similarity index 72%
rename from OpenSky.AgentMSFS/App.config.release
rename to OpenSky.Agent/App.config.release
index a491e95..56aa0f9 100644
--- a/OpenSky.AgentMSFS/App.config.release
+++ b/OpenSky.Agent/App.config.release
@@ -2,17 +2,17 @@
-
+
-
+
-
+
True
@@ -46,10 +46,13 @@
-
+
+ SimConnectMSFS
+
+
-
+
https://www.opensky.to/apptoken/755CC379-E8FE-43C5-B75F-6CD09772D7A7
@@ -57,11 +60,11 @@
https://api.opensky.to
- https://api.github.com/repos/opensky-to/agent-msfs/releases/latest
+ https://api.github.com/repos/opensky-to/agent/releases/latest
https://www.opensky.to/changepassword
-
+
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/App.xaml b/OpenSky.Agent/App.xaml
similarity index 93%
rename from OpenSky.AgentMSFS/App.xaml
rename to OpenSky.Agent/App.xaml
index 1d77526..f65c113 100644
--- a/OpenSky.AgentMSFS/App.xaml
+++ b/OpenSky.Agent/App.xaml
@@ -1,15 +1,15 @@
-
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS
+namespace OpenSky.Agent
{
using System;
using System.ComponentModel;
@@ -17,9 +17,15 @@ namespace OpenSky.AgentMSFS
using JetBrains.Annotations;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.Properties;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Properties;
+ using OpenSky.Agent.SimConnectMSFS;
+ using OpenSky.Agent.Simulator;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Models;
+ using OpenSky.Agent.Simulator.Tools;
+ using OpenSky.Agent.Tools;
+
+ using OpenSkyApi;
using Syncfusion.SfSkinManager;
@@ -38,7 +44,7 @@ public partial class App
///
/// -------------------------------------------------------------------------------------------------
[NotNull]
- private static readonly Mutex Mutex = new(false, "OpenSky.AgentMSFS.SingleInstance." + Environment.UserName);
+ private static readonly Mutex Mutex = new(false, "OpenSky.Agent.SingleInstance." + Environment.UserName);
/// -------------------------------------------------------------------------------------------------
///
@@ -121,9 +127,9 @@ protected override void OnStartup([NotNull] StartupEventArgs e)
var updatedToken = false;
foreach (var arg in e.Args)
{
- if (arg.StartsWith("opensky-agent-msfs://") || arg.StartsWith("opensky-agent-msfs-debug://"))
+ if (arg.StartsWith("opensky-agent://") || arg.StartsWith("opensky-agent-debug://"))
{
- var appTokenUri = arg.Replace("opensky-agent-msfs://", string.Empty).Replace("opensky-agent-msfs-debug://", string.Empty).TrimEnd('/');
+ var appTokenUri = arg.Replace("opensky-agent://", string.Empty).Replace("opensky-agent-debug://", string.Empty).TrimEnd('/');
var parameters = appTokenUri.Split('&');
string token = null;
@@ -191,14 +197,14 @@ protected override void OnStartup([NotNull] StartupEventArgs e)
{
if (!updatedToken)
{
- ModernWpf.MessageBox.Show("The OpenSky agent for Flight Simulator 2020 is already running.", "OpenSky", MessageBoxButton.OK, MessageBoxImage.Warning);
+ ModernWpf.MessageBox.Show("The OpenSky flight tracking agent is already running.", "OpenSky", MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
// We updated the token in the settings, before we exit let the running instance now about this
var client = new XDMessagingClient();
var broadcaster = client.Broadcasters.GetBroadcasterForMode(XDTransportMode.Compatibility);
- broadcaster.SendToChannel("OPENSKY-AGENT-MSFS", "TokensUpdated");
+ broadcaster.SendToChannel("OPENSKY-AGENT", "TokensUpdated");
}
Environment.Exit(1);
@@ -223,18 +229,40 @@ protected override void OnStartup([NotNull] StartupEventArgs e)
Directory.CreateDirectory(openSkyFolder);
}
- var logFilePath = Environment.ExpandEnvironmentVariables("%localappdata%\\OpenSky\\agent_msfs_debug.log");
+ var logFilePath = Environment.ExpandEnvironmentVariables("%localappdata%\\OpenSky\\agent_debug.log");
var traceListener = new DateTimeTextWriterTraceListener(File.Open(logFilePath, FileMode.Append, FileAccess.Write));
Debug.AutoFlush = true;
Debug.Listeners.Add(traceListener);
#endif
Debug.WriteLine("========================================================================================");
- Debug.WriteLine($"OPENSKY AGENT FOR MSFS {Assembly.GetExecutingAssembly().GetName().Version.ToString(4)} STARTING UP");
+ Debug.WriteLine($"OPENSKY AGENT {Assembly.GetExecutingAssembly().GetName().Version.ToString(4)} STARTING UP");
Debug.WriteLine("========================================================================================");
// Unexpected error handler
this.DispatcherUnhandledException += AppDispatcherUnhandledException;
+ // Initialize speech sound pack manager
+ SpeechSoundPacks.InitializeSpeechSoundPacks(Settings.Default.SoundPack, Settings.Default.TextToSpeechVoice);
+
+ // Initialize selected simulator interface
+ var simulatorInterface = Settings.Default.SimulatorInterface;
+ if (SimConnect.SimulatorInterfaceName.Equals(simulatorInterface, StringComparison.InvariantCultureIgnoreCase))
+ {
+ Simulator.Simulator.SetSimulatorInstance(new SimConnect(Settings.Default.SimConnectHostName, Settings.Default.SimConnectPort, AgentOpenSkyService.Instance));
+ }
+
+ if (Simulator.Simulator.Instance != null)
+ {
+ Simulator.Simulator.Instance.LandingReported += (_, landingReportNotification) =>
+ {
+ if (landingReportNotification.Equals(LandingReportNotification.Parse(Settings.Default.LandingReportNotification)))
+ {
+ UpdateGUIDelegate showNotification = () => new Views.LandingReport().Show();
+ Current.Dispatcher.BeginInvoke(showNotification);
+ }
+ };
+ }
+
// Continue startup
base.OnStartup(e);
}
@@ -258,7 +286,7 @@ private static void AppDispatcherUnhandledException(
[NotNull] DispatcherUnhandledExceptionEventArgs e)
{
var crashReport = "==============================================================================\r\n";
- crashReport += " OPENSKY AGENT-MSFS CRASH REPORT\r\n";
+ crashReport += " OPENSKY AGENT CRASH REPORT\r\n";
crashReport += " " + DateTime.Now + "\r\n";
crashReport += "==============================================================================\r\n";
crashReport += e.Exception + "\r\n";
@@ -266,13 +294,13 @@ private static void AppDispatcherUnhandledException(
crashReport += "\r\n\r\n";
Debug.WriteLine(crashReport);
- var filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\OpenSky.AgentMSFS.Crash.txt";
+ var filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\OpenSky.Agent.Crash.txt";
try
{
File.AppendAllText(filePath, crashReport);
ModernWpf.MessageBox.Show(
- e.Exception.Message + "\r\n\r\nPlease check OpenSky.AgentMSFS.Crash.txt for details!",
+ e.Exception.Message + "\r\n\r\nPlease check OpenSky.Agent.Crash.txt for details!",
"Unexpected error!",
MessageBoxButton.OK,
MessageBoxImage.Error);
@@ -296,7 +324,7 @@ private static void AppDispatcherUnhandledException(
private void PerformShutdown()
{
// Check if we are currently tracking a flight
- if (SimConnect.SimConnect.Instance.TrackingStatus is TrackingStatus.GroundOperations or TrackingStatus.Tracking)
+ if (Agent.Simulator.Simulator.Instance.TrackingStatus is TrackingStatus.GroundOperations or TrackingStatus.Tracking)
{
Debug.WriteLine("User requested shutdown, but flight tracking is still in progress...");
MessageBoxResult? answer = MessageBoxResult.None;
diff --git a/OpenSky.AgentMSFS/Controls/FuelTankControl.xaml b/OpenSky.Agent/Controls/FuelTankControl.xaml
similarity index 96%
rename from OpenSky.AgentMSFS/Controls/FuelTankControl.xaml
rename to OpenSky.Agent/Controls/FuelTankControl.xaml
index e4583c9..b4a6db0 100644
--- a/OpenSky.AgentMSFS/Controls/FuelTankControl.xaml
+++ b/OpenSky.Agent/Controls/FuelTankControl.xaml
@@ -1,7 +1,7 @@
-
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Controls
+namespace OpenSky.Agent.Controls
{
using System.ComponentModel;
using System.Windows;
diff --git a/OpenSky.AgentMSFS/Controls/Models/ErrorDetails.cs b/OpenSky.Agent/Controls/Models/ErrorDetails.cs
similarity index 95%
rename from OpenSky.AgentMSFS/Controls/Models/ErrorDetails.cs
rename to OpenSky.Agent/Controls/Models/ErrorDetails.cs
index 3c9de38..76069f7 100644
--- a/OpenSky.AgentMSFS/Controls/Models/ErrorDetails.cs
+++ b/OpenSky.Agent/Controls/Models/ErrorDetails.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Controls.Models
+namespace OpenSky.Agent.Controls.Models
{
using System;
diff --git a/OpenSky.AgentMSFS/Controls/Models/ExtendedMessageBoxImage.cs b/OpenSky.Agent/Controls/Models/ExtendedMessageBoxImage.cs
similarity index 96%
rename from OpenSky.AgentMSFS/Controls/Models/ExtendedMessageBoxImage.cs
rename to OpenSky.Agent/Controls/Models/ExtendedMessageBoxImage.cs
index 57a2209..2226ef8 100644
--- a/OpenSky.AgentMSFS/Controls/Models/ExtendedMessageBoxImage.cs
+++ b/OpenSky.Agent/Controls/Models/ExtendedMessageBoxImage.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Controls.Models
+namespace OpenSky.Agent.Controls.Models
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Controls/Models/ExtendedMessageBoxResult.cs b/OpenSky.Agent/Controls/Models/ExtendedMessageBoxResult.cs
similarity index 92%
rename from OpenSky.AgentMSFS/Controls/Models/ExtendedMessageBoxResult.cs
rename to OpenSky.Agent/Controls/Models/ExtendedMessageBoxResult.cs
index cc7656e..d024437 100644
--- a/OpenSky.AgentMSFS/Controls/Models/ExtendedMessageBoxResult.cs
+++ b/OpenSky.Agent/Controls/Models/ExtendedMessageBoxResult.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Controls.Models
+namespace OpenSky.Agent.Controls.Models
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Controls/OpenSkyMessageBox.xaml b/OpenSky.Agent/Controls/OpenSkyMessageBox.xaml
similarity index 96%
rename from OpenSky.AgentMSFS/Controls/OpenSkyMessageBox.xaml
rename to OpenSky.Agent/Controls/OpenSkyMessageBox.xaml
index a7fede7..e90b131 100644
--- a/OpenSky.AgentMSFS/Controls/OpenSkyMessageBox.xaml
+++ b/OpenSky.Agent/Controls/OpenSkyMessageBox.xaml
@@ -1,7 +1,7 @@
-
diff --git a/OpenSky.AgentMSFS/Controls/OpenSkyMessageBox.xaml.cs b/OpenSky.Agent/Controls/OpenSkyMessageBox.xaml.cs
similarity index 99%
rename from OpenSky.AgentMSFS/Controls/OpenSkyMessageBox.xaml.cs
rename to OpenSky.Agent/Controls/OpenSkyMessageBox.xaml.cs
index 96724be..9f08b40 100644
--- a/OpenSky.AgentMSFS/Controls/OpenSkyMessageBox.xaml.cs
+++ b/OpenSky.Agent/Controls/OpenSkyMessageBox.xaml.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Controls
+namespace OpenSky.Agent.Controls
{
using System;
using System.Media;
@@ -13,8 +13,8 @@ namespace OpenSky.AgentMSFS.Controls
using System.Windows.Input;
using System.Windows.Media;
- using OpenSky.AgentMSFS.Controls.Models;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Controls.Models;
+ using OpenSky.Agent.Simulator.Tools;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Controls/OpenSkyNotification.xaml b/OpenSky.Agent/Controls/OpenSkyNotification.xaml
similarity index 95%
rename from OpenSky.AgentMSFS/Controls/OpenSkyNotification.xaml
rename to OpenSky.Agent/Controls/OpenSkyNotification.xaml
index d1c3358..5caf29d 100644
--- a/OpenSky.AgentMSFS/Controls/OpenSkyNotification.xaml
+++ b/OpenSky.Agent/Controls/OpenSkyNotification.xaml
@@ -1,7 +1,7 @@
-
diff --git a/OpenSky.AgentMSFS/Controls/OpenSkyNotification.xaml.cs b/OpenSky.Agent/Controls/OpenSkyNotification.xaml.cs
similarity index 99%
rename from OpenSky.AgentMSFS/Controls/OpenSkyNotification.xaml.cs
rename to OpenSky.Agent/Controls/OpenSkyNotification.xaml.cs
index bb20e42..f21caf2 100644
--- a/OpenSky.AgentMSFS/Controls/OpenSkyNotification.xaml.cs
+++ b/OpenSky.Agent/Controls/OpenSkyNotification.xaml.cs
@@ -1,18 +1,18 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Controls
+namespace OpenSky.Agent.Controls
{
using System;
using System.Threading;
using System.Windows;
using System.Windows.Media;
- using OpenSky.AgentMSFS.Controls.Models;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Controls.Models;
+ using OpenSky.Agent.Simulator.Tools;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Controls/OpenSkyWindow.cs b/OpenSky.Agent/Controls/OpenSkyWindow.cs
similarity index 99%
rename from OpenSky.AgentMSFS/Controls/OpenSkyWindow.cs
rename to OpenSky.Agent/Controls/OpenSkyWindow.cs
index f4ecfe0..01ffc99 100644
--- a/OpenSky.AgentMSFS/Controls/OpenSkyWindow.cs
+++ b/OpenSky.Agent/Controls/OpenSkyWindow.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Controls
+namespace OpenSky.Agent.Controls
{
using System;
using System.Collections.Concurrent;
@@ -19,8 +19,8 @@ namespace OpenSky.AgentMSFS.Controls
using System.Windows.Interop;
using System.Windows.Shapes;
- using OpenSky.AgentMSFS.Controls.Models;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Controls.Models;
+ using OpenSky.Agent.Simulator.Tools;
using Button = System.Windows.Controls.Button;
using Cursors = System.Windows.Input.Cursors;
diff --git a/OpenSky.AgentMSFS/Controls/PayloadStationControl.xaml b/OpenSky.Agent/Controls/PayloadStationControl.xaml
similarity index 94%
rename from OpenSky.AgentMSFS/Controls/PayloadStationControl.xaml
rename to OpenSky.Agent/Controls/PayloadStationControl.xaml
index ab39e9e..f95d16e 100644
--- a/OpenSky.AgentMSFS/Controls/PayloadStationControl.xaml
+++ b/OpenSky.Agent/Controls/PayloadStationControl.xaml
@@ -1,7 +1,7 @@
-
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Controls
+namespace OpenSky.Agent.Controls
{
using System.ComponentModel;
using System.Windows;
diff --git a/OpenSky.AgentMSFS/Controls/ScrollingListBox.cs b/OpenSky.Agent/Controls/ScrollingListBox.cs
similarity index 89%
rename from OpenSky.AgentMSFS/Controls/ScrollingListBox.cs
rename to OpenSky.Agent/Controls/ScrollingListBox.cs
index fd49593..3ba2374 100644
--- a/OpenSky.AgentMSFS/Controls/ScrollingListBox.cs
+++ b/OpenSky.Agent/Controls/ScrollingListBox.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Controls
+namespace OpenSky.Agent.Controls
{
using System.Collections.Specialized;
using System.Windows.Controls;
@@ -56,7 +56,14 @@ protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
{
if (e.NewItems?.Count > 0)
{
- this.ScrollIntoView(e.NewItems[e.NewItems.Count - 1]);
+ try
+ {
+ this.ScrollIntoView(e.NewItems[e.NewItems.Count - 1]);
+ }
+ catch
+ {
+ // Ignore
+ }
}
base.OnItemsChanged(e);
diff --git a/OpenSky.AgentMSFS/Converters/AircraftTypeEngineInfoConverter.cs b/OpenSky.Agent/Converters/AircraftTypeEngineInfoConverter.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Converters/AircraftTypeEngineInfoConverter.cs
rename to OpenSky.Agent/Converters/AircraftTypeEngineInfoConverter.cs
index 6423748..b1b8de7 100644
--- a/OpenSky.AgentMSFS/Converters/AircraftTypeEngineInfoConverter.cs
+++ b/OpenSky.Agent/Converters/AircraftTypeEngineInfoConverter.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
diff --git a/OpenSky.AgentMSFS/Converters/AircraftTypeForeignKeyConverter.cs b/OpenSky.Agent/Converters/AircraftTypeForeignKeyConverter.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Converters/AircraftTypeForeignKeyConverter.cs
rename to OpenSky.Agent/Converters/AircraftTypeForeignKeyConverter.cs
index 768d87b..b2f27c4 100644
--- a/OpenSky.AgentMSFS/Converters/AircraftTypeForeignKeyConverter.cs
+++ b/OpenSky.Agent/Converters/AircraftTypeForeignKeyConverter.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Collections.ObjectModel;
diff --git a/OpenSky.AgentMSFS/Converters/BooleanVisibilityConverter.cs b/OpenSky.Agent/Converters/BooleanVisibilityConverter.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Converters/BooleanVisibilityConverter.cs
rename to OpenSky.Agent/Converters/BooleanVisibilityConverter.cs
index 9058159..1d8e0ba 100644
--- a/OpenSky.AgentMSFS/Converters/BooleanVisibilityConverter.cs
+++ b/OpenSky.Agent/Converters/BooleanVisibilityConverter.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
diff --git a/OpenSky.AgentMSFS/Converters/CanSetWeightAndBalancesConverter.cs b/OpenSky.Agent/Converters/CanSetWeightAndBalancesConverter.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Converters/CanSetWeightAndBalancesConverter.cs
rename to OpenSky.Agent/Converters/CanSetWeightAndBalancesConverter.cs
index 5d1ca81..931798c 100644
--- a/OpenSky.AgentMSFS/Converters/CanSetWeightAndBalancesConverter.cs
+++ b/OpenSky.Agent/Converters/CanSetWeightAndBalancesConverter.cs
@@ -1,16 +1,16 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
using System.Windows.Data;
- using OpenSky.AgentMSFS.Models;
+ using OpenSky.Agent.Simulator.Enums;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Converters/CgColorConverter.cs b/OpenSky.Agent/Converters/CgColorConverter.cs
similarity index 96%
rename from OpenSky.AgentMSFS/Converters/CgColorConverter.cs
rename to OpenSky.Agent/Converters/CgColorConverter.cs
index e0b69e0..9e6ec57 100644
--- a/OpenSky.AgentMSFS/Converters/CgColorConverter.cs
+++ b/OpenSky.Agent/Converters/CgColorConverter.cs
@@ -1,17 +1,18 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
- using OpenSky.AgentMSFS.SimConnect.Structs;
+ using OpenSky.Agent.Simulator;
+ using OpenSky.Agent.Simulator.Models;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Converters/CgLateralColorConverter.cs b/OpenSky.Agent/Converters/CgLateralColorConverter.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Converters/CgLateralColorConverter.cs
rename to OpenSky.Agent/Converters/CgLateralColorConverter.cs
index 64da99f..a2be1c4 100644
--- a/OpenSky.AgentMSFS/Converters/CgLateralColorConverter.cs
+++ b/OpenSky.Agent/Converters/CgLateralColorConverter.cs
@@ -1,16 +1,18 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
+ using OpenSky.Agent.Simulator;
+
/// -------------------------------------------------------------------------------------------------
///
/// Center of gravity lateral to color converter (green within limits, red outside the limits)
diff --git a/OpenSky.AgentMSFS/Converters/FuelTankCapacityVisibilityConverter.cs b/OpenSky.Agent/Converters/FuelTankCapacityVisibilityConverter.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Converters/FuelTankCapacityVisibilityConverter.cs
rename to OpenSky.Agent/Converters/FuelTankCapacityVisibilityConverter.cs
index d220218..392df07 100644
--- a/OpenSky.AgentMSFS/Converters/FuelTankCapacityVisibilityConverter.cs
+++ b/OpenSky.Agent/Converters/FuelTankCapacityVisibilityConverter.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
diff --git a/OpenSky.AgentMSFS/Converters/InvertedBooleanVisibilityConverter.cs b/OpenSky.Agent/Converters/InvertedBooleanVisibilityConverter.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Converters/InvertedBooleanVisibilityConverter.cs
rename to OpenSky.Agent/Converters/InvertedBooleanVisibilityConverter.cs
index 9a5014a..c4acef2 100644
--- a/OpenSky.AgentMSFS/Converters/InvertedBooleanVisibilityConverter.cs
+++ b/OpenSky.Agent/Converters/InvertedBooleanVisibilityConverter.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
diff --git a/OpenSky.AgentMSFS/Converters/IsPausedButtonConverter.cs b/OpenSky.Agent/Converters/IsPausedButtonConverter.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Converters/IsPausedButtonConverter.cs
rename to OpenSky.Agent/Converters/IsPausedButtonConverter.cs
index 475c906..95964b2 100644
--- a/OpenSky.AgentMSFS/Converters/IsPausedButtonConverter.cs
+++ b/OpenSky.Agent/Converters/IsPausedButtonConverter.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
diff --git a/OpenSky.AgentMSFS/Converters/MapZoomLevelFontSizeConverter.cs b/OpenSky.Agent/Converters/MapZoomLevelFontSizeConverter.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Converters/MapZoomLevelFontSizeConverter.cs
rename to OpenSky.Agent/Converters/MapZoomLevelFontSizeConverter.cs
index cf20f76..784c9e3 100644
--- a/OpenSky.AgentMSFS/Converters/MapZoomLevelFontSizeConverter.cs
+++ b/OpenSky.Agent/Converters/MapZoomLevelFontSizeConverter.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
diff --git a/OpenSky.AgentMSFS/Converters/MapZoomLevelVisibilityConverter.cs b/OpenSky.Agent/Converters/MapZoomLevelVisibilityConverter.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Converters/MapZoomLevelVisibilityConverter.cs
rename to OpenSky.Agent/Converters/MapZoomLevelVisibilityConverter.cs
index 90b8bae..e23be87 100644
--- a/OpenSky.AgentMSFS/Converters/MapZoomLevelVisibilityConverter.cs
+++ b/OpenSky.Agent/Converters/MapZoomLevelVisibilityConverter.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
diff --git a/OpenSky.AgentMSFS/Converters/NullItemToVisibilityConverter.cs b/OpenSky.Agent/Converters/NullItemToVisibilityConverter.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Converters/NullItemToVisibilityConverter.cs
rename to OpenSky.Agent/Converters/NullItemToVisibilityConverter.cs
index 4d0848d..9e92e9b 100644
--- a/OpenSky.AgentMSFS/Converters/NullItemToVisibilityConverter.cs
+++ b/OpenSky.Agent/Converters/NullItemToVisibilityConverter.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
diff --git a/OpenSky.AgentMSFS/Converters/PayloadStationsVisibilityConverter.cs b/OpenSky.Agent/Converters/PayloadStationsVisibilityConverter.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Converters/PayloadStationsVisibilityConverter.cs
rename to OpenSky.Agent/Converters/PayloadStationsVisibilityConverter.cs
index 7fec418..cb03871 100644
--- a/OpenSky.AgentMSFS/Converters/PayloadStationsVisibilityConverter.cs
+++ b/OpenSky.Agent/Converters/PayloadStationsVisibilityConverter.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
diff --git a/OpenSky.AgentMSFS/Converters/PoundsKilogramsConverter.cs b/OpenSky.Agent/Converters/PoundsKilogramsConverter.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Converters/PoundsKilogramsConverter.cs
rename to OpenSky.Agent/Converters/PoundsKilogramsConverter.cs
index ae03cb1..26d920c 100644
--- a/OpenSky.AgentMSFS/Converters/PoundsKilogramsConverter.cs
+++ b/OpenSky.Agent/Converters/PoundsKilogramsConverter.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
diff --git a/OpenSky.AgentMSFS/Converters/WeightsColorConverter.cs b/OpenSky.Agent/Converters/WeightsColorConverter.cs
similarity index 96%
rename from OpenSky.AgentMSFS/Converters/WeightsColorConverter.cs
rename to OpenSky.Agent/Converters/WeightsColorConverter.cs
index 3119912..fe70d26 100644
--- a/OpenSky.AgentMSFS/Converters/WeightsColorConverter.cs
+++ b/OpenSky.Agent/Converters/WeightsColorConverter.cs
@@ -1,17 +1,18 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Converters
+namespace OpenSky.Agent.Converters
{
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
- using OpenSky.AgentMSFS.SimConnect.Structs;
+ using OpenSky.Agent.Simulator;
+ using OpenSky.Agent.Simulator.Models;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-Black.ttf b/OpenSky.Agent/Fonts/Montserrat-Black.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-Black.ttf
rename to OpenSky.Agent/Fonts/Montserrat-Black.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-BlackItalic.ttf b/OpenSky.Agent/Fonts/Montserrat-BlackItalic.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-BlackItalic.ttf
rename to OpenSky.Agent/Fonts/Montserrat-BlackItalic.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-Bold.ttf b/OpenSky.Agent/Fonts/Montserrat-Bold.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-Bold.ttf
rename to OpenSky.Agent/Fonts/Montserrat-Bold.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-BoldItalic.ttf b/OpenSky.Agent/Fonts/Montserrat-BoldItalic.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-BoldItalic.ttf
rename to OpenSky.Agent/Fonts/Montserrat-BoldItalic.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-ExtraBold.ttf b/OpenSky.Agent/Fonts/Montserrat-ExtraBold.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-ExtraBold.ttf
rename to OpenSky.Agent/Fonts/Montserrat-ExtraBold.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-ExtraBoldItalic.ttf b/OpenSky.Agent/Fonts/Montserrat-ExtraBoldItalic.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-ExtraBoldItalic.ttf
rename to OpenSky.Agent/Fonts/Montserrat-ExtraBoldItalic.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-ExtraLight.ttf b/OpenSky.Agent/Fonts/Montserrat-ExtraLight.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-ExtraLight.ttf
rename to OpenSky.Agent/Fonts/Montserrat-ExtraLight.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-ExtraLightItalic.ttf b/OpenSky.Agent/Fonts/Montserrat-ExtraLightItalic.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-ExtraLightItalic.ttf
rename to OpenSky.Agent/Fonts/Montserrat-ExtraLightItalic.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-Italic.ttf b/OpenSky.Agent/Fonts/Montserrat-Italic.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-Italic.ttf
rename to OpenSky.Agent/Fonts/Montserrat-Italic.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-Light.ttf b/OpenSky.Agent/Fonts/Montserrat-Light.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-Light.ttf
rename to OpenSky.Agent/Fonts/Montserrat-Light.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-LightItalic.ttf b/OpenSky.Agent/Fonts/Montserrat-LightItalic.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-LightItalic.ttf
rename to OpenSky.Agent/Fonts/Montserrat-LightItalic.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-Medium.ttf b/OpenSky.Agent/Fonts/Montserrat-Medium.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-Medium.ttf
rename to OpenSky.Agent/Fonts/Montserrat-Medium.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-MediumItalic.ttf b/OpenSky.Agent/Fonts/Montserrat-MediumItalic.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-MediumItalic.ttf
rename to OpenSky.Agent/Fonts/Montserrat-MediumItalic.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-Regular.ttf b/OpenSky.Agent/Fonts/Montserrat-Regular.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-Regular.ttf
rename to OpenSky.Agent/Fonts/Montserrat-Regular.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-SemiBold.ttf b/OpenSky.Agent/Fonts/Montserrat-SemiBold.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-SemiBold.ttf
rename to OpenSky.Agent/Fonts/Montserrat-SemiBold.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-SemiBoldItalic.ttf b/OpenSky.Agent/Fonts/Montserrat-SemiBoldItalic.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-SemiBoldItalic.ttf
rename to OpenSky.Agent/Fonts/Montserrat-SemiBoldItalic.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-Thin.ttf b/OpenSky.Agent/Fonts/Montserrat-Thin.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-Thin.ttf
rename to OpenSky.Agent/Fonts/Montserrat-Thin.ttf
diff --git a/OpenSky.AgentMSFS/Fonts/Montserrat-ThinItalic.ttf b/OpenSky.Agent/Fonts/Montserrat-ThinItalic.ttf
similarity index 100%
rename from OpenSky.AgentMSFS/Fonts/Montserrat-ThinItalic.ttf
rename to OpenSky.Agent/Fonts/Montserrat-ThinItalic.ttf
diff --git a/OpenSky.AgentMSFS/MVVM/AsynchronousCommand.cs b/OpenSky.Agent/MVVM/AsynchronousCommand.cs
similarity index 99%
rename from OpenSky.AgentMSFS/MVVM/AsynchronousCommand.cs
rename to OpenSky.Agent/MVVM/AsynchronousCommand.cs
index 9170cf4..1b44234 100644
--- a/OpenSky.AgentMSFS/MVVM/AsynchronousCommand.cs
+++ b/OpenSky.Agent/MVVM/AsynchronousCommand.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.MVVM
+namespace OpenSky.Agent.MVVM
{
using System;
using System.ComponentModel;
diff --git a/OpenSky.AgentMSFS/MVVM/CancelCommandEventArgs.cs b/OpenSky.Agent/MVVM/CancelCommandEventArgs.cs
similarity index 91%
rename from OpenSky.AgentMSFS/MVVM/CancelCommandEventArgs.cs
rename to OpenSky.Agent/MVVM/CancelCommandEventArgs.cs
index e42bad8..2adc20e 100644
--- a/OpenSky.AgentMSFS/MVVM/CancelCommandEventArgs.cs
+++ b/OpenSky.Agent/MVVM/CancelCommandEventArgs.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.MVVM
+namespace OpenSky.Agent.MVVM
{
/// -------------------------------------------------------------------------------------------------
///
@@ -13,7 +13,7 @@ namespace OpenSky.AgentMSFS.MVVM
///
/// sushi.at, 11/03/2021.
///
- ///
+ ///
/// -------------------------------------------------------------------------------------------------
public class CancelCommandEventArgs : CommandEventArgs
{
diff --git a/OpenSky.AgentMSFS/MVVM/Command.cs b/OpenSky.Agent/MVVM/Command.cs
similarity index 99%
rename from OpenSky.AgentMSFS/MVVM/Command.cs
rename to OpenSky.Agent/MVVM/Command.cs
index d40130b..b0601cb 100644
--- a/OpenSky.AgentMSFS/MVVM/Command.cs
+++ b/OpenSky.Agent/MVVM/Command.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.MVVM
+namespace OpenSky.Agent.MVVM
{
using System;
using System.ComponentModel;
diff --git a/OpenSky.AgentMSFS/MVVM/CommandEventArgs.cs b/OpenSky.Agent/MVVM/CommandEventArgs.cs
similarity index 95%
rename from OpenSky.AgentMSFS/MVVM/CommandEventArgs.cs
rename to OpenSky.Agent/MVVM/CommandEventArgs.cs
index 29859f3..1e47014 100644
--- a/OpenSky.AgentMSFS/MVVM/CommandEventArgs.cs
+++ b/OpenSky.Agent/MVVM/CommandEventArgs.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.MVVM
+namespace OpenSky.Agent.MVVM
{
using System;
diff --git a/OpenSky.AgentMSFS/MVVM/NotifyingProperty.cs b/OpenSky.Agent/MVVM/NotifyingProperty.cs
similarity index 98%
rename from OpenSky.AgentMSFS/MVVM/NotifyingProperty.cs
rename to OpenSky.Agent/MVVM/NotifyingProperty.cs
index 29c9b25..d17946e 100644
--- a/OpenSky.AgentMSFS/MVVM/NotifyingProperty.cs
+++ b/OpenSky.Agent/MVVM/NotifyingProperty.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.MVVM
+namespace OpenSky.Agent.MVVM
{
using System;
diff --git a/OpenSky.AgentMSFS/MVVM/ViewModel.cs b/OpenSky.Agent/MVVM/ViewModel.cs
similarity index 99%
rename from OpenSky.AgentMSFS/MVVM/ViewModel.cs
rename to OpenSky.Agent/MVVM/ViewModel.cs
index 0eb299e..b6825fe 100644
--- a/OpenSky.AgentMSFS/MVVM/ViewModel.cs
+++ b/OpenSky.Agent/MVVM/ViewModel.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.MVVM
+namespace OpenSky.Agent.MVVM
{
using System;
using System.Collections;
@@ -18,7 +18,7 @@ namespace OpenSky.AgentMSFS.MVVM
using JetBrains.Annotations;
- using OpenSky.AgentMSFS.Controls;
+ using OpenSky.Agent.Controls;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Native/Mouse.cs b/OpenSky.Agent/Native/Mouse.cs
similarity index 92%
rename from OpenSky.AgentMSFS/Native/Mouse.cs
rename to OpenSky.Agent/Native/Mouse.cs
index 4bfb0d6..a27c13e 100644
--- a/OpenSky.AgentMSFS/Native/Mouse.cs
+++ b/OpenSky.Agent/Native/Mouse.cs
@@ -1,17 +1,17 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Native
+namespace OpenSky.Agent.Native
{
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
- using OpenSky.AgentMSFS.Native.PInvoke;
- using OpenSky.AgentMSFS.Native.PInvoke.Structs;
+ using OpenSky.Agent.Native.PInvoke;
+ using OpenSky.Agent.Native.PInvoke.Structs;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Native/PInvoke/Enums/ABE.cs b/OpenSky.Agent/Native/PInvoke/Enums/ABE.cs
similarity index 93%
rename from OpenSky.AgentMSFS/Native/PInvoke/Enums/ABE.cs
rename to OpenSky.Agent/Native/PInvoke/Enums/ABE.cs
index d219588..659d480 100644
--- a/OpenSky.AgentMSFS/Native/PInvoke/Enums/ABE.cs
+++ b/OpenSky.Agent/Native/PInvoke/Enums/ABE.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Native.PInvoke.Enums
+namespace OpenSky.Agent.Native.PInvoke.Enums
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Native/PInvoke/Enums/ABM.cs b/OpenSky.Agent/Native/PInvoke/Enums/ABM.cs
similarity index 96%
rename from OpenSky.AgentMSFS/Native/PInvoke/Enums/ABM.cs
rename to OpenSky.Agent/Native/PInvoke/Enums/ABM.cs
index fc7e588..ecb4fcb 100644
--- a/OpenSky.AgentMSFS/Native/PInvoke/Enums/ABM.cs
+++ b/OpenSky.Agent/Native/PInvoke/Enums/ABM.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Native.PInvoke.Enums
+namespace OpenSky.Agent.Native.PInvoke.Enums
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Native/PInvoke/Enums/ABS.cs b/OpenSky.Agent/Native/PInvoke/Enums/ABS.cs
similarity index 92%
rename from OpenSky.AgentMSFS/Native/PInvoke/Enums/ABS.cs
rename to OpenSky.Agent/Native/PInvoke/Enums/ABS.cs
index b967064..674c80e 100644
--- a/OpenSky.AgentMSFS/Native/PInvoke/Enums/ABS.cs
+++ b/OpenSky.Agent/Native/PInvoke/Enums/ABS.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Native.PInvoke.Enums
+namespace OpenSky.Agent.Native.PInvoke.Enums
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Native/PInvoke/Enums/TaskbarPosition.cs b/OpenSky.Agent/Native/PInvoke/Enums/TaskbarPosition.cs
similarity index 94%
rename from OpenSky.AgentMSFS/Native/PInvoke/Enums/TaskbarPosition.cs
rename to OpenSky.Agent/Native/PInvoke/Enums/TaskbarPosition.cs
index b47efa9..d48fab4 100644
--- a/OpenSky.AgentMSFS/Native/PInvoke/Enums/TaskbarPosition.cs
+++ b/OpenSky.Agent/Native/PInvoke/Enums/TaskbarPosition.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Native.PInvoke.Enums
+namespace OpenSky.Agent.Native.PInvoke.Enums
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Native/PInvoke/Gdi32.cs b/OpenSky.Agent/Native/PInvoke/Gdi32.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Native/PInvoke/Gdi32.cs
rename to OpenSky.Agent/Native/PInvoke/Gdi32.cs
index 2cb2a0d..8a3ce91 100644
--- a/OpenSky.AgentMSFS/Native/PInvoke/Gdi32.cs
+++ b/OpenSky.Agent/Native/PInvoke/Gdi32.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Native.PInvoke
+namespace OpenSky.Agent.Native.PInvoke
{
using System;
using System.Runtime.InteropServices;
diff --git a/OpenSky.AgentMSFS/Native/PInvoke/Shell32.cs b/OpenSky.Agent/Native/PInvoke/Shell32.cs
similarity index 91%
rename from OpenSky.AgentMSFS/Native/PInvoke/Shell32.cs
rename to OpenSky.Agent/Native/PInvoke/Shell32.cs
index 66f57fb..72c7179 100644
--- a/OpenSky.AgentMSFS/Native/PInvoke/Shell32.cs
+++ b/OpenSky.Agent/Native/PInvoke/Shell32.cs
@@ -1,16 +1,16 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Native.PInvoke
+namespace OpenSky.Agent.Native.PInvoke
{
using System;
using System.Runtime.InteropServices;
- using OpenSky.AgentMSFS.Native.PInvoke.Enums;
- using OpenSky.AgentMSFS.Native.PInvoke.Structs;
+ using OpenSky.Agent.Native.PInvoke.Enums;
+ using OpenSky.Agent.Native.PInvoke.Structs;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Native/PInvoke/Structs/AppBarData.cs b/OpenSky.Agent/Native/PInvoke/Structs/AppBarData.cs
similarity index 95%
rename from OpenSky.AgentMSFS/Native/PInvoke/Structs/AppBarData.cs
rename to OpenSky.Agent/Native/PInvoke/Structs/AppBarData.cs
index 7e97ef2..cde1eab 100644
--- a/OpenSky.AgentMSFS/Native/PInvoke/Structs/AppBarData.cs
+++ b/OpenSky.Agent/Native/PInvoke/Structs/AppBarData.cs
@@ -1,15 +1,15 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Native.PInvoke.Structs
+namespace OpenSky.Agent.Native.PInvoke.Structs
{
using System;
using System.Runtime.InteropServices;
- using OpenSky.AgentMSFS.Native.PInvoke.Enums;
+ using OpenSky.Agent.Native.PInvoke.Enums;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Native/PInvoke/Structs/Point.cs b/OpenSky.Agent/Native/PInvoke/Structs/Point.cs
similarity index 94%
rename from OpenSky.AgentMSFS/Native/PInvoke/Structs/Point.cs
rename to OpenSky.Agent/Native/PInvoke/Structs/Point.cs
index 5b554e7..65a0ba6 100644
--- a/OpenSky.AgentMSFS/Native/PInvoke/Structs/Point.cs
+++ b/OpenSky.Agent/Native/PInvoke/Structs/Point.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Native.PInvoke.Structs
+namespace OpenSky.Agent.Native.PInvoke.Structs
{
using System.Runtime.InteropServices;
diff --git a/OpenSky.AgentMSFS/Native/PInvoke/Structs/Rect.cs b/OpenSky.Agent/Native/PInvoke/Structs/Rect.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Native/PInvoke/Structs/Rect.cs
rename to OpenSky.Agent/Native/PInvoke/Structs/Rect.cs
index 551e041..e887551 100644
--- a/OpenSky.AgentMSFS/Native/PInvoke/Structs/Rect.cs
+++ b/OpenSky.Agent/Native/PInvoke/Structs/Rect.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Native.PInvoke.Structs
+namespace OpenSky.Agent.Native.PInvoke.Structs
{
using System;
using System.Runtime.InteropServices;
@@ -253,7 +253,7 @@ public override int GetHashCode()
/// if the current object is equal to the
/// parameter; otherwise, .
///
- ///
+ ///
/// -------------------------------------------------------------------------------------------------
public bool Equals(Rect other)
{
diff --git a/OpenSky.AgentMSFS/Native/PInvoke/User32.cs b/OpenSky.Agent/Native/PInvoke/User32.cs
similarity index 96%
rename from OpenSky.AgentMSFS/Native/PInvoke/User32.cs
rename to OpenSky.Agent/Native/PInvoke/User32.cs
index ff046b6..3cbbccc 100644
--- a/OpenSky.AgentMSFS/Native/PInvoke/User32.cs
+++ b/OpenSky.Agent/Native/PInvoke/User32.cs
@@ -1,17 +1,17 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Native.PInvoke
+namespace OpenSky.Agent.Native.PInvoke
{
using System;
using System.Runtime.InteropServices;
using JetBrains.Annotations;
- using OpenSky.AgentMSFS.Native.PInvoke.Structs;
+ using OpenSky.Agent.Native.PInvoke.Structs;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Native/Taskbar.cs b/OpenSky.Agent/Native/Taskbar.cs
similarity index 96%
rename from OpenSky.AgentMSFS/Native/Taskbar.cs
rename to OpenSky.Agent/Native/Taskbar.cs
index 081c478..32604b5 100644
--- a/OpenSky.AgentMSFS/Native/Taskbar.cs
+++ b/OpenSky.Agent/Native/Taskbar.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Native
+namespace OpenSky.Agent.Native
{
using System;
using System.Drawing;
@@ -12,9 +12,9 @@ namespace OpenSky.AgentMSFS.Native
using JetBrains.Annotations;
- using OpenSky.AgentMSFS.Native.PInvoke;
- using OpenSky.AgentMSFS.Native.PInvoke.Enums;
- using OpenSky.AgentMSFS.Native.PInvoke.Structs;
+ using OpenSky.Agent.Native.PInvoke;
+ using OpenSky.Agent.Native.PInvoke.Enums;
+ using OpenSky.Agent.Native.PInvoke.Structs;
using Point = System.Drawing.Point;
diff --git a/OpenSky.Agent/OpenAPIs/AgentOpenSkyService.cs b/OpenSky.Agent/OpenAPIs/AgentOpenSkyService.cs
new file mode 100644
index 0000000..5d16d32
--- /dev/null
+++ b/OpenSky.Agent/OpenAPIs/AgentOpenSkyService.cs
@@ -0,0 +1,259 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// OpenSky project 2021-2022
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+// ReSharper disable once CheckNamespace
+
+namespace OpenSkyApi
+{
+ using System;
+ using System.Diagnostics;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Text;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ using OpenSky.Agent;
+ using OpenSky.Agent.Properties;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Flight tracking agent OpenSky service.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public class AgentOpenSkyService : OpenSkyService
+ {
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// The refresh token mutex.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private readonly Mutex refreshTokenMutex = new(false);
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Initializes static members of the class.
+ ///
+ ///
+ /// sushi.at, 01/06/2021.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ static AgentOpenSkyService()
+ {
+ Instance = new AgentOpenSkyService(new HttpClient());
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// sushi.at, 31/01/2022.
+ ///
+ ///
+ /// The HTTP client.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public AgentOpenSkyService(HttpClient httpClient) : base(httpClient)
+ {
+ this.BaseUrl = Settings.Default.OpenSkyAPIUrl;
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets the single static instance.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public static OpenSkyService Instance { get; }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Creates OpenSky HTTP request message asynchronous - automatically adds authorization header and refreshes tokens.
+ ///
+ ///
+ /// sushi.at, 31/05/2021.
+ ///
+ ///
+ /// A token that allows processing to be cancelled.
+ ///
+ ///
+ /// An asynchronous result that yields the create HTTP request message.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ protected override async Task CreateHttpRequestMessageAsync(CancellationToken cancellationToken)
+ {
+ var msg = new HttpRequestMessage();
+
+ // Check if the token needs to be refreshed
+ if (UserSessionService.Instance.CheckTokenNeedsRefresh())
+ {
+ try
+ {
+ await this.RefreshToken(cancellationToken);
+ }
+ catch (HttpRequestException ex)
+ {
+ if (ex.InnerException is WebException webEx)
+ {
+ if (webEx.Status is WebExceptionStatus.ConnectFailure or WebExceptionStatus.NameResolutionFailure or WebExceptionStatus.SendFailure or WebExceptionStatus.ReceiveFailure)
+ {
+ // Server not available? Try again later
+ Debug.WriteLine($"Error refreshing tokens: {ex}");
+ throw;
+ }
+
+ Debug.WriteLine($"Error refreshing tokens: {ex}");
+ UserSessionService.Instance.Logout();
+ throw;
+ }
+
+ Debug.WriteLine($"Error refreshing tokens: {ex}");
+ UserSessionService.Instance.Logout();
+ throw;
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine($"Error refreshing tokens: {ex}");
+ UserSessionService.Instance.Logout();
+ throw;
+ }
+ }
+
+ // Add the JWT token to the authorization header
+ if (UserSessionService.Instance.IsUserLoggedIn)
+ {
+ msg.Headers.Add("Authorization", $"Bearer {UserSessionService.Instance.OpenSkyApiToken}");
+ }
+
+ return msg;
+ }
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Refresh current main JWT token using the refresh token.
+ ///
+ ///
+ /// sushi.at, 31/05/2021.
+ ///
+ ///
+ /// Thrown when an API error condition occurs.
+ ///
+ ///
+ /// A token that allows processing to be cancelled.
+ ///
+ ///
+ /// An asynchronous result.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ protected override async Task RefreshToken(CancellationToken cancellationToken)
+ {
+ try
+ {
+ if (!this.refreshTokenMutex.WaitOne(30 * 1000))
+ {
+ // Timeout refreshing token
+ Debug.WriteLine("Timeout waiting for refresh token mutex.");
+ return;
+ }
+
+ // Now that we have the mutex, check if another refresh was successful in the meantime
+ if (!UserSessionService.Instance.CheckTokenNeedsRefresh())
+ {
+ return;
+ }
+
+ var requestBody = new RefreshToken
+ {
+ Token = UserSessionService.Instance.OpenSkyApiToken,
+ Refresh = UserSessionService.Instance.RefreshToken
+ };
+
+ var urlBuilder = new StringBuilder();
+ var baseUrl = Settings.Default.OpenSkyAPIUrl;
+ urlBuilder.Append(baseUrl != null ? baseUrl.TrimEnd('/') : "").Append("/Authentication/refreshToken");
+
+ using var request = new HttpRequestMessage();
+ var content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(requestBody, this.settings.Value));
+ content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ request.Content = content;
+ request.Method = new HttpMethod("POST");
+ request.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
+
+ var url = urlBuilder.ToString();
+ request.RequestUri = new Uri(url, UriKind.RelativeOrAbsolute);
+
+ var response = await this.httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
+ try
+ {
+ var headers = response.Headers.ToDictionary(h => h.Key, h => h.Value);
+ if (response.Content is { Headers: { } })
+ {
+ foreach (var header in response.Content.Headers)
+ {
+ headers[header.Key] = header.Value;
+ }
+ }
+
+ var status = (int)response.StatusCode;
+ if (status == 200)
+ {
+ var objectResponse = await this.ReadObjectResponseAsync(response, headers, cancellationToken).ConfigureAwait(false);
+ if (objectResponse.Object == null)
+ {
+ throw new ApiException("Response was null which was not expected.", status, objectResponse.Text, headers, null);
+ }
+
+ if (!objectResponse.Object.IsError)
+ {
+ UserSessionService.Instance.TokensWereRefreshed(objectResponse.Object.Data);
+ }
+ else
+ {
+ // Check if another refresh caused a server side concurrency issue but the other request completed the refresh successfully
+ if (!UserSessionService.Instance.CheckTokenNeedsRefresh())
+ {
+ return;
+ }
+
+ throw new ApiException($"Unable to refresh OpenSky token: {objectResponse.Object.Message}", 401, objectResponse.Text, headers, null);
+ }
+ }
+ else
+ {
+ // ReSharper disable once ConditionIsAlwaysTrueOrFalse
+ var responseData = response.Content == null ? null : await response.Content.ReadAsStringAsync().ConfigureAwait(false);
+ throw new ApiException("The HTTP status code of the response was not expected (" + status + ").", status, responseData, headers, null);
+ }
+ }
+ finally
+ {
+ response.Dispose();
+ }
+ }
+ catch (AbandonedMutexException)
+ {
+ //Ignore and retry
+ await this.RefreshToken(cancellationToken);
+ }
+ finally
+ {
+ try
+ {
+ this.refreshTokenMutex.ReleaseMutex();
+ }
+ catch
+ {
+ // Ignore
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/OpenSky.AgentMSFS.csproj b/OpenSky.Agent/OpenSky.Agent.csproj
similarity index 81%
rename from OpenSky.AgentMSFS/OpenSky.AgentMSFS.csproj
rename to OpenSky.Agent/OpenSky.Agent.csproj
index 145cf5b..8c987f3 100644
--- a/OpenSky.AgentMSFS/OpenSky.AgentMSFS.csproj
+++ b/OpenSky.Agent/OpenSky.Agent.csproj
@@ -6,8 +6,8 @@
AnyCPU
{26FAA45D-B4A3-4228-8AF3-E5811BCFC765}
WinExe
- OpenSky.AgentMSFS
- OpenSky.AgentMSFS
+ OpenSky.Agent
+ OpenSky.Agent
v4.8
512
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
@@ -42,7 +42,7 @@
prompt
4
false
- bin\Debug\OpenSky.AgentMSFS.xml
+ bin\Debug\OpenSky.Agent.xml
false
@@ -59,11 +59,11 @@
prompt
4
false
- bin\Release\OpenSky.AgentMSFS.xml
+ bin\Release\OpenSky.Agent.xml
latest
- OpenSky.AgentMSFS.App
+ OpenSky.Agent.App
AllEnabledByDefault
@@ -135,24 +135,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -171,46 +154,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -356,13 +304,6 @@
-
- OpenSkyApi
- OpenSkyService
- NSwagCSharp
- http://localhost:5000/swagger/v1/swagger.json
- /ClientBaseClass:OpenSkyServiceBase /UseHttpRequestMessageCreationMethod:true
-
True
@@ -392,7 +333,6 @@
SettingsSingleFileGenerator
Settings.Designer.cs
-
@@ -449,16 +389,16 @@
13.0.1
- 0.1.4
+ 0.1.5
- 19.4.0.43
+ 19.4.0.48
- 19.4.0.43
+ 19.4.0.48
- 19.4.0.43
+ 19.4.0.48
2.7.4
@@ -495,7 +435,19 @@
-
+
+
+ {1f9cbede-669d-4510-bca2-e6ad29d6a498}
+ OpenSky.Agent.SimConnectMSFS
+
+
+ {30c467e8-2eee-41e5-be01-0142a61ba171}
+ OpenSky.Agent.Simulator
+
+
+
+
+
call "$(ProjectDir)pre-build.bat" "$(ProjectDir)" "$(ConfigurationName)"
diff --git a/OpenSky.Agent/OpenSky.Agent.csproj.DotSettings b/OpenSky.Agent/OpenSky.Agent.csproj.DotSettings
new file mode 100644
index 0000000..4887f94
--- /dev/null
+++ b/OpenSky.Agent/OpenSky.Agent.csproj.DotSettings
@@ -0,0 +1,2 @@
+
+ CSharp100
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/OpenSkyStyles.xaml b/OpenSky.Agent/OpenSkyStyles.xaml
similarity index 99%
rename from OpenSky.AgentMSFS/OpenSkyStyles.xaml
rename to OpenSky.Agent/OpenSkyStyles.xaml
index 7f7883f..699fe8e 100644
--- a/OpenSky.AgentMSFS/OpenSkyStyles.xaml
+++ b/OpenSky.Agent/OpenSkyStyles.xaml
@@ -1,12 +1,12 @@
+ xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
+ xmlns:controls="clr-namespace:OpenSky.Agent.Controls">
#05826c
diff --git a/OpenSky.AgentMSFS/Properties/AssemblyInfo.cs b/OpenSky.Agent/Properties/AssemblyInfo.cs
similarity index 75%
rename from OpenSky.AgentMSFS/Properties/AssemblyInfo.cs
rename to OpenSky.Agent/Properties/AssemblyInfo.cs
index 8eeaa47..383b662 100644
--- a/OpenSky.AgentMSFS/Properties/AssemblyInfo.cs
+++ b/OpenSky.Agent/Properties/AssemblyInfo.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
@@ -11,18 +11,18 @@
using System.Windows.Markup;
#endif
-[assembly: AssemblyTitle("OpenSky.AgentMSFS")]
-[assembly: AssemblyDescription("OpenSky Agent for Flight Simulator 2020")]
+[assembly: AssemblyTitle("OpenSky.Agent")]
+[assembly: AssemblyDescription("OpenSky Flight Tracking Agent")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("OpenSky")]
[assembly: AssemblyProduct("OpenSky")]
-[assembly: AssemblyCopyright("OpenSky project 2021")]
+[assembly: AssemblyCopyright("OpenSky project 2021-2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
-[assembly: AssemblyVersion("0.3.7")]
-[assembly: AssemblyFileVersion("0.3.7")]
+[assembly: AssemblyVersion("0.4.0")]
+[assembly: AssemblyFileVersion("0.4.0")]
// This allows us to detect debug mode in XAML
#if DEBUG
diff --git a/OpenSky.AgentMSFS/Properties/DesignTimeResources.xaml b/OpenSky.Agent/Properties/DesignTimeResources.xaml
similarity index 100%
rename from OpenSky.AgentMSFS/Properties/DesignTimeResources.xaml
rename to OpenSky.Agent/Properties/DesignTimeResources.xaml
diff --git a/OpenSky.AgentMSFS/Properties/Resources.Designer.cs b/OpenSky.Agent/Properties/Resources.Designer.cs
similarity index 82%
rename from OpenSky.AgentMSFS/Properties/Resources.Designer.cs
rename to OpenSky.Agent/Properties/Resources.Designer.cs
index dbedc93..d0a7677 100644
--- a/OpenSky.AgentMSFS/Properties/Resources.Designer.cs
+++ b/OpenSky.Agent/Properties/Resources.Designer.cs
@@ -8,9 +8,10 @@
//
//------------------------------------------------------------------------------
-
-namespace OpenSky.AgentMSFS.Properties
-{
+namespace OpenSky.Agent.Properties {
+ using System;
+
+
///
/// A strongly-typed resource class, for looking up localized strings, etc.
///
@@ -18,51 +19,43 @@ namespace OpenSky.AgentMSFS.Properties
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
+ internal class Resources {
+
private static global::System.Resources.ResourceManager resourceMan;
-
+
private static global::System.Globalization.CultureInfo resourceCulture;
-
+
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
+ internal Resources() {
}
-
+
///
/// Returns the cached ResourceManager instance used by this class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenSky.AgentMSFS.Properties.Resources", typeof(Resources).Assembly);
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenSky.Agent.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
-
+
///
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
return resourceCulture;
}
- set
- {
+ set {
resourceCulture = value;
}
}
diff --git a/OpenSky.AgentMSFS/Properties/Resources.resx b/OpenSky.Agent/Properties/Resources.resx
similarity index 100%
rename from OpenSky.AgentMSFS/Properties/Resources.resx
rename to OpenSky.Agent/Properties/Resources.resx
diff --git a/OpenSky.AgentMSFS/Properties/Settings.Designer.cs b/OpenSky.Agent/Properties/Settings.Designer.cs
similarity index 82%
rename from OpenSky.AgentMSFS/Properties/Settings.Designer.cs
rename to OpenSky.Agent/Properties/Settings.Designer.cs
index baaebea..512fdf9 100644
--- a/OpenSky.AgentMSFS/Properties/Settings.Designer.cs
+++ b/OpenSky.Agent/Properties/Settings.Designer.cs
@@ -8,11 +8,11 @@
//
//------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Properties {
+namespace OpenSky.Agent.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.3.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -38,24 +38,24 @@ public bool SettingsUpdateRequired {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("localhost")]
- public string SimulatorHostName {
+ public string SimConnectHostName {
get {
- return ((string)(this["SimulatorHostName"]));
+ return ((string)(this["SimConnectHostName"]));
}
set {
- this["SimulatorHostName"] = value;
+ this["SimConnectHostName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("500")]
- public uint SimulatorPort {
+ public uint SimConnectPort {
get {
- return ((uint)(this["SimulatorPort"]));
+ return ((uint)(this["SimConnectPort"]));
}
set {
- this["SimulatorPort"] = value;
+ this["SimConnectPort"] = value;
}
}
@@ -161,7 +161,7 @@ public string OpenSkyAPIUrl {
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("https://api.github.com/repos/opensky-to/agent-msfs/releases/latest")]
+ [global::System.Configuration.DefaultSettingValueAttribute("https://api.github.com/repos/opensky-to/agent/releases/latest")]
public string AutoUpdateURL {
get {
return ((string)(this["AutoUpdateURL"]));
@@ -188,5 +188,41 @@ public string SoundPack {
this["SoundPack"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("SimConnectMSFS")]
+ public string SimulatorInterface {
+ get {
+ return ((string)(this["SimulatorInterface"]));
+ }
+ set {
+ this["SimulatorInterface"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("localhost")]
+ public string SimulatorHostName {
+ get {
+ return ((string)(this["SimulatorHostName"]));
+ }
+ set {
+ this["SimulatorHostName"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("500")]
+ public string SimulatorPort {
+ get {
+ return ((string)(this["SimulatorPort"]));
+ }
+ set {
+ this["SimulatorPort"] = value;
+ }
+ }
}
}
diff --git a/OpenSky.AgentMSFS/Properties/Settings.settings b/OpenSky.Agent/Properties/Settings.settings
similarity index 79%
rename from OpenSky.AgentMSFS/Properties/Settings.settings
rename to OpenSky.Agent/Properties/Settings.settings
index c3d0694..1935d6b 100644
--- a/OpenSky.AgentMSFS/Properties/Settings.settings
+++ b/OpenSky.Agent/Properties/Settings.settings
@@ -1,14 +1,14 @@
-
+
True
-
+
localhost
-
+
500
@@ -39,7 +39,7 @@
http://localhost:5000
- https://api.github.com/repos/opensky-to/agent-msfs/releases/latest
+ https://api.github.com/repos/opensky-to/agent/releases/latest
http://localhost:5001/changepassword
@@ -47,5 +47,14 @@
+
+ SimConnectMSFS
+
+
+ localhost
+
+
+ 500
+
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/Resources/OSannouncement.wav b/OpenSky.Agent/Resources/OSannouncement.wav
similarity index 100%
rename from OpenSky.AgentMSFS/Resources/OSannouncement.wav
rename to OpenSky.Agent/Resources/OSannouncement.wav
diff --git a/OpenSky.AgentMSFS/Resources/OSbeepbeepstart.wav b/OpenSky.Agent/Resources/OSbeepbeepstart.wav
similarity index 100%
rename from OpenSky.AgentMSFS/Resources/OSbeepbeepstart.wav
rename to OpenSky.Agent/Resources/OSbeepbeepstart.wav
diff --git a/OpenSky.AgentMSFS/Resources/OSdingdong.wav b/OpenSky.Agent/Resources/OSdingdong.wav
similarity index 100%
rename from OpenSky.AgentMSFS/Resources/OSdingdong.wav
rename to OpenSky.Agent/Resources/OSdingdong.wav
diff --git a/OpenSky.AgentMSFS/Resources/OSnegative.wav b/OpenSky.Agent/Resources/OSnegative.wav
similarity index 100%
rename from OpenSky.AgentMSFS/Resources/OSnegative.wav
rename to OpenSky.Agent/Resources/OSnegative.wav
diff --git a/OpenSky.AgentMSFS/Resources/opensky.ico b/OpenSky.Agent/Resources/opensky.ico
similarity index 100%
rename from OpenSky.AgentMSFS/Resources/opensky.ico
rename to OpenSky.Agent/Resources/opensky.ico
diff --git a/OpenSky.AgentMSFS/Resources/opensky_grey16.ico b/OpenSky.Agent/Resources/opensky_grey16.ico
similarity index 100%
rename from OpenSky.AgentMSFS/Resources/opensky_grey16.ico
rename to OpenSky.Agent/Resources/opensky_grey16.ico
diff --git a/OpenSky.AgentMSFS/Resources/opensky_pause16.ico b/OpenSky.Agent/Resources/opensky_pause16.ico
similarity index 100%
rename from OpenSky.AgentMSFS/Resources/opensky_pause16.ico
rename to OpenSky.Agent/Resources/opensky_pause16.ico
diff --git a/OpenSky.AgentMSFS/Resources/opensky_red16.ico b/OpenSky.Agent/Resources/opensky_red16.ico
similarity index 100%
rename from OpenSky.AgentMSFS/Resources/opensky_red16.ico
rename to OpenSky.Agent/Resources/opensky_red16.ico
diff --git a/OpenSky.AgentMSFS/Resources/profile200.png b/OpenSky.Agent/Resources/profile200.png
similarity index 100%
rename from OpenSky.AgentMSFS/Resources/profile200.png
rename to OpenSky.Agent/Resources/profile200.png
diff --git a/OpenSky.AgentMSFS/SyncfusionLicenseRegister.bat b/OpenSky.Agent/SyncfusionLicenseRegister.bat
similarity index 100%
rename from OpenSky.AgentMSFS/SyncfusionLicenseRegister.bat
rename to OpenSky.Agent/SyncfusionLicenseRegister.bat
diff --git a/OpenSky.AgentMSFS/Tools/AssemblyVersionExtension.cs b/OpenSky.Agent/Tools/AssemblyVersionExtension.cs
similarity index 96%
rename from OpenSky.AgentMSFS/Tools/AssemblyVersionExtension.cs
rename to OpenSky.Agent/Tools/AssemblyVersionExtension.cs
index c9f1fab..e1d9ba5 100644
--- a/OpenSky.AgentMSFS/Tools/AssemblyVersionExtension.cs
+++ b/OpenSky.Agent/Tools/AssemblyVersionExtension.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Tools
+namespace OpenSky.Agent.Tools
{
using System;
using System.Reflection;
diff --git a/OpenSky.AgentMSFS/Tools/DateTimeTextWriterTraceListener.cs b/OpenSky.Agent/Tools/DateTimeTextWriterTraceListener.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Tools/DateTimeTextWriterTraceListener.cs
rename to OpenSky.Agent/Tools/DateTimeTextWriterTraceListener.cs
index 3dc6142..dbf7918 100644
--- a/OpenSky.AgentMSFS/Tools/DateTimeTextWriterTraceListener.cs
+++ b/OpenSky.Agent/Tools/DateTimeTextWriterTraceListener.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Tools
+namespace OpenSky.Agent.Tools
{
using System;
using System.Diagnostics;
diff --git a/OpenSky.AgentMSFS/Tools/ExceptionExtensions.cs b/OpenSky.Agent/Tools/ExceptionExtensions.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Tools/ExceptionExtensions.cs
rename to OpenSky.Agent/Tools/ExceptionExtensions.cs
index 46ba2f2..b91f671 100644
--- a/OpenSky.AgentMSFS/Tools/ExceptionExtensions.cs
+++ b/OpenSky.Agent/Tools/ExceptionExtensions.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Tools
+namespace OpenSky.Agent.Tools
{
using System;
using System.Diagnostics;
@@ -15,11 +15,11 @@ namespace OpenSky.AgentMSFS.Tools
using Newtonsoft.Json;
- using OpenSky.AgentMSFS.Controls;
- using OpenSky.AgentMSFS.Controls.Models;
- using OpenSky.AgentMSFS.MVVM;
- using OpenSky.AgentMSFS.OpenAPIs;
- using OpenSky.AgentMSFS.Views;
+ using OpenSky.Agent.Controls;
+ using OpenSky.Agent.Controls.Models;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Simulator.OpenAPIs;
+ using OpenSky.Agent.Views;
using OpenSkyApi;
diff --git a/OpenSky.AgentMSFS/Tools/MultiSelectExtension.cs b/OpenSky.Agent/Tools/MultiSelectExtension.cs
similarity index 99%
rename from OpenSky.AgentMSFS/Tools/MultiSelectExtension.cs
rename to OpenSky.Agent/Tools/MultiSelectExtension.cs
index 3854acf..41d1d8a 100644
--- a/OpenSky.AgentMSFS/Tools/MultiSelectExtension.cs
+++ b/OpenSky.Agent/Tools/MultiSelectExtension.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Tools
+namespace OpenSky.Agent.Tools
{
using System;
using System.Collections;
diff --git a/OpenSky.AgentMSFS/Tools/StringValueAttribute.cs b/OpenSky.Agent/Tools/StringValueAttribute.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Tools/StringValueAttribute.cs
rename to OpenSky.Agent/Tools/StringValueAttribute.cs
index e45f3cf..ed88ec0 100644
--- a/OpenSky.AgentMSFS/Tools/StringValueAttribute.cs
+++ b/OpenSky.Agent/Tools/StringValueAttribute.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Tools
+namespace OpenSky.Agent.Tools
{
using System;
diff --git a/OpenSky.AgentMSFS/Tools/VisibilityAnimation.cs b/OpenSky.Agent/Tools/VisibilityAnimation.cs
similarity index 99%
rename from OpenSky.AgentMSFS/Tools/VisibilityAnimation.cs
rename to OpenSky.Agent/Tools/VisibilityAnimation.cs
index 04154f3..d436911 100644
--- a/OpenSky.AgentMSFS/Tools/VisibilityAnimation.cs
+++ b/OpenSky.Agent/Tools/VisibilityAnimation.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Tools
+namespace OpenSky.Agent.Tools
{
using System;
using System.Collections.Generic;
diff --git a/OpenSky.AgentMSFS/Tools/WindowExtensions.cs b/OpenSky.Agent/Tools/WindowExtensions.cs
similarity index 94%
rename from OpenSky.AgentMSFS/Tools/WindowExtensions.cs
rename to OpenSky.Agent/Tools/WindowExtensions.cs
index 2a1f8cb..b50445a 100644
--- a/OpenSky.AgentMSFS/Tools/WindowExtensions.cs
+++ b/OpenSky.Agent/Tools/WindowExtensions.cs
@@ -1,15 +1,15 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Tools
+namespace OpenSky.Agent.Tools
{
using System.Windows;
- using OpenSky.AgentMSFS.Native;
- using OpenSky.AgentMSFS.Native.PInvoke.Enums;
+ using OpenSky.Agent.Native;
+ using OpenSky.Agent.Native.PInvoke.Enums;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/UserSessionService.cs b/OpenSky.Agent/UserSessionService.cs
similarity index 97%
rename from OpenSky.AgentMSFS/UserSessionService.cs
rename to OpenSky.Agent/UserSessionService.cs
index ef14b56..5047c6f 100644
--- a/OpenSky.AgentMSFS/UserSessionService.cs
+++ b/OpenSky.Agent/UserSessionService.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS
+namespace OpenSky.Agent
{
using System;
using System.Collections.Generic;
@@ -15,7 +15,7 @@ namespace OpenSky.AgentMSFS
using JetBrains.Annotations;
- using OpenSky.AgentMSFS.Properties;
+ using OpenSky.Agent.Properties;
using OpenSkyApi;
@@ -79,10 +79,10 @@ private UserSessionService()
var client = new XDMessagingClient();
var listener = client.Listeners.GetListenerForMode(XDTransportMode.Compatibility);
- listener.RegisterChannel("OPENSKY-AGENT-MSFS");
+ listener.RegisterChannel("OPENSKY-AGENT");
listener.MessageReceived += (_, e) =>
{
- if (e.DataGram.Channel == "OPENSKY-AGENT-MSFS")
+ if (e.DataGram.Channel == "OPENSKY-AGENT")
{
switch (e.DataGram.Message)
{
@@ -261,7 +261,7 @@ public async Task ForceTokenRefresh()
try
{
- var result = await OpenSkyService.Instance.GetUserRolesAsync();
+ var result = await AgentOpenSkyService.Instance.GetUserRolesAsync();
return !result.IsError;
}
catch (Exception ex)
@@ -313,7 +313,7 @@ public async Task RefreshLinkedAccounts()
{
try
{
- var result = await OpenSkyService.Instance.GetLinkedAccountsAsync();
+ var result = await AgentOpenSkyService.Instance.GetLinkedAccountsAsync();
if (!result.IsError)
{
this.LinkedAccounts = result.Data;
@@ -344,7 +344,7 @@ public async Task RefreshUserAccountOverview()
{
try
{
- var result = await OpenSkyService.Instance.GetAccountOverviewAsync();
+ var result = await AgentOpenSkyService.Instance.GetAccountOverviewAsync();
if (!result.IsError)
{
this.AccountOverview = result.Data;
@@ -400,7 +400,7 @@ public async Task UpdateUserRoles()
{
try
{
- var result = await OpenSkyService.Instance.GetUserRolesAsync();
+ var result = await AgentOpenSkyService.Instance.GetUserRolesAsync();
if (!result.IsError)
{
this.userRoles.Clear();
diff --git a/OpenSky.AgentMSFS/VectorGraphics.xaml b/OpenSky.Agent/VectorGraphics.xaml
similarity index 100%
rename from OpenSky.AgentMSFS/VectorGraphics.xaml
rename to OpenSky.Agent/VectorGraphics.xaml
diff --git a/OpenSky.AgentMSFS/Views/AircraftTypes.xaml b/OpenSky.Agent/Views/AircraftTypes.xaml
similarity index 97%
rename from OpenSky.AgentMSFS/Views/AircraftTypes.xaml
rename to OpenSky.Agent/Views/AircraftTypes.xaml
index 401f490..c983a5b 100644
--- a/OpenSky.AgentMSFS/Views/AircraftTypes.xaml
+++ b/OpenSky.Agent/Views/AircraftTypes.xaml
@@ -1,7 +1,7 @@
-
@@ -505,17 +505,17 @@
Max payload Δ lbs
Comments
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OpenSky.AgentMSFS/Views/AircraftTypes.xaml.cs b/OpenSky.Agent/Views/AircraftTypes.xaml.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Views/AircraftTypes.xaml.cs
rename to OpenSky.Agent/Views/AircraftTypes.xaml.cs
index 75cf05a..6d62da6 100644
--- a/OpenSky.AgentMSFS/Views/AircraftTypes.xaml.cs
+++ b/OpenSky.Agent/Views/AircraftTypes.xaml.cs
@@ -1,16 +1,16 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views
+namespace OpenSky.Agent.Views
{
using System.Windows;
using DataGridExtensions;
- using OpenSky.AgentMSFS.Views.Models;
+ using OpenSky.Agent.Views.Models;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Views/AutoUpdate.xaml b/OpenSky.Agent/Views/AutoUpdate.xaml
similarity index 92%
rename from OpenSky.AgentMSFS/Views/AutoUpdate.xaml
rename to OpenSky.Agent/Views/AutoUpdate.xaml
index 58ce22c..1759d68 100644
--- a/OpenSky.AgentMSFS/Views/AutoUpdate.xaml
+++ b/OpenSky.Agent/Views/AutoUpdate.xaml
@@ -1,7 +1,7 @@
-
- A new version of the OpenSky Agent for Microsoft Flight Simulator is available!
+ A new version of the OpenSky Flight Tracking Agent is available!
diff --git a/OpenSky.AgentMSFS/Views/AutoUpdate.xaml.cs b/OpenSky.Agent/Views/AutoUpdate.xaml.cs
similarity index 96%
rename from OpenSky.AgentMSFS/Views/AutoUpdate.xaml.cs
rename to OpenSky.Agent/Views/AutoUpdate.xaml.cs
index 0352a14..3593965 100644
--- a/OpenSky.AgentMSFS/Views/AutoUpdate.xaml.cs
+++ b/OpenSky.Agent/Views/AutoUpdate.xaml.cs
@@ -1,15 +1,15 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views
+namespace OpenSky.Agent.Views
{
using System;
using System.Windows;
- using OpenSky.AgentMSFS.Views.Models;
+ using OpenSky.Agent.Views.Models;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Views/FlightTracking.xaml b/OpenSky.Agent/Views/FlightTracking.xaml
similarity index 78%
rename from OpenSky.AgentMSFS/Views/FlightTracking.xaml
rename to OpenSky.Agent/Views/FlightTracking.xaml
index 258bcee..f25bbed 100644
--- a/OpenSky.AgentMSFS/Views/FlightTracking.xaml
+++ b/OpenSky.Agent/Views/FlightTracking.xaml
@@ -1,7 +1,7 @@
-
- Destination:
Alternate:
-
-
+
+
-
-
+
+
-
-
+
+
@@ -112,12 +112,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -128,68 +128,68 @@
-
+
Date and Time
Sim:
-
+
Flight:
-
+
- Set
+ Set
-
+
Fuel
Sim:
-
+
Flight:
-
+
- Set
+ Set
-
+
Payload
Sim:
-
+
Flight:
-
+
- Set
+ Set
-
+
Plane model
Sim:
-
+
Flight:
-
+
-
+
Realism
-
+
-
+
Location
-
+
@@ -241,21 +241,21 @@
Paused?
Flight phase
-
+
-
+
gallons
-
-
-
-
+
+
+
+
Remember: Don't start your engines or pushback until ground handling is complete or your flight tracking will be aborted automatically!
-
+
-
+
[*] Time warp time saved and pause times only update when the sim rate is changed or the sim is resumed.
@@ -263,7 +263,7 @@
Note: You can close this window and OpenSky will monitor your flight in the background...
-
+
Weights and Balances
@@ -280,25 +280,25 @@
-
-
+
+
Center of gravity
Lateral CG
-
-
+
+
-
-
+
+
Payload weight
Max takeoff weight
-
-
+
+
-
+
Ground Handling
@@ -318,14 +318,14 @@
Fuel loading estimated completion time
Payload loading estimated completion time
-
-
+
+
-
+
Fuel loading complete
-
+
Payload loading complete
@@ -344,15 +344,15 @@
Payload
-
+
Crew
-
+
-
+
Weights and Balances
@@ -376,16 +376,16 @@
-
-
+
+
Center of gravity
CG forward limit
CG aft limit
Lateral CG
-
-
-
-
+
+
+
+
@@ -411,28 +411,28 @@
-
-
+
+
Empty weight
Fuel / Max fuel
Payload / Max
Total / MTOW
-
+
-
+
/
-
+
-
+
/
-
+
-
+
/
-
+
lbs
lbs
@@ -440,21 +440,21 @@
lbs
-
+
-
+
/
-
+
-
+
/
-
+
-
+
/
-
+
kg
kg
@@ -468,7 +468,7 @@
Fuel (
-
+
gallons)
@@ -491,7 +491,7 @@
Payload (
-
+
lbs)
@@ -520,7 +520,7 @@
-
+
@@ -534,9 +534,9 @@
Route
-
+
Alternate route
-
+
@@ -544,9 +544,9 @@
Flight events
-
+
-
+
@@ -598,18 +598,18 @@
-
-
+
+
-
+
-
+
@@ -625,7 +625,7 @@
Map
-
+
diff --git a/OpenSky.AgentMSFS/Views/FlightTracking.xaml.cs b/OpenSky.Agent/Views/FlightTracking.xaml.cs
similarity index 96%
rename from OpenSky.AgentMSFS/Views/FlightTracking.xaml.cs
rename to OpenSky.Agent/Views/FlightTracking.xaml.cs
index 38fcf65..6013f37 100644
--- a/OpenSky.AgentMSFS/Views/FlightTracking.xaml.cs
+++ b/OpenSky.Agent/Views/FlightTracking.xaml.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views
+namespace OpenSky.Agent.Views
{
using System;
using System.Diagnostics;
@@ -17,12 +17,13 @@ namespace OpenSky.AgentMSFS.Views
using Microsoft.Maps.MapControl.WPF;
- using OpenSky.AgentMSFS.Controls;
- using OpenSky.AgentMSFS.Converters;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.SimConnect.Enums;
- using OpenSky.AgentMSFS.Tools;
- using OpenSky.AgentMSFS.Views.Models;
+ using OpenSky.Agent.Controls;
+ using OpenSky.Agent.Converters;
+ using OpenSky.Agent.Simulator;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Models;
+ using OpenSky.Agent.Simulator.Tools;
+ using OpenSky.Agent.Views.Models;
/// -------------------------------------------------------------------------------------------------
///
@@ -93,11 +94,11 @@ private void AddAircraftAndTrailsToMap()
Debug.WriteLine("Adding aircraft and trails to the map view");
// Add Simbrief route to map
- var simbriefRoute = new MapPolyline { Stroke = new SolidColorBrush(OpenSkyColors.OpenSkySimBrief), StrokeThickness = 4, Locations = ((FlightTrackingViewModel)this.DataContext).SimConnect.SimbriefRouteLocations };
+ var simbriefRoute = new MapPolyline { Stroke = new SolidColorBrush(OpenSkyColors.OpenSkySimBrief), StrokeThickness = 4, Locations = ((FlightTrackingViewModel)this.DataContext).Simulator.SimbriefRouteLocations };
this.MapView.Children.Add(simbriefRoute);
// Add aircraft trail to map
- var aircraftTrail = new MapPolyline { Stroke = new SolidColorBrush(OpenSkyColors.OpenSkyTeal), StrokeThickness = 4, Locations = ((FlightTrackingViewModel)this.DataContext).SimConnect.AircraftTrailLocations };
+ var aircraftTrail = new MapPolyline { Stroke = new SolidColorBrush(OpenSkyColors.OpenSkyTeal), StrokeThickness = 4, Locations = ((FlightTrackingViewModel)this.DataContext).Simulator.AircraftTrailLocations };
this.MapView.Children.Add(aircraftTrail);
// Add aircraft position to map
@@ -105,12 +106,12 @@ private void AddAircraftAndTrailsToMap()
aircraftPosition.SetValue(Panel.ZIndexProperty, 999);
aircraftPosition.SetValue(MapLayer.PositionOriginProperty, PositionOrigin.Center);
var rotateTransform = new RotateTransform { CenterX = 20, CenterY = 20 };
- var headingBinding = new Binding { Source = this.DataContext, Path = new PropertyPath("SimConnect.PrimaryTracking.Heading"), Mode = BindingMode.OneWay };
+ var headingBinding = new Binding { Source = this.DataContext, Path = new PropertyPath("Simulator.PrimaryTracking.Heading"), Mode = BindingMode.OneWay };
BindingOperations.SetBinding(rotateTransform, RotateTransform.AngleProperty, headingBinding);
aircraftPosition.RenderTransform = rotateTransform;
var aircraftDrawingImage = this.FindResource("OpenSkyLogoPointingUpForMap") as DrawingImage;
aircraftPosition.Source = aircraftDrawingImage;
- var positionBinding = new Binding { Source = this.DataContext, Path = new PropertyPath("SimConnect.PrimaryTracking.MapLocation"), Mode = BindingMode.OneWay };
+ var positionBinding = new Binding { Source = this.DataContext, Path = new PropertyPath("Simulator.PrimaryTracking.MapLocation"), Mode = BindingMode.OneWay };
BindingOperations.SetBinding(aircraftPosition, MapLayer.PositionProperty, positionBinding);
this.MapView.Children.Add(aircraftPosition);
}
@@ -196,9 +197,9 @@ private void FlightTrackingLoaded(object sender, RoutedEventArgs e)
// Replay past tracking markers to add to this view
if (this.DataContext is FlightTrackingViewModel viewModel)
{
- viewModel.SimConnect.ReplayMapMarkers();
- viewModel.SimConnect.NextStepFlashingChanged += this.SimConnectNextStepFlashingChanged;
- this.SimConnectNextStepFlashingChanged(this, viewModel.SimConnect.NextStepFlashing);
+ viewModel.Simulator.ReplayMapMarkers();
+ viewModel.Simulator.NextStepFlashingChanged += this.SimConnectNextStepFlashingChanged;
+ this.SimConnectNextStepFlashingChanged(this, viewModel.Simulator.NextStepFlashing);
}
}
diff --git a/OpenSky.AgentMSFS/Views/LandingReport.xaml b/OpenSky.Agent/Views/LandingReport.xaml
similarity index 98%
rename from OpenSky.AgentMSFS/Views/LandingReport.xaml
rename to OpenSky.Agent/Views/LandingReport.xaml
index 3a4f02b..36803db 100644
--- a/OpenSky.AgentMSFS/Views/LandingReport.xaml
+++ b/OpenSky.Agent/Views/LandingReport.xaml
@@ -1,7 +1,7 @@
-
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views
+namespace OpenSky.Agent.Views
{
using System;
using System.Windows;
- using OpenSky.AgentMSFS.Native;
- using OpenSky.AgentMSFS.Native.PInvoke.Enums;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Native;
+ using OpenSky.Agent.Native.PInvoke.Enums;
+ using OpenSky.Agent.Simulator.Tools;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Views/LoginNotification.xaml b/OpenSky.Agent/Views/LoginNotification.xaml
similarity index 93%
rename from OpenSky.AgentMSFS/Views/LoginNotification.xaml
rename to OpenSky.Agent/Views/LoginNotification.xaml
index 9236089..be1ed8b 100644
--- a/OpenSky.AgentMSFS/Views/LoginNotification.xaml
+++ b/OpenSky.Agent/Views/LoginNotification.xaml
@@ -1,7 +1,7 @@
-
- The OpenSky Agent for Microsoft Flight Simulator 2020
+ The OpenSky Flight Tracking Agent
requires you to login with your OpenSky account
before you can track your flights.
diff --git a/OpenSky.AgentMSFS/Views/LoginNotification.xaml.cs b/OpenSky.Agent/Views/LoginNotification.xaml.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Views/LoginNotification.xaml.cs
rename to OpenSky.Agent/Views/LoginNotification.xaml.cs
index 157b1e4..ff356e6 100644
--- a/OpenSky.AgentMSFS/Views/LoginNotification.xaml.cs
+++ b/OpenSky.Agent/Views/LoginNotification.xaml.cs
@@ -1,16 +1,17 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views
+namespace OpenSky.Agent.Views
{
using System;
using System.Windows;
- using OpenSky.AgentMSFS.Tools;
- using OpenSky.AgentMSFS.Views.Models;
+ using OpenSky.Agent.Simulator.Tools;
+ using OpenSky.Agent.Tools;
+ using OpenSky.Agent.Views.Models;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Views/Models/AircraftTypesViewModel.cs b/OpenSky.Agent/Views/Models/AircraftTypesViewModel.cs
similarity index 96%
rename from OpenSky.AgentMSFS/Views/Models/AircraftTypesViewModel.cs
rename to OpenSky.Agent/Views/Models/AircraftTypesViewModel.cs
index 5bd0727..0043387 100644
--- a/OpenSky.AgentMSFS/Views/Models/AircraftTypesViewModel.cs
+++ b/OpenSky.Agent/Views/Models/AircraftTypesViewModel.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using System;
using System.Collections.ObjectModel;
@@ -13,11 +13,11 @@ namespace OpenSky.AgentMSFS.Views.Models
using System.Threading;
using System.Windows;
- using OpenSky.AgentMSFS.Controls;
- using OpenSky.AgentMSFS.Controls.Models;
- using OpenSky.AgentMSFS.MVVM;
- using OpenSky.AgentMSFS.SimConnect;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Controls;
+ using OpenSky.Agent.Controls.Models;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Simulator.Tools;
+ using OpenSky.Agent.Tools;
using OpenSkyApi;
@@ -28,7 +28,7 @@ namespace OpenSky.AgentMSFS.Views.Models
///
/// sushi.at, 28/03/2021.
///
- ///
+ ///
/// -------------------------------------------------------------------------------------------------
public class AircraftTypesViewModel : ViewModel
{
@@ -866,10 +866,10 @@ public AircraftType SelectedAircraftType
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the SimConnect object.
+ /// Gets the simulator object.
///
/// -------------------------------------------------------------------------------------------------
- public SimConnect SimConnect => SimConnect.Instance;
+ public Agent.Simulator.Simulator Simulator => Agent.Simulator.Simulator.Instance;
/// -------------------------------------------------------------------------------------------------
///
@@ -916,7 +916,7 @@ public int VersionNumber
/// -------------------------------------------------------------------------------------------------
private void AddAircraftType()
{
- if (!this.SimConnect.Connected)
+ if (!this.Simulator.Connected)
{
this.AddAircraftTypeCommand.ReportProgress(() =>
{
@@ -927,7 +927,7 @@ private void AddAircraftType()
return;
}
- if (string.IsNullOrEmpty(this.SimConnect.PlaneIdentity.AtcModel) || string.IsNullOrEmpty(this.SimConnect.PlaneIdentity.AtcType))
+ if (string.IsNullOrEmpty(this.Simulator.AircraftIdentity.AtcModel) || string.IsNullOrEmpty(this.Simulator.AircraftIdentity.AtcType))
{
ExtendedMessageBoxResult? answer = null;
this.AddAircraftTypeCommand.ReportProgress(
@@ -971,16 +971,16 @@ private void AddAircraftType()
{
Id = Guid.Empty, // API will assign this
UploaderID = "OpenSkyUser", // API will assign this
- AtcType = !string.IsNullOrEmpty(this.SimConnect.PlaneIdentity.AtcType) ? this.SimConnect.PlaneIdentity.AtcType : "MISSING",
- AtcModel = !string.IsNullOrEmpty(this.SimConnect.PlaneIdentity.AtcModel) ? this.SimConnect.PlaneIdentity.AtcModel : "MISSING",
- EngineType = this.SimConnect.PlaneIdentity.EngineType,
- EngineCount = this.SimConnect.PlaneIdentity.EngineCount,
- EmptyWeight = this.SimConnect.WeightAndBalance.EmptyWeight,
- FuelTotalCapacity = this.SimConnect.WeightAndBalance.FuelTotalCapacity,
- FuelWeightPerGallon = Math.Round(this.SimConnect.WeightAndBalance.FuelWeightPerGallon, 2),
- MaxGrossWeight = this.SimConnect.WeightAndBalance.MaxGrossWeight,
- FlapsAvailable = this.SimConnect.PlaneIdentity.FlapsAvailable,
- IsGearRetractable = this.SimConnect.PlaneIdentity.GearRetractable,
+ AtcType = !string.IsNullOrEmpty(this.Simulator.AircraftIdentity.AtcType) ? this.Simulator.AircraftIdentity.AtcType : "MISSING",
+ AtcModel = !string.IsNullOrEmpty(this.Simulator.AircraftIdentity.AtcModel) ? this.Simulator.AircraftIdentity.AtcModel : "MISSING",
+ EngineType = this.Simulator.AircraftIdentity.EngineType,
+ EngineCount = this.Simulator.AircraftIdentity.EngineCount,
+ EmptyWeight = this.Simulator.WeightAndBalance.EmptyWeight,
+ FuelTotalCapacity = this.Simulator.WeightAndBalance.FuelTotalCapacity,
+ FuelWeightPerGallon = Math.Round(this.Simulator.WeightAndBalance.FuelWeightPerGallon, 2),
+ MaxGrossWeight = this.Simulator.WeightAndBalance.MaxGrossWeight,
+ FlapsAvailable = this.Simulator.AircraftIdentity.FlapsAvailable,
+ IsGearRetractable = this.Simulator.AircraftIdentity.GearRetractable,
Name = this.Name,
VersionNumber = this.VersionNumber,
Manufacturer = this.Manufacturer,
@@ -1002,7 +1002,7 @@ private void AddAircraftType()
this.LoadingText = "Adding new aircraft type";
try
{
- var result = OpenSkyService.Instance.AddAircraftTypeAsync(newAircraftType).Result;
+ var result = AgentOpenSkyService.Instance.AddAircraftTypeAsync(newAircraftType).Result;
if (!result.IsError)
{
this.AddAircraftTypeCommand.ReportProgress(
@@ -1184,7 +1184,7 @@ private void DeleteType()
this.LoadingText = "Deleting aircraft type";
try
{
- var result = OpenSkyService.Instance.DeleteAircraftTypeAsync(this.SelectedAircraftType.Id).Result;
+ var result = AgentOpenSkyService.Instance.DeleteAircraftTypeAsync(this.SelectedAircraftType.Id).Result;
if (!result.IsError)
{
this.DeleteTypeCommand.ReportProgress(
@@ -1241,7 +1241,7 @@ private void DisableDetailedChecks()
this.LoadingText = "Enabling aircraft type detailed checks";
try
{
- var result = OpenSkyService.Instance.DisableAircraftTypeDetailedChecksAsync(this.SelectedAircraftType.Id).Result;
+ var result = AgentOpenSkyService.Instance.DisableAircraftTypeDetailedChecksAsync(this.SelectedAircraftType.Id).Result;
if (!result.IsError)
{
this.DisableDetailedChecksCommand.ReportProgress(
@@ -1298,7 +1298,7 @@ private void DisableType()
this.LoadingText = "Disabling aircraft type";
try
{
- var result = OpenSkyService.Instance.DisableAircraftTypeAsync(this.SelectedAircraftType.Id).Result;
+ var result = AgentOpenSkyService.Instance.DisableAircraftTypeAsync(this.SelectedAircraftType.Id).Result;
if (!result.IsError)
{
this.DisableTypeCommand.ReportProgress(
@@ -1355,7 +1355,7 @@ private void EnableDetailedChecks()
this.LoadingText = "Enabling aircraft type detailed checks";
try
{
- var result = OpenSkyService.Instance.EnableAircraftTypeDetailedChecksAsync(this.SelectedAircraftType.Id).Result;
+ var result = AgentOpenSkyService.Instance.EnableAircraftTypeDetailedChecksAsync(this.SelectedAircraftType.Id).Result;
if (!result.IsError)
{
this.EnableDetailedChecksCommand.ReportProgress(
@@ -1412,7 +1412,7 @@ private void EnableType()
this.LoadingText = "Enabling aircraft type";
try
{
- var result = OpenSkyService.Instance.EnableAircraftTypeAsync(this.SelectedAircraftType.Id).Result;
+ var result = AgentOpenSkyService.Instance.EnableAircraftTypeAsync(this.SelectedAircraftType.Id).Result;
if (!result.IsError)
{
this.EnableTypeCommand.ReportProgress(
@@ -1484,7 +1484,7 @@ private void GetUserRoles()
/// -------------------------------------------------------------------------------------------------
private void IdentifyAircraft()
{
- if (!SimConnect.Instance.Connected)
+ if (!this.Simulator.Connected)
{
var notification = new OpenSkyNotification("Identify aircraft", "Not connected to sim!", MessageBoxButton.OK, ExtendedMessageBoxImage.Error, 30);
notification.SetErrorColorStyle();
@@ -1525,7 +1525,7 @@ private void RefreshAircraftTypes()
this.LoadingText = "Refreshing aircraft types";
try
{
- var result = OpenSkyService.Instance.GetSimulatorAircraftTypesAsync(Simulator.MSFS).Result;
+ var result = AgentOpenSkyService.Instance.GetSimulatorAircraftTypesAsync(this.Simulator.SimulatorType).Result;
if (!result.IsError)
{
this.RefreshAircraftTypesCommand.ReportProgress(
@@ -1597,7 +1597,7 @@ private void SaveEditedAircraftType()
this.LoadingText = "Saving changed aircraft type";
try
{
- var result = OpenSkyService.Instance.UpdateAircraftTypeAsync(this.EditedAircraftType).Result;
+ var result = AgentOpenSkyService.Instance.UpdateAircraftTypeAsync(this.EditedAircraftType).Result;
if (!result.IsError)
{
this.SaveEditedAircraftTypeCommand.ReportProgress(
@@ -1646,7 +1646,7 @@ private void SaveEditedAircraftType()
/// -------------------------------------------------------------------------------------------------
private void StartAddAircraft()
{
- if (!SimConnect.Instance.Connected)
+ if (!this.Simulator.Connected)
{
var notification = new OpenSkyNotification("Add aircraft type", "Not connected to sim!", MessageBoxButton.OK, ExtendedMessageBoxImage.Error, 30);
notification.SetErrorColorStyle();
diff --git a/OpenSky.AgentMSFS/Views/Models/AutoUpdateViewModel.cs b/OpenSky.Agent/Views/Models/AutoUpdateViewModel.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Views/Models/AutoUpdateViewModel.cs
rename to OpenSky.Agent/Views/Models/AutoUpdateViewModel.cs
index de1f210..ecb03ce 100644
--- a/OpenSky.AgentMSFS/Views/Models/AutoUpdateViewModel.cs
+++ b/OpenSky.Agent/Views/Models/AutoUpdateViewModel.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using System;
using System.ComponentModel;
@@ -16,10 +16,11 @@ namespace OpenSky.AgentMSFS.Views.Models
using Newtonsoft.Json;
- using OpenSky.AgentMSFS.Controls;
- using OpenSky.AgentMSFS.Controls.Models;
- using OpenSky.AgentMSFS.MVVM;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Controls;
+ using OpenSky.Agent.Controls.Models;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Simulator.Tools;
+ using OpenSky.Agent.Tools;
/// -------------------------------------------------------------------------------------------------
///
@@ -28,7 +29,7 @@ namespace OpenSky.AgentMSFS.Views.Models
///
/// sushi.at, 24/11/2021.
///
- ///
+ ///
/// -------------------------------------------------------------------------------------------------
public class AutoUpdateViewModel : ViewModel
{
@@ -283,7 +284,7 @@ public string UpdateName
/// Gets the version information text.
///
/// -------------------------------------------------------------------------------------------------
- public string VersionInfoText => $"OpenSky Agent MSFS {this.CurrentVersion} is now available. You have version {this.InstalledVersion} installed.\r\nWould you like to download it now?";
+ public string VersionInfoText => $"OpenSky Flight Tracking Agent {this.CurrentVersion} is now available. You have version {this.InstalledVersion} installed.\r\nWould you like to download it now?";
/// -------------------------------------------------------------------------------------------------
///
@@ -320,7 +321,7 @@ private void CheckForUpdates()
try
{
using var client = new WebClient();
- client.Headers[HttpRequestHeader.UserAgent] = "OpenSky.AgentMSFS";
+ client.Headers[HttpRequestHeader.UserAgent] = "OpenSky.Agent";
var jsonString = client.DownloadString(Properties.Settings.Default.AutoUpdateURL);
dynamic json = JsonConvert.DeserializeObject(jsonString);
@@ -485,7 +486,7 @@ private void DownloadUpdate()
var localInstallerFile = Path.Combine(Path.GetTempPath(), this.DownloadURL.Substring(this.DownloadURL.LastIndexOf('/') + 1));
using var client = new WebClient();
- client.Headers[HttpRequestHeader.UserAgent] = "OpenSky.AgentMSFS";
+ client.Headers[HttpRequestHeader.UserAgent] = "OpenSky.Agent";
client.DownloadProgressChanged += this.DownloadProgressChanged;
client.DownloadFileCompleted += this.DownloadFileCompleted;
client.DownloadFileAsync(new Uri(this.DownloadURL), localInstallerFile, localInstallerFile);
diff --git a/OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.FuelTanks.cs b/OpenSky.Agent/Views/Models/FlightTrackingViewModel.FuelTanks.cs
similarity index 70%
rename from OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.FuelTanks.cs
rename to OpenSky.Agent/Views/Models/FlightTrackingViewModel.FuelTanks.cs
index ab97671..f46e4d0 100644
--- a/OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.FuelTanks.cs
+++ b/OpenSky.Agent/Views/Models/FlightTrackingViewModel.FuelTanks.cs
@@ -1,20 +1,20 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using System;
using System.Collections.Concurrent;
using System.Collections.Specialized;
using System.Diagnostics;
- using OpenSky.AgentMSFS.Controls;
- using OpenSky.AgentMSFS.Controls.Models;
- using OpenSky.AgentMSFS.MVVM;
- using OpenSky.AgentMSFS.SimConnect.Enums;
+ using OpenSky.Agent.Controls;
+ using OpenSky.Agent.Controls.Models;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Simulator.Enums;
/// -------------------------------------------------------------------------------------------------
///
@@ -23,7 +23,7 @@ namespace OpenSky.AgentMSFS.Views.Models
///
/// sushi.at, 17/03/2021.
///
- ///
+ ///
/// -------------------------------------------------------------------------------------------------
public partial class FlightTrackingViewModel
{
@@ -102,7 +102,7 @@ private void QuantitiesCollectionChanged(object sender, NotifyCollectionChangedE
foreach (FuelTank tank in Enum.GetValues(typeof(FuelTank)))
{
this.FuelTankInfos[tank] =
- $"{(this.FuelTankQuantities[tank] / this.SimConnect.FuelTanks.Capacities[tank] * 100):F0} % ({this.FuelTankQuantities[tank]:F1} gallons, {(this.FuelTankQuantities[tank] * this.SimConnect.WeightAndBalance.FuelWeightPerGallon):F1} lbs / {(this.FuelTankQuantities[tank] * 3.78541):F1} l, {(this.FuelTankQuantities[tank] * this.SimConnect.WeightAndBalance.FuelWeightPerGallon * 0.453592):F1} kg)";
+ $"{(this.FuelTankQuantities[tank] / this.Simulator.FuelTanks.Capacities[tank] * 100):F0} % ({this.FuelTankQuantities[tank]:F1} gallons, {(this.FuelTankQuantities[tank] * this.Simulator.WeightAndBalance.FuelWeightPerGallon):F1} lbs / {(this.FuelTankQuantities[tank] * 3.78541):F1} l, {(this.FuelTankQuantities[tank] * this.Simulator.WeightAndBalance.FuelWeightPerGallon * 0.453592):F1} kg)";
}
this.NotifyPropertyChanged(nameof(this.FuelTankInfos));
@@ -120,12 +120,12 @@ private void SetFuelTanks()
{
try
{
- if (this.SimConnect.Flight == null || this.SimConnect.Flight.Aircraft.Type.RequiresManualFuelling)
+ if (this.Simulator.Flight == null || this.Simulator.Flight.Aircraft.Type.RequiresManualFuelling)
{
return;
}
- var fuelTanks = this.SimConnect.FuelTanks;
+ var fuelTanks = this.Simulator.FuelTanks;
var quantities = fuelTanks.Quantities;
foreach (FuelTank tank in Enum.GetValues(typeof(FuelTank)))
{
@@ -134,9 +134,9 @@ private void SetFuelTanks()
fuelTanks.UpdateQuantitiesFromDictionary(quantities);
- this.SimConnect.SetFuelTanks(fuelTanks);
- this.SimConnect.RefreshStructNow(Requests.FuelTanks);
- this.SimConnect.RefreshStructNow(Requests.WeightAndBalance);
+ this.Simulator.SetFuelTanks(fuelTanks);
+ this.Simulator.RefreshModelNow(Requests.FuelTanks);
+ this.Simulator.RefreshModelNow(Requests.WeightAndBalance);
}
catch (Exception ex)
{
@@ -157,30 +157,30 @@ private void SetFuelTanks()
private void SuggestFuel()
{
Debug.WriteLine("Calculating suggested fuel distribution");
- var fuelToLoad = this.SimConnect.Flight?.FuelGallons ?? 0.0;
+ var fuelToLoad = this.Simulator.Flight?.FuelGallons ?? 0.0;
// Priority 1: Left/Right wingtip tanks
- if (this.SimConnect.FuelTanks.FuelTankLeftTipCapacity > 0 && Math.Abs(this.SimConnect.FuelTanks.FuelTankLeftTipCapacity - this.SimConnect.FuelTanks.FuelTankRightTipCapacity) == 0)
+ if (this.Simulator.FuelTanks.FuelTankLeftTipCapacity > 0 && Math.Abs(this.Simulator.FuelTanks.FuelTankLeftTipCapacity - this.Simulator.FuelTanks.FuelTankRightTipCapacity) == 0)
{
- var intoWingTips = Math.Min(this.SimConnect.FuelTanks.FuelTankLeftTipCapacity * 2, fuelToLoad) / 2;
+ var intoWingTips = Math.Min(this.Simulator.FuelTanks.FuelTankLeftTipCapacity * 2, fuelToLoad) / 2;
this.FuelTankQuantities[FuelTank.LeftTip] = intoWingTips;
this.FuelTankQuantities[FuelTank.RightTip] = intoWingTips;
fuelToLoad -= intoWingTips * 2;
}
// Priority 2: Left/Right main tanks
- if (this.SimConnect.FuelTanks.FuelTankLeftMainCapacity > 0 && Math.Abs(this.SimConnect.FuelTanks.FuelTankLeftMainCapacity - this.SimConnect.FuelTanks.FuelTankRightMainCapacity) == 0)
+ if (this.Simulator.FuelTanks.FuelTankLeftMainCapacity > 0 && Math.Abs(this.Simulator.FuelTanks.FuelTankLeftMainCapacity - this.Simulator.FuelTanks.FuelTankRightMainCapacity) == 0)
{
- var intoMains = Math.Min(this.SimConnect.FuelTanks.FuelTankLeftMainCapacity * 2, fuelToLoad) / 2;
+ var intoMains = Math.Min(this.Simulator.FuelTanks.FuelTankLeftMainCapacity * 2, fuelToLoad) / 2;
this.FuelTankQuantities[FuelTank.LeftMain] = intoMains;
this.FuelTankQuantities[FuelTank.RightMain] = intoMains;
fuelToLoad -= intoMains * 2;
}
// Priority 3: Left/Right aux tanks
- if (this.SimConnect.FuelTanks.FuelTankLeftAuxCapacity > 0 && Math.Abs(this.SimConnect.FuelTanks.FuelTankLeftAuxCapacity - this.SimConnect.FuelTanks.FuelTankRightAuxCapacity) == 0)
+ if (this.Simulator.FuelTanks.FuelTankLeftAuxCapacity > 0 && Math.Abs(this.Simulator.FuelTanks.FuelTankLeftAuxCapacity - this.Simulator.FuelTanks.FuelTankRightAuxCapacity) == 0)
{
- var intoAuxs = Math.Min(this.SimConnect.FuelTanks.FuelTankLeftAuxCapacity * 2, fuelToLoad) / 2;
+ var intoAuxs = Math.Min(this.Simulator.FuelTanks.FuelTankLeftAuxCapacity * 2, fuelToLoad) / 2;
this.FuelTankQuantities[FuelTank.LeftAux] = intoAuxs;
this.FuelTankQuantities[FuelTank.RightAux] = intoAuxs;
fuelToLoad -= intoAuxs * 2;
@@ -188,10 +188,10 @@ private void SuggestFuel()
// Priority 4: Center tanks x3
var fueledCenter3 = false;
- if (this.SimConnect.FuelTanks.FuelTankCenterCapacity > 0 && Math.Abs(this.SimConnect.FuelTanks.FuelTankCenterCapacity - this.SimConnect.FuelTanks.FuelTankCenter2Capacity) == 0 &&
- Math.Abs(this.SimConnect.FuelTanks.FuelTankCenterCapacity - this.SimConnect.FuelTanks.FuelTankCenter3Capacity) == 0)
+ if (this.Simulator.FuelTanks.FuelTankCenterCapacity > 0 && Math.Abs(this.Simulator.FuelTanks.FuelTankCenterCapacity - this.Simulator.FuelTanks.FuelTankCenter2Capacity) == 0 &&
+ Math.Abs(this.Simulator.FuelTanks.FuelTankCenterCapacity - this.Simulator.FuelTanks.FuelTankCenter3Capacity) == 0)
{
- var intoCenter = Math.Min(this.SimConnect.FuelTanks.FuelTankCenterCapacity * 3, fuelToLoad) / 3;
+ var intoCenter = Math.Min(this.Simulator.FuelTanks.FuelTankCenterCapacity * 3, fuelToLoad) / 3;
this.FuelTankQuantities[FuelTank.Center] = intoCenter;
this.FuelTankQuantities[FuelTank.Center2] = intoCenter;
this.FuelTankQuantities[FuelTank.Center3] = intoCenter;
@@ -201,9 +201,9 @@ private void SuggestFuel()
// Priority 5: Center tanks x2
var fueledCenter2 = false;
- if (this.SimConnect.FuelTanks.FuelTankCenterCapacity > 0 && Math.Abs(this.SimConnect.FuelTanks.FuelTankCenterCapacity - this.SimConnect.FuelTanks.FuelTankCenter2Capacity) == 0)
+ if (this.Simulator.FuelTanks.FuelTankCenterCapacity > 0 && Math.Abs(this.Simulator.FuelTanks.FuelTankCenterCapacity - this.Simulator.FuelTanks.FuelTankCenter2Capacity) == 0)
{
- var intoCenter = Math.Min(this.SimConnect.FuelTanks.FuelTankCenterCapacity * 2, fuelToLoad) / 2;
+ var intoCenter = Math.Min(this.Simulator.FuelTanks.FuelTankCenterCapacity * 2, fuelToLoad) / 2;
this.FuelTankQuantities[FuelTank.Center] = intoCenter;
this.FuelTankQuantities[FuelTank.Center2] = intoCenter;
fuelToLoad -= intoCenter;
@@ -211,34 +211,34 @@ private void SuggestFuel()
}
// Priority 6: Center tank alone
- if (this.SimConnect.FuelTanks.FuelTankCenterCapacity > 0 && !fueledCenter3 && !fueledCenter2)
+ if (this.Simulator.FuelTanks.FuelTankCenterCapacity > 0 && !fueledCenter3 && !fueledCenter2)
{
- var intoCenter = Math.Min(this.SimConnect.FuelTanks.FuelTankCenterCapacity, fuelToLoad);
+ var intoCenter = Math.Min(this.Simulator.FuelTanks.FuelTankCenterCapacity, fuelToLoad);
this.FuelTankQuantities[FuelTank.Center] = intoCenter;
fuelToLoad -= intoCenter;
}
// Priority 7: Center2 tank alone
- if (this.SimConnect.FuelTanks.FuelTankCenter2Capacity > 0 && !fueledCenter3 && !fueledCenter2)
+ if (this.Simulator.FuelTanks.FuelTankCenter2Capacity > 0 && !fueledCenter3 && !fueledCenter2)
{
- var intoCenter = Math.Min(this.SimConnect.FuelTanks.FuelTankCenter2Capacity, fuelToLoad);
+ var intoCenter = Math.Min(this.Simulator.FuelTanks.FuelTankCenter2Capacity, fuelToLoad);
this.FuelTankQuantities[FuelTank.Center2] = intoCenter;
fuelToLoad -= intoCenter;
}
// Priority 8: Center3 tank alone
- if (this.SimConnect.FuelTanks.FuelTankCenter3Capacity > 0 && !fueledCenter3)
+ if (this.Simulator.FuelTanks.FuelTankCenter3Capacity > 0 && !fueledCenter3)
{
- var intoCenter = Math.Min(this.SimConnect.FuelTanks.FuelTankCenter3Capacity, fuelToLoad);
+ var intoCenter = Math.Min(this.Simulator.FuelTanks.FuelTankCenter3Capacity, fuelToLoad);
this.FuelTankQuantities[FuelTank.Center3] = intoCenter;
fuelToLoad -= intoCenter;
}
// Priority 9: External tanks x2
var fueledExternal = false;
- if (this.SimConnect.FuelTanks.FuelTankCenterCapacity > 0 && Math.Abs(this.SimConnect.FuelTanks.FuelTankExternal1Capacity - this.SimConnect.FuelTanks.FuelTankExternal2Capacity) == 0)
+ if (this.Simulator.FuelTanks.FuelTankCenterCapacity > 0 && Math.Abs(this.Simulator.FuelTanks.FuelTankExternal1Capacity - this.Simulator.FuelTanks.FuelTankExternal2Capacity) == 0)
{
- var intoExternal = Math.Min(this.SimConnect.FuelTanks.FuelTankExternal1Capacity * 2, fuelToLoad) / 2;
+ var intoExternal = Math.Min(this.Simulator.FuelTanks.FuelTankExternal1Capacity * 2, fuelToLoad) / 2;
this.FuelTankQuantities[FuelTank.External1] = intoExternal;
this.FuelTankQuantities[FuelTank.External2] = intoExternal;
fuelToLoad -= intoExternal * 2;
@@ -246,17 +246,17 @@ private void SuggestFuel()
}
// Priority 10: External 1 alone
- if (this.SimConnect.FuelTanks.FuelTankExternal1Capacity > 0 && !fueledExternal)
+ if (this.Simulator.FuelTanks.FuelTankExternal1Capacity > 0 && !fueledExternal)
{
- var intoExternal = Math.Min(this.SimConnect.FuelTanks.FuelTankExternal1Capacity, fuelToLoad);
+ var intoExternal = Math.Min(this.Simulator.FuelTanks.FuelTankExternal1Capacity, fuelToLoad);
this.FuelTankQuantities[FuelTank.External1] = intoExternal;
fuelToLoad -= intoExternal;
}
// Priority 11: External 2 alone
- if (this.SimConnect.FuelTanks.FuelTankExternal2Capacity > 0 && !fueledExternal)
+ if (this.Simulator.FuelTanks.FuelTankExternal2Capacity > 0 && !fueledExternal)
{
- var intoExternal = Math.Min(this.SimConnect.FuelTanks.FuelTankExternal2Capacity, fuelToLoad);
+ var intoExternal = Math.Min(this.Simulator.FuelTanks.FuelTankExternal2Capacity, fuelToLoad);
this.FuelTankQuantities[FuelTank.External2] = intoExternal;
fuelToLoad -= intoExternal;
}
diff --git a/OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.Graphs.cs b/OpenSky.Agent/Views/Models/FlightTrackingViewModel.Graphs.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.Graphs.cs
rename to OpenSky.Agent/Views/Models/FlightTrackingViewModel.Graphs.cs
index 359a069..efc5585 100644
--- a/OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.Graphs.cs
+++ b/OpenSky.Agent/Views/Models/FlightTrackingViewModel.Graphs.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using System.Windows;
@@ -15,7 +15,7 @@ namespace OpenSky.AgentMSFS.Views.Models
///
/// sushi.at, 21/01/2022.
///
- ///
+ ///
/// -------------------------------------------------------------------------------------------------
public partial class FlightTrackingViewModel
{
diff --git a/OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.Map.cs b/OpenSky.Agent/Views/Models/FlightTrackingViewModel.Map.cs
similarity index 96%
rename from OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.Map.cs
rename to OpenSky.Agent/Views/Models/FlightTrackingViewModel.Map.cs
index 8e20c87..1931eb3 100644
--- a/OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.Map.cs
+++ b/OpenSky.Agent/Views/Models/FlightTrackingViewModel.Map.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using System;
using System.Device.Location;
@@ -18,11 +18,11 @@ namespace OpenSky.AgentMSFS.Views.Models
using Microsoft.Maps.MapControl.WPF;
- using OpenSky.AgentMSFS.Controls;
- using OpenSky.AgentMSFS.Controls.Models;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.MVVM;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Controls;
+ using OpenSky.Agent.Controls.Models;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Simulator.Models;
+ using OpenSky.Agent.Simulator.Tools;
using OpenSkyApi;
@@ -247,7 +247,7 @@ private void ImportSimbrief()
throw new Exception("No Simbrief user name configured, please configure it using the OpenSky client!");
}
- if (this.SimConnect.Flight == null)
+ if (this.Simulator.Flight == null)
{
throw new Exception("No flight loaded!");
}
@@ -258,17 +258,17 @@ private void ImportSimbrief()
var originICAO = (string)ofp.Element("origin")?.Element("icao_code");
var destinationICAO = (string)ofp.Element("destination")?.Element("icao_code");
- if (!this.SimConnect.Flight.Origin.Icao.Trim().Equals(originICAO.Trim(), StringComparison.InvariantCultureIgnoreCase))
+ if (!this.Simulator.Flight.Origin.Icao.Trim().Equals(originICAO.Trim(), StringComparison.InvariantCultureIgnoreCase))
{
throw new Exception("Departure airport doesn't match!");
}
- if (!this.SimConnect.Flight.Destination.Icao.Trim().Equals(destinationICAO.Trim(), StringComparison.InvariantCultureIgnoreCase))
+ if (!this.Simulator.Flight.Destination.Icao.Trim().Equals(destinationICAO.Trim(), StringComparison.InvariantCultureIgnoreCase))
{
throw new Exception("Destination airport doesn't match!");
}
- this.SimConnect.ImportSimbrief(ofp);
+ this.Simulator.ImportSimbrief(ofp);
this.ImportSimbriefVisibility = Visibility.Collapsed;
}
catch (WebException ex)
diff --git a/OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.PayloadStations.cs b/OpenSky.Agent/Views/Models/FlightTrackingViewModel.PayloadStations.cs
similarity index 85%
rename from OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.PayloadStations.cs
rename to OpenSky.Agent/Views/Models/FlightTrackingViewModel.PayloadStations.cs
index 1553755..7c50adf 100644
--- a/OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.PayloadStations.cs
+++ b/OpenSky.Agent/Views/Models/FlightTrackingViewModel.PayloadStations.cs
@@ -1,19 +1,19 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
- using OpenSky.AgentMSFS.Controls;
- using OpenSky.AgentMSFS.Controls.Models;
- using OpenSky.AgentMSFS.MVVM;
- using OpenSky.AgentMSFS.SimConnect.Enums;
+ using OpenSky.Agent.Controls;
+ using OpenSky.Agent.Controls.Models;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Simulator.Enums;
/// -------------------------------------------------------------------------------------------------
///
@@ -22,7 +22,7 @@ namespace OpenSky.AgentMSFS.Views.Models
///
/// sushi.at, 19/03/2021.
///
- ///
+ ///
/// -------------------------------------------------------------------------------------------------
public partial class FlightTrackingViewModel
{
@@ -85,14 +85,14 @@ public bool IsPayloadExpanded
/// -------------------------------------------------------------------------------------------------
private void SetPayloadStations()
{
- if (this.SimConnect.Flight == null || this.SimConnect.Flight.Aircraft.Type.RequiresManualLoading)
+ if (this.Simulator.Flight == null || this.Simulator.Flight.Aircraft.Type.RequiresManualLoading)
{
return;
}
try
{
- var payloadStations = this.SimConnect.PayloadStations;
+ var payloadStations = this.Simulator.PayloadStations;
payloadStations.Weight1 = this.PayloadStationWeights[0];
payloadStations.Weight2 = this.PayloadStationWeights[1];
payloadStations.Weight3 = this.PayloadStationWeights[2];
@@ -114,9 +114,9 @@ private void SetPayloadStations()
payloadStations.Weight19 = this.PayloadStationWeights[18];
payloadStations.Weight20 = this.PayloadStationWeights[19];
- this.SimConnect.SetPayloadStations(payloadStations);
- this.SimConnect.RefreshStructNow(Requests.PayloadStations);
- this.SimConnect.RefreshStructNow(Requests.WeightAndBalance);
+ this.Simulator.SetPayloadStations(payloadStations);
+ this.Simulator.RefreshModelNow(Requests.PayloadStations);
+ this.Simulator.RefreshModelNow(Requests.WeightAndBalance);
}
catch (Exception ex)
{
@@ -137,13 +137,13 @@ private void SetPayloadStations()
private void SuggestPayload()
{
Debug.WriteLine("Calculating suggested payload distribution");
- var payloadToLoad = this.SimConnect.Flight?.PayloadPounds ?? 0.0;
+ var payloadToLoad = this.Simulator.Flight?.PayloadPounds ?? 0.0;
// Check for pilot/copilot first
var nonPilotStations = 0;
- for (var i = 0; i < this.SimConnect.PayloadStations.Count; i++)
+ for (var i = 0; i < this.Simulator.PayloadStations.Count; i++)
{
- if (this.SimConnect.PayloadStations.Names[i].Contains("PILOT"))
+ if (this.Simulator.PayloadStations.Names[i].Contains("PILOT"))
{
var payload = Math.Min(170, payloadToLoad);
this.PayloadStationWeights[i] = payload;
@@ -158,15 +158,15 @@ private void SuggestPayload()
// Distribute the rest evenly
if (nonPilotStations == 0)
{
- nonPilotStations = this.SimConnect.PayloadStations.Count;
+ nonPilotStations = this.Simulator.PayloadStations.Count;
}
if (nonPilotStations > 0)
{
var payloadShare = payloadToLoad / nonPilotStations;
- for (var i = 0; i < this.SimConnect.PayloadStations.Count; i++)
+ for (var i = 0; i < this.Simulator.PayloadStations.Count; i++)
{
- if (!this.SimConnect.PayloadStations.Names[i].Contains("PILOT"))
+ if (!this.Simulator.PayloadStations.Names[i].Contains("PILOT"))
{
this.PayloadStationWeights[i] = payloadShare;
payloadToLoad -= payloadShare;
diff --git a/OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.cs b/OpenSky.Agent/Views/Models/FlightTrackingViewModel.cs
similarity index 92%
rename from OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.cs
rename to OpenSky.Agent/Views/Models/FlightTrackingViewModel.cs
index 2c46732..97af1a6 100644
--- a/OpenSky.AgentMSFS/Views/Models/FlightTrackingViewModel.cs
+++ b/OpenSky.Agent/Views/Models/FlightTrackingViewModel.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using System;
using System.Collections.Concurrent;
@@ -17,13 +17,13 @@ namespace OpenSky.AgentMSFS.Views.Models
using JetBrains.Annotations;
- using OpenSky.AgentMSFS.Controls;
- using OpenSky.AgentMSFS.Controls.Models;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.MVVM;
- using OpenSky.AgentMSFS.SimConnect;
- using OpenSky.AgentMSFS.SimConnect.Enums;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Controls;
+ using OpenSky.Agent.Controls.Models;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Models;
+ using OpenSky.Agent.Simulator.Tools;
+ using OpenSky.Agent.Tools;
using OpenSkyApi;
@@ -34,7 +34,7 @@ namespace OpenSky.AgentMSFS.Views.Models
///
/// sushi.at, 17/03/2021.
///
- ///
+ ///
/// -------------------------------------------------------------------------------------------------
public partial class FlightTrackingViewModel : ViewModel
{
@@ -181,11 +181,11 @@ public FlightTrackingViewModel()
}
// Set up event log listeners
- this.SimConnect.TrackingEventMarkerAdded += this.SimConnectTrackingEventMarkerAdded;
- this.SimConnect.SimbriefWaypointMarkerAdded += this.SimConnectSimbriefWaypointMarkerAdded;
- this.SimConnect.TrackingStatusChanged += this.SimConnectTrackingStatusChanged;
- this.SimConnect.FlightChanged += this.SimConnectFlightChanged;
- this.SimConnect.LocationChanged += this.SimConnectLocationChanged;
+ this.Simulator.TrackingEventMarkerAdded += this.SimConnectTrackingEventMarkerAdded;
+ this.Simulator.SimbriefWaypointMarkerAdded += this.SimConnectSimbriefWaypointMarkerAdded;
+ this.Simulator.TrackingStatusChanged += this.SimConnectTrackingStatusChanged;
+ this.Simulator.FlightChanged += this.SimConnectFlightChanged;
+ this.Simulator.LocationChanged += this.SimConnectLocationChanged;
// Create commands
this.SetFuelAndPayloadCommand = new Command(this.SetFuelAndPayload);
@@ -206,9 +206,9 @@ public FlightTrackingViewModel()
this.SkipGroundHandlingCommand = new Command(this.SkipGroundHandling);
// Are we already preparing/resuming/tracking?
- this.SimConnectTrackingStatusChanged(this, this.SimConnect.TrackingStatus);
- this.SimConnectFlightChanged(this, this.SimConnect.Flight);
- if (this.SimConnect.SimbriefOfpLoaded)
+ this.SimConnectTrackingStatusChanged(this, this.Simulator.TrackingStatus);
+ this.SimConnectFlightChanged(this, this.Simulator.Flight);
+ if (this.Simulator.SimbriefOfpLoaded)
{
this.ImportSimbriefVisibility = Visibility.Collapsed;
}
@@ -406,11 +406,11 @@ public string ShowHideOFPButtonText
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the SimConnect instance.
+ /// Gets the simulator instance.
///
/// -------------------------------------------------------------------------------------------------
[NotNull]
- public SimConnect SimConnect => SimConnect.Instance;
+ public Agent.Simulator.Simulator Simulator => Agent.Simulator.Simulator.Instance;
/// -------------------------------------------------------------------------------------------------
///
@@ -585,7 +585,7 @@ private set
private void AbortFlight()
{
Debug.WriteLine("User clicked on abort flight, confirming...");
- if (this.SimConnect.Flight == null)
+ if (this.Simulator.Flight == null)
{
return;
}
@@ -616,8 +616,8 @@ private void AbortFlight()
this.LoadingText = "Aborting flight...";
try
{
- this.SimConnect.StopTracking(false);
- this.SimConnect.Flight = null;
+ this.Simulator.StopTracking(false);
+ this.Simulator.Flight = null;
this.IsFuelExpanded = false;
this.IsPayloadExpanded = false;
this.WeightAndBalancesVisibility = Visibility.Visible;
@@ -707,7 +707,7 @@ private void SimConnectTrackingStatusChanged(object sender, TrackingStatus e)
this.TrackingConditionsVisibility = Visibility.Visible;
this.TrackingStatusVisibility = Visibility.Collapsed;
this.SkipGroundHandlingVisibility = Visibility.Collapsed;
- if (!this.SimConnect.SimbriefOfpLoaded)
+ if (!this.Simulator.SimbriefOfpLoaded)
{
this.ImportSimbriefVisibility = Visibility.Visible;
}
@@ -801,7 +801,7 @@ private void SimConnectTrackingStatusChanged(object sender, TrackingStatus e)
/// -------------------------------------------------------------------------------------------------
private void SkipGroundHandling()
{
- if (this.SimConnect.SkipGroundHandling(false))
+ if (this.Simulator.SkipGroundHandling(false))
{
this.SkipGroundHandlingVisibility = Visibility.Collapsed;
}
@@ -820,7 +820,7 @@ private void SlewIntoPosition()
Debug.WriteLine("User requested slew into position");
try
{
- this.SimConnect.SlewPlaneToFlightPosition();
+ this.Simulator.SlewPlaneToFlightPosition();
}
catch (Exception ex)
{
@@ -844,7 +844,7 @@ private void SlewIntoPosition()
/// -------------------------------------------------------------------------------------------------
private void SpeedUpGroundHandling()
{
- this.SimConnect.SpeedUpGroundHandling();
+ this.Simulator.SpeedUpGroundHandling();
}
/// -------------------------------------------------------------------------------------------------
@@ -860,13 +860,13 @@ private void StartTracking()
try
{
// Start tracking a new flight
- if (this.SimConnect.TrackingStatus == TrackingStatus.Preparing)
+ if (this.Simulator.TrackingStatus == TrackingStatus.Preparing)
{
Debug.WriteLine("User clicked on start tracking, performing checks");
this.StartTrackingCommand.ReportProgress(() => this.StartTrackingCommand.CanExecute = false);
// Check conditions met
- if (!this.SimConnect.CanStartTracking)
+ if (!this.Simulator.CanStartTracking)
{
Debug.WriteLine("Tracking conditions not met");
this.StartTrackingCommand.ReportProgress(() =>
@@ -880,31 +880,31 @@ private void StartTracking()
}
// Set time in sim?
- if (this.SimConnect.TrackingConditions[(int)TrackingConditions.DateTime].AutoSet && this.SimConnect.Flight != null)
+ if (this.Simulator.TrackingConditions[(int)TrackingConditions.DateTime].AutoSet && this.Simulator.Flight != null)
{
- this.SimConnect.SetTime(DateTime.UtcNow.AddHours(this.SimConnect.Flight.UtcOffset));
+ this.Simulator.SetTime(DateTime.UtcNow.AddHours(this.Simulator.Flight.UtcOffset));
}
// Set fuel?
- if (this.SimConnect.TrackingConditions[(int)TrackingConditions.Fuel].AutoSet)
+ if (this.Simulator.TrackingConditions[(int)TrackingConditions.Fuel].AutoSet)
{
this.StartTrackingCommand.ReportProgress(() => this.SetFuelTanksCommand.DoExecute(null), true);
}
// Set payload?
- if (this.SimConnect.TrackingConditions[(int)TrackingConditions.Payload].AutoSet)
+ if (this.Simulator.TrackingConditions[(int)TrackingConditions.Payload].AutoSet)
{
this.StartTrackingCommand.ReportProgress(() => this.SetPayloadStationsCommand.DoExecute(null), true);
}
// Set the plane registration
- this.SimConnect.SetPlaneRegistry(this.SimConnect.Flight?.Aircraft.Registry);
+ this.Simulator.SetAircraftRegistry(this.Simulator.Flight?.Aircraft.Registry);
// Wait a bit to make sure all structs have updated, especially time in sim
- Thread.Sleep(this.SimConnect.SampleRates[Requests.Secondary] + 1000);
+ Thread.Sleep(this.Simulator.SampleRates[Requests.Secondary] + 1000);
// Check weights and balance
- if (this.SimConnect.WeightAndBalance.CgPercent < this.SimConnect.WeightAndBalance.CgFwdLimit || this.SimConnect.WeightAndBalance.CgPercent > this.SimConnect.WeightAndBalance.CgAftLimit)
+ if (this.Simulator.WeightAndBalance.CgPercent < this.Simulator.WeightAndBalance.CgFwdLimit || this.Simulator.WeightAndBalance.CgPercent > this.Simulator.WeightAndBalance.CgAftLimit)
{
Debug.WriteLine("CG outside limits, double checking with user...");
ExtendedMessageBoxResult? answer = null;
@@ -935,7 +935,7 @@ private void StartTracking()
}
}
- if (Math.Abs(this.SimConnect.WeightAndBalance.CgPercentLateral) > 0.01)
+ if (Math.Abs(this.Simulator.WeightAndBalance.CgPercentLateral) > 0.01)
{
Debug.WriteLine("Lateral CG outside limits, double checking with user...");
ExtendedMessageBoxResult? answer = null;
@@ -966,7 +966,7 @@ private void StartTracking()
}
}
- if (this.SimConnect.WeightAndBalance.PayloadWeight > this.SimConnect.WeightAndBalance.MaxPayloadWeight)
+ if (this.Simulator.WeightAndBalance.PayloadWeight > this.Simulator.WeightAndBalance.MaxPayloadWeight)
{
Debug.WriteLine("Payload weight outside limits, double checking with user...");
ExtendedMessageBoxResult? answer = null;
@@ -997,7 +997,7 @@ private void StartTracking()
}
}
- if (this.SimConnect.WeightAndBalance.TotalWeight > this.SimConnect.WeightAndBalance.MaxGrossWeight)
+ if (this.Simulator.WeightAndBalance.TotalWeight > this.Simulator.WeightAndBalance.MaxGrossWeight)
{
Debug.WriteLine("Total weight outside limits, double checking with user...");
ExtendedMessageBoxResult? answer = null;
@@ -1027,7 +1027,7 @@ private void StartTracking()
}
}
- if (!this.SimConnect.GroundHandlingComplete && this.SimConnect.SecondaryTracking.EngineRunning)
+ if (!this.Simulator.GroundHandlingComplete && this.Simulator.SecondaryTracking.EngineRunning)
{
Debug.WriteLine("Ground handling not complete, ask the user about skipping...");
ExtendedMessageBoxResult? answer = null;
@@ -1056,21 +1056,21 @@ private void StartTracking()
return;
}
- this.SimConnect.SkipGroundHandling(true);
+ this.Simulator.SkipGroundHandling(true);
}
- this.SimConnect.StartTracking();
+ this.Simulator.StartTracking();
this.StartTrackingCommand.ReportProgress(() => this.StartTrackingCommand.CanExecute = true);
}
// Resume flight
- if (this.SimConnect.TrackingStatus == TrackingStatus.Resuming)
+ if (this.Simulator.TrackingStatus == TrackingStatus.Resuming)
{
Debug.WriteLine("User clicked on resume tracking, performing checks");
this.StartTrackingCommand.ReportProgress(() => this.StartTrackingCommand.CanExecute = false);
// Check conditions met
- if (!this.SimConnect.CanStartTracking)
+ if (!this.Simulator.CanStartTracking)
{
Debug.WriteLine("Tracking conditions not met");
this.StartTrackingCommand.ReportProgress(() =>
@@ -1084,23 +1084,23 @@ private void StartTracking()
}
// Set time in sim?
- if (this.SimConnect.TrackingConditions[(int)TrackingConditions.DateTime].AutoSet && this.SimConnect.Flight != null)
+ if (this.Simulator.TrackingConditions[(int)TrackingConditions.DateTime].AutoSet && this.Simulator.Flight != null)
{
- this.SimConnect.SetTime(DateTime.UtcNow.AddHours(this.SimConnect.Flight.UtcOffset));
+ this.Simulator.SetTime(DateTime.UtcNow.AddHours(this.Simulator.Flight.UtcOffset));
}
// Set fuel and payload back to what they were when we saved the flight
- this.SimConnect.SetFuelAndPayloadFromSave();
+ this.Simulator.SetFuelAndPayloadFromSave();
// Set the plane registration
- this.SimConnect.SetPlaneRegistry(this.SimConnect.Flight?.Aircraft.Registry);
+ this.Simulator.SetAircraftRegistry(this.Simulator.Flight?.Aircraft.Registry);
// Start five second countdown?
- if (this.SimConnect.PrimaryTracking.SlewActive)
+ if (this.Simulator.PrimaryTracking.SlewActive)
{
Debug.WriteLine("Starting 5 second resume timer...");
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSbeepbeepstart.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSbeepbeepstart.wav"));
player.Play();
var secondsToGo = 5;
this.StartTrackingButtonText = "Resuming in 5";
@@ -1111,16 +1111,16 @@ private void StartTracking()
this.StartTrackingButtonText = secondsToGo > 0 ? $"Resuming in {secondsToGo}" : "Resuming now";
}
- this.SimConnect.SetSlew(false);
+ this.Simulator.SetSlew(false);
Thread.Sleep(500);
}
else
{
// Wait a bit to make sure all structs have updated, especially time in sim
- Thread.Sleep(this.SimConnect.SampleRates[Requests.Secondary] + 1000);
+ Thread.Sleep(this.Simulator.SampleRates[Requests.Secondary] + 1000);
}
- this.SimConnect.StartTracking();
+ this.Simulator.StartTracking();
this.StartTrackingCommand.ReportProgress(() => this.StartTrackingCommand.CanExecute = true);
}
}
@@ -1178,7 +1178,7 @@ private void StopTracking()
{
try
{
- this.SimConnect.StopTracking(true);
+ this.Simulator.StopTracking(true);
}
catch (Exception ex)
{
@@ -1195,8 +1195,8 @@ private void StopTracking()
{
try
{
- this.SimConnect.StopTracking(false);
- this.SimConnect.Flight = null;
+ this.Simulator.StopTracking(false);
+ this.Simulator.Flight = null;
this.IsFuelExpanded = false;
this.IsPayloadExpanded = false;
this.WeightAndBalancesVisibility = Visibility.Visible;
@@ -1242,7 +1242,7 @@ private void ToggleFlightPause()
try
{
Debug.WriteLine("Toggling simconnect flight pause");
- this.SimConnect.Pause(!this.SimConnect.IsPaused);
+ this.Simulator.Pause(!this.Simulator.IsPaused);
}
catch (Exception ex)
{
diff --git a/OpenSky.AgentMSFS/Views/Models/LandingReportViewModel.cs b/OpenSky.Agent/Views/Models/LandingReportViewModel.cs
similarity index 95%
rename from OpenSky.AgentMSFS/Views/Models/LandingReportViewModel.cs
rename to OpenSky.Agent/Views/Models/LandingReportViewModel.cs
index 54ae98c..d7a9ab5 100644
--- a/OpenSky.AgentMSFS/Views/Models/LandingReportViewModel.cs
+++ b/OpenSky.Agent/Views/Models/LandingReportViewModel.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using System;
using System.Collections.Generic;
@@ -15,9 +15,8 @@ namespace OpenSky.AgentMSFS.Views.Models
using JetBrains.Annotations;
- using OpenSky.AgentMSFS.MVVM;
- using OpenSky.AgentMSFS.SimConnect;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Simulator.Tools;
using OpenSky.FlightLogXML;
using OpenSkyApi;
@@ -29,7 +28,7 @@ namespace OpenSky.AgentMSFS.Views.Models
///
/// sushi.at, 30/03/2021.
///
- ///
+ ///
/// -------------------------------------------------------------------------------------------------
public class LandingReportViewModel : ViewModel
{
@@ -64,16 +63,16 @@ public class LandingReportViewModel : ViewModel
/// -------------------------------------------------------------------------------------------------
public LandingReportViewModel()
{
- this.FlightNumberHeader = $"Flight #{this.SimConnect.Flight?.FullFlightNumber}\r\nLanding Report";
+ this.FlightNumberHeader = $"Flight #{this.Simulator.Flight?.FullFlightNumber}\r\nLanding Report";
// Fetch the initial already existing landing report(s)
- foreach (var item in this.SimConnect.LandingReports)
+ foreach (var item in this.Simulator.LandingReports)
{
this.landingReports.Add(item);
}
// Subscribe to changes
- this.SimConnect.LandingReports.CollectionChanged += this.LandingReportsCollectionChanged;
+ this.Simulator.LandingReports.CollectionChanged += this.LandingReportsCollectionChanged;
// Create dismiss command and notification timeout thread
this.DismissLandingReportCommand = new Command(this.DismissLandingReport);
@@ -261,14 +260,14 @@ public string LandingGrade
grade = "A";
desc = "Good landing";
- if (landingRateAbs <= 130 && this.SimConnect.PlaneIdentity.EngineType == EngineType.Jet)
+ if (landingRateAbs <= 130 && this.Simulator.AircraftIdentity.EngineType == EngineType.Jet)
{
grade = "A+";
desc = "Perfect landing";
}
}
- if (grade == "A+" && this.SimConnect.PlaneIdentity.EngineType == EngineType.Jet)
+ if (grade == "A+" && this.Simulator.AircraftIdentity.EngineType == EngineType.Jet)
{
grade = "A-";
desc = "Lading too soft";
@@ -370,11 +369,11 @@ public double MaxSideSlipAngle
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the SimConnect instance.
+ /// Gets the simulator instance.
///
/// -------------------------------------------------------------------------------------------------
[NotNull]
- public SimConnect SimConnect => SimConnect.Instance;
+ public Agent.Simulator.Simulator Simulator => Agent.Simulator.Simulator.Instance;
/// -------------------------------------------------------------------------------------------------
///
@@ -423,7 +422,7 @@ private void LandingReportsCollectionChanged(object sender, NotifyCollectionChan
{
// New flight, unsubscribe from further changes
Debug.WriteLine("Landing reports reset in SimConnect class, unsubscribing from events for notification window");
- this.SimConnect.LandingReports.CollectionChanged -= this.LandingReportsCollectionChanged;
+ this.Simulator.LandingReports.CollectionChanged -= this.LandingReportsCollectionChanged;
}
if (e.Action == NotifyCollectionChangedAction.Add)
diff --git a/OpenSky.AgentMSFS/Views/Models/LoginNotificationViewModel.cs b/OpenSky.Agent/Views/Models/LoginNotificationViewModel.cs
similarity index 94%
rename from OpenSky.AgentMSFS/Views/Models/LoginNotificationViewModel.cs
rename to OpenSky.Agent/Views/Models/LoginNotificationViewModel.cs
index 910bfb4..19667b9 100644
--- a/OpenSky.AgentMSFS/Views/Models/LoginNotificationViewModel.cs
+++ b/OpenSky.Agent/Views/Models/LoginNotificationViewModel.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using System;
using System.Diagnostics;
@@ -12,8 +12,8 @@ namespace OpenSky.AgentMSFS.Views.Models
using System.Reflection;
using System.Threading;
- using OpenSky.AgentMSFS.MVVM;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Simulator.Tools;
/// -------------------------------------------------------------------------------------------------
///
@@ -22,7 +22,7 @@ namespace OpenSky.AgentMSFS.Views.Models
///
/// sushi.at, 01/06/2021.
///
- ///
+ ///
/// -------------------------------------------------------------------------------------------------
public class LoginNotificationViewModel : ViewModel
{
@@ -46,7 +46,7 @@ public LoginNotificationViewModel()
this.Timeout = DateTime.Now.AddMilliseconds(60 * 1000);
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSdingdong.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSdingdong.wav"));
player.Play();
this.LoginCommand = new Command(this.Login);
@@ -89,7 +89,7 @@ public void PlaySoundAgain()
this.soundLastPlayed = DateTime.Now;
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSdingdong.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSdingdong.wav"));
player.Play();
}
}
diff --git a/OpenSky.AgentMSFS/Views/Models/NewFlightNotificationViewModel.cs b/OpenSky.Agent/Views/Models/NewFlightNotificationViewModel.cs
similarity index 91%
rename from OpenSky.AgentMSFS/Views/Models/NewFlightNotificationViewModel.cs
rename to OpenSky.Agent/Views/Models/NewFlightNotificationViewModel.cs
index dd02e6b..feea70c 100644
--- a/OpenSky.AgentMSFS/Views/Models/NewFlightNotificationViewModel.cs
+++ b/OpenSky.Agent/Views/Models/NewFlightNotificationViewModel.cs
@@ -1,18 +1,19 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using System;
using System.Media;
using System.Reflection;
using System.Threading;
- using OpenSky.AgentMSFS.MVVM;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Simulator;
+ using OpenSky.Agent.Simulator.Tools;
/// -------------------------------------------------------------------------------------------------
///
@@ -21,7 +22,7 @@ namespace OpenSky.AgentMSFS.Views.Models
///
/// sushi.at, 27/03/2021.
///
- ///
+ ///
/// -------------------------------------------------------------------------------------------------
public class NewFlightNotificationViewModel : ViewModel
{
@@ -50,18 +51,18 @@ public class NewFlightNotificationViewModel : ViewModel
public NewFlightNotificationViewModel()
{
this.Timeout = 60 * 1000;
- this.FlightNumber = $"{SimConnect.SimConnect.Instance.Flight?.FullFlightNumber}";
- this.Airports = $"{SimConnect.SimConnect.Instance.Flight?.Origin.Icao} - {SimConnect.SimConnect.Instance.Flight?.Destination.Icao}";
+ this.FlightNumber = $"{Simulator.Instance.Flight?.FullFlightNumber}";
+ this.Airports = $"{Simulator.Instance.Flight?.Origin.Icao} - {Simulator.Instance.Flight?.Destination.Icao}";
var assembly = Assembly.GetExecutingAssembly();
- var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.AgentMSFS.Resources.OSannouncement.wav"));
+ var player = new SoundPlayer(assembly.GetManifestResourceStream("OpenSky.Agent.Resources.OSannouncement.wav"));
player.Play();
new Thread(
() =>
{
Thread.Sleep(2000);
- SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.ReadyForBoarding, true, SimConnect.SimConnect.Instance.Flight?.FlightNumber.ToString());
+ SpeechSoundPacks.Instance.PlaySpeechEvent(SpeechEvent.ReadyForBoarding, true, Simulator.Instance.Flight?.FlightNumber.ToString());
})
{ Name = "OpenSky.NewFlightNotificationViewModel.SpeechFlightNumber" }.Start();
diff --git a/OpenSky.AgentMSFS/Views/Models/SettingsViewModel.cs b/OpenSky.Agent/Views/Models/SettingsViewModel.cs
similarity index 88%
rename from OpenSky.AgentMSFS/Views/Models/SettingsViewModel.cs
rename to OpenSky.Agent/Views/Models/SettingsViewModel.cs
index c6aaf20..e43f5dc 100644
--- a/OpenSky.AgentMSFS/Views/Models/SettingsViewModel.cs
+++ b/OpenSky.Agent/Views/Models/SettingsViewModel.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using System;
using System.Collections.Generic;
@@ -20,14 +20,20 @@ namespace OpenSky.AgentMSFS.Views.Models
using Microsoft.Win32;
- using OpenSky.AgentMSFS.Controls;
- using OpenSky.AgentMSFS.Controls.Models;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.MVVM;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.Controls;
+ using OpenSky.Agent.Controls.Models;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Properties;
+ using OpenSky.Agent.SimConnectMSFS;
+ using OpenSky.Agent.Simulator;
+ using OpenSky.Agent.Simulator.Models;
+ using OpenSky.Agent.Simulator.Tools;
+ using OpenSky.Agent.Tools;
using OpenSkyApi;
+ using Simulator = Simulator.Simulator;
+
/// -------------------------------------------------------------------------------------------------
///
/// Settings window view model.
@@ -109,6 +115,34 @@ public class SettingsViewModel : ViewModel
/// -------------------------------------------------------------------------------------------------
private uint simulatorPort;
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// True if simConnect MSFS is checked.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ private bool simConnectMSFSChecked;
+
+ /// -------------------------------------------------------------------------------------------------
+ ///
+ /// Gets or sets a value indicating whether simConnect MSFS is checked.
+ ///
+ /// -------------------------------------------------------------------------------------------------
+ public bool SimConnectMSFSChecked
+ {
+ get => this.simConnectMSFSChecked;
+
+ set
+ {
+ if (Equals(this.simConnectMSFSChecked, value))
+ {
+ return;
+ }
+
+ this.simConnectMSFSChecked=value;
+ this.NotifyPropertyChanged();
+ }
+ }
+
/// -------------------------------------------------------------------------------------------------
///
/// Initializes a new instance of the class.
@@ -142,20 +176,26 @@ public SettingsViewModel()
this.SelectedTextToSpeechVoice = speech.Voice.Name;
// Load settings
- Properties.Settings.Default.Reload();
- this.SimulatorHostName = Properties.Settings.Default.SimulatorHostName;
- this.SimulatorPort = Properties.Settings.Default.SimulatorPort;
+ Settings.Default.Reload();
+ this.SimulatorHostName = Settings.Default.SimConnectHostName;
+ this.SimulatorPort = Settings.Default.SimConnectPort;
this.BingMapsKey = UserSessionService.Instance.LinkedAccounts?.BingMapsKey;
this.SimBriefUsername = UserSessionService.Instance.LinkedAccounts?.SimbriefUsername;
- this.SelectedLandingReportNotification = LandingReportNotification.Parse(Properties.Settings.Default.LandingReportNotification);
- if (!string.IsNullOrEmpty(Properties.Settings.Default.SoundPack))
+ this.SelectedLandingReportNotification = LandingReportNotification.Parse(Settings.Default.LandingReportNotification);
+ if (!string.IsNullOrEmpty(Settings.Default.SoundPack))
{
- this.SelectedSoundPack = Properties.Settings.Default.SoundPack;
+ this.SelectedSoundPack = Settings.Default.SoundPack;
}
- if (!string.IsNullOrEmpty(Properties.Settings.Default.TextToSpeechVoice))
+ if (!string.IsNullOrEmpty(Settings.Default.TextToSpeechVoice))
{
- this.SelectedTextToSpeechVoice = Properties.Settings.Default.TextToSpeechVoice;
+ this.SelectedTextToSpeechVoice = Settings.Default.TextToSpeechVoice;
+ }
+
+ var simulatorInterface = Settings.Default.SimulatorInterface;
+ if (SimConnect.SimulatorInterfaceName.Equals(simulatorInterface, StringComparison.InvariantCultureIgnoreCase))
+ {
+ this.SimConnectMSFSChecked = true;
}
// Load profile image
@@ -177,7 +217,7 @@ public SettingsViewModel()
}
else
{
- this.ProfileImage = new BitmapImage(new Uri("pack://application:,,,/OpenSky.AgentMSFS;component/Resources/profile200.png"));
+ this.ProfileImage = new BitmapImage(new Uri("pack://application:,,,/OpenSky.Agent;component/Resources/profile200.png"));
}
// Make sure we are notified if the UserSession service changes user logged in status
@@ -501,7 +541,7 @@ public uint SimulatorPort
/// -------------------------------------------------------------------------------------------------
private void ChangePassword()
{
- Process.Start(Properties.Settings.Default.OpenSkyChangePasswordUrl);
+ Process.Start(Settings.Default.OpenSkyChangePasswordUrl);
}
/// -------------------------------------------------------------------------------------------------
@@ -527,7 +567,7 @@ private void ClearSoundPack()
/// -------------------------------------------------------------------------------------------------
private void LoginOpenSkyUser()
{
- Process.Start(Properties.Settings.Default.OpenSkyTokenUrl);
+ Process.Start(Settings.Default.OpenSkyTokenUrl);
}
/// -------------------------------------------------------------------------------------------------
@@ -542,7 +582,7 @@ private void LogoutOpenSkyUser()
{
try
{
- var result = OpenSkyService.Instance.RevokeTokenAsync(new RevokeToken { Token = this.UserSession.RefreshToken }).Result;
+ var result = AgentOpenSkyService.Instance.RevokeTokenAsync(new RevokeToken { Token = this.UserSession.RefreshToken }).Result;
if (result.IsError)
{
this.LogoutOpenSkyUserCommand.ReportProgress(
@@ -574,7 +614,7 @@ private void LogoutOpenSkyUser()
var wasDirty = this.IsDirty;
this.BingMapsKey = null;
this.SimBriefUsername = null;
- this.ProfileImage = new BitmapImage(new Uri("pack://application:,,,/OpenSky.AgentMSFS;component/Resources/profile200.png"));
+ this.ProfileImage = new BitmapImage(new Uri("pack://application:,,,/OpenSky.Agent;component/Resources/profile200.png"));
this.IsDirty = wasDirty;
});
}
@@ -622,18 +662,41 @@ private void SaveSettings()
// Save local settings
try
{
- Properties.Settings.Default.SimulatorHostName = this.SimulatorHostName;
- Properties.Settings.Default.SimulatorPort = this.SimulatorPort;
- Properties.Settings.Default.LandingReportNotification = this.SelectedLandingReportNotification?.NotificationID ?? 1;
- Properties.Settings.Default.SoundPack = this.SelectedSoundPack;
+ var simulatorWasChanged = false;
+ if (this.SimConnectMSFSChecked)
+ {
+ Settings.Default.SimulatorInterface = SimConnect.SimulatorInterfaceName;
+ if (Simulator.Instance == null || Simulator.Instance.GetType() != typeof(SimConnect))
+ {
+ Simulator.SetSimulatorInstance(new SimConnect(this.SimulatorHostName, this.SimulatorPort, AgentOpenSkyService.Instance));
+ simulatorWasChanged = true;
+ }
+ }
+
+ if (simulatorWasChanged && Simulator.Instance != null)
+ {
+ Simulator.Instance.LandingReported += (_, landingReportNotification) =>
+ {
+ if (landingReportNotification.Equals(LandingReportNotification.Parse(Settings.Default.LandingReportNotification)))
+ {
+ UpdateGUIDelegate showNotification = () => new LandingReport().Show();
+ Application.Current.Dispatcher.BeginInvoke(showNotification);
+ }
+ };
+ }
+
+ Settings.Default.SimConnectHostName = this.SimulatorHostName;
+ Settings.Default.SimConnectPort = this.SimulatorPort;
+ Settings.Default.LandingReportNotification = this.SelectedLandingReportNotification?.NotificationID ?? 1;
+ Settings.Default.SoundPack = this.SelectedSoundPack;
SpeechSoundPacks.Instance.SelectedSoundPack = this.SelectedSoundPack;
- Properties.Settings.Default.TextToSpeechVoice = this.SelectedTextToSpeechVoice;
+ Settings.Default.TextToSpeechVoice = this.SelectedTextToSpeechVoice;
if (!string.IsNullOrEmpty(this.SelectedTextToSpeechVoice))
{
SpeechSoundPacks.Instance.SetSpeechVoice(this.SelectedTextToSpeechVoice);
}
- Properties.Settings.Default.Save();
+ Settings.Default.Save();
this.SaveSettingsCommand.ReportProgress(() => this.IsDirty = false);
}
catch (Exception ex)
@@ -657,7 +720,7 @@ private void SaveSettings()
SimbriefUsername = this.SimBriefUsername
};
- var result = OpenSkyService.Instance.UpdateLinkedAccountsAsync(linkedAccounts).Result;
+ var result = AgentOpenSkyService.Instance.UpdateLinkedAccountsAsync(linkedAccounts).Result;
if (!result.IsError)
{
_ = UserSessionService.Instance.RefreshLinkedAccounts();
@@ -757,7 +820,7 @@ private void UpdateProfileImage()
try
{
- var result = OpenSkyService.Instance.UploadProfileImageAsync(new FileParameter(File.OpenRead(fileName), fileName, fileName.ToLowerInvariant().EndsWith(".png") ? "image/png" : "image/jpeg")).Result;
+ var result = AgentOpenSkyService.Instance.UploadProfileImageAsync(new FileParameter(File.OpenRead(fileName), fileName, fileName.ToLowerInvariant().EndsWith(".png") ? "image/png" : "image/jpeg")).Result;
if (result.IsError)
{
this.UpdateProfileImageCommand.ReportProgress(
@@ -797,7 +860,7 @@ private void UpdateProfileImage()
}
else
{
- this.ProfileImage = new BitmapImage(new Uri("pack://application:,,,/OpenSky.AgentMSFS;component/Resources/profile200.png"));
+ this.ProfileImage = new BitmapImage(new Uri("pack://application:,,,/OpenSky.Agent;component/Resources/profile200.png"));
}
}
}
diff --git a/OpenSky.AgentMSFS/Views/Models/SoundPackTesterViewModel.cs b/OpenSky.Agent/Views/Models/SoundPackTesterViewModel.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Views/Models/SoundPackTesterViewModel.cs
rename to OpenSky.Agent/Views/Models/SoundPackTesterViewModel.cs
index c01f0c4..72d05a5 100644
--- a/OpenSky.AgentMSFS/Views/Models/SoundPackTesterViewModel.cs
+++ b/OpenSky.Agent/Views/Models/SoundPackTesterViewModel.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using System;
using System.Collections.Generic;
@@ -12,9 +12,10 @@ namespace OpenSky.AgentMSFS.Views.Models
using System.Linq;
using System.Speech.Synthesis;
- using OpenSky.AgentMSFS.Controls;
- using OpenSky.AgentMSFS.Controls.Models;
- using OpenSky.AgentMSFS.MVVM;
+ using OpenSky.Agent.Controls;
+ using OpenSky.Agent.Controls.Models;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Simulator;
/// -------------------------------------------------------------------------------------------------
///
@@ -23,7 +24,7 @@ namespace OpenSky.AgentMSFS.Views.Models
///
/// sushi.at, 24/12/2021.
///
- ///
+ ///
/// -------------------------------------------------------------------------------------------------
public class SoundPackTesterViewModel : ViewModel
{
diff --git a/OpenSky.AgentMSFS/Views/Models/StartupViewModel.cs b/OpenSky.Agent/Views/Models/StartupViewModel.cs
similarity index 88%
rename from OpenSky.AgentMSFS/Views/Models/StartupViewModel.cs
rename to OpenSky.Agent/Views/Models/StartupViewModel.cs
index 7410dcf..4cce746 100644
--- a/OpenSky.AgentMSFS/Views/Models/StartupViewModel.cs
+++ b/OpenSky.Agent/Views/Models/StartupViewModel.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using System;
using System.Collections.Generic;
@@ -17,18 +17,18 @@ namespace OpenSky.AgentMSFS.Views.Models
using System.Windows.Media.Imaging;
using DiscordRPC;
-#if DEBUG
using DiscordRPC.Logging;
-#endif
using JetBrains.Annotations;
- using OpenSky.AgentMSFS.Models;
- using OpenSky.AgentMSFS.MVVM;
- using OpenSky.AgentMSFS.SimConnect;
- using OpenSky.AgentMSFS.Tools;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Simulator;
+ using OpenSky.Agent.Simulator.Enums;
+ using OpenSky.Agent.Simulator.Tools;
using OpenSkyApi;
+#if DEBUG
+#endif
/// -------------------------------------------------------------------------------------------------
///
@@ -56,7 +56,7 @@ public class StartupViewModel : ViewModel
private readonly BitmapImage greyIcon =
new(
new Uri(
- @"pack://application:,,,/OpenSky.AgentMSFS;component/Resources/opensky_grey16.ico",
+ @"pack://application:,,,/OpenSky.Agent;component/Resources/opensky_grey16.ico",
UriKind.RelativeOrAbsolute));
/// -------------------------------------------------------------------------------------------------
@@ -68,7 +68,7 @@ public class StartupViewModel : ViewModel
private readonly BitmapImage openSkyIcon =
new(
new Uri(
- @"pack://application:,,,/OpenSky.AgentMSFS;component/Resources/opensky.ico",
+ @"pack://application:,,,/OpenSky.Agent;component/Resources/opensky.ico",
UriKind.RelativeOrAbsolute));
/// -------------------------------------------------------------------------------------------------
@@ -80,7 +80,7 @@ public class StartupViewModel : ViewModel
private readonly BitmapImage pauseIcon =
new(
new Uri(
- @"pack://application:,,,/OpenSky.AgentMSFS;component/Resources/opensky_pause16.ico",
+ @"pack://application:,,,/OpenSky.Agent;component/Resources/opensky_pause16.ico",
UriKind.RelativeOrAbsolute));
/// -------------------------------------------------------------------------------------------------
@@ -92,7 +92,7 @@ public class StartupViewModel : ViewModel
private readonly BitmapImage redIcon =
new(
new Uri(
- @"pack://application:,,,/OpenSky.AgentMSFS;component/Resources/opensky_red16.ico",
+ @"pack://application:,,,/OpenSky.Agent;component/Resources/opensky_red16.ico",
UriKind.RelativeOrAbsolute));
/// -------------------------------------------------------------------------------------------------
@@ -109,7 +109,7 @@ public class StartupViewModel : ViewModel
///
/// -------------------------------------------------------------------------------------------------
[NotNull]
- private string notificationStatusString = "OpenSky is trying to connect to Flight Simulator 2020...";
+ private string notificationStatusString = "OpenSky is trying to connect to the simulator...";
/// -------------------------------------------------------------------------------------------------
///
@@ -166,8 +166,8 @@ public StartupViewModel()
}
Instance = this;
- SimConnect.Instance.PropertyChanged += this.SimConnectPropertyChanged;
- SimConnect.Instance.FlightChanged += this.SimConnectFlightChanged;
+ Agent.Simulator.Simulator.Instance.PropertyChanged += this.SimConnectPropertyChanged;
+ Agent.Simulator.Simulator.Instance.FlightChanged += this.SimConnectFlightChanged;
this.notificationIcon = this.greyIcon;
if (!UserSessionService.Instance.IsUserLoggedIn)
@@ -213,11 +213,11 @@ public StartupViewModel()
this.DiscordRpcClient.SetPresence(new RichPresence
{
State = "Not Connected",
- Details = "Trying to connect to MSFS",
+ Details = "Trying to connect to simulator",
Assets = new Assets
{
LargeImageKey = "openskylogogrey512",
- LargeImageText = "OpenSky Agent for MSFS"
+ LargeImageText = "OpenSky Agent"
}
});
@@ -246,29 +246,29 @@ public StartupViewModel()
{
try
{
- var result = OpenSkyService.Instance.GetFlightAsync().Result;
+ var result = AgentOpenSkyService.Instance.GetFlightAsync().Result;
if (!result.IsError)
{
if (result.Data.Id != Guid.Empty)
{
- if (SimConnect.Instance.Flight == null)
+ if (Agent.Simulator.Simulator.Instance.Flight == null)
{
- SimConnect.Instance.Flight = result.Data;
+ Agent.Simulator.Simulator.Instance.Flight = result.Data;
}
else
{
- if (SimConnect.Instance.Flight.Id != result.Data.Id)
+ if (Agent.Simulator.Simulator.Instance.Flight.Id != result.Data.Id)
{
// Different flight from current one?
- SimConnect.Instance.StopTracking(true);
+ Agent.Simulator.Simulator.Instance.StopTracking(true);
}
}
}
else
{
- if (SimConnect.Instance.Flight != null)
+ if (Agent.Simulator.Simulator.Instance.Flight != null)
{
- SimConnect.Instance.Flight = null;
+ Agent.Simulator.Simulator.Instance.Flight = null;
}
}
}
@@ -283,7 +283,7 @@ public StartupViewModel()
}
}
- SleepScheduler.SleepFor(TimeSpan.FromSeconds(SimConnect.Instance.Flight == null ? 30 : 120));
+ SleepScheduler.SleepFor(TimeSpan.FromSeconds(Agent.Simulator.Simulator.Instance.Flight == null ? 30 : 120));
}
})
{ Name = "OpenSky.StartupViewModel.CheckForFlights" }.Start();
@@ -359,30 +359,30 @@ private void SimConnectFlightChanged(object sender, Flight e)
/// -------------------------------------------------------------------------------------------------
private void SimConnectPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- if (e.PropertyName is nameof(SimConnect.Connected) or nameof(SimConnect.Instance.TrackingStatus) or nameof(SimConnect.Instance.IsPaused) or nameof(SimConnect.Instance.Flight) or nameof(SimConnect.Instance.FlightPhase))
+ if (e.PropertyName is nameof(Agent.Simulator.Simulator.Connected) or nameof(Agent.Simulator.Simulator.Instance.TrackingStatus) or nameof(Agent.Simulator.Simulator.Instance.IsPaused) or nameof(Agent.Simulator.Simulator.Instance.Flight) or nameof(Agent.Simulator.Simulator.Instance.FlightPhase))
{
- if (!SimConnect.Instance.Connected)
+ if (!Agent.Simulator.Simulator.Instance.Connected)
{
this.redFlashing = false;
this.NotificationIcon = this.greyIcon;
- this.NotificationStatusString = "OpenSky is trying to connect to Flight Simulator 2020...";
+ this.NotificationStatusString = "OpenSky is trying to connect to the simulator...";
this.DiscordRpcClient.SetPresence(new RichPresence
{
State = "Not Connected",
- Details = "Trying to connect to MSFS",
+ Details = "Trying to connect to simulator",
Assets = new Assets
{
LargeImageKey = "openskylogogrey512",
- LargeImageText = "OpenSky Agent for MSFS"
+ LargeImageText = "OpenSky Agent"
}
});
}
else
{
- if (SimConnect.Instance.TrackingStatus is TrackingStatus.NotTracking or TrackingStatus.Preparing or TrackingStatus.Resuming)
+ if (Agent.Simulator.Simulator.Instance.TrackingStatus is TrackingStatus.NotTracking or TrackingStatus.Preparing or TrackingStatus.Resuming)
{
- if (SimConnect.Instance.Flight == null)
+ if (Agent.Simulator.Simulator.Instance.Flight == null)
{
this.redFlashing = false;
this.NotificationIcon = this.openSkyIcon;
@@ -395,7 +395,7 @@ private void SimConnectPropertyChanged(object sender, PropertyChangedEventArgs e
Assets = new Assets
{
LargeImageKey = "openskylogo512",
- LargeImageText = "OpenSky Agent for MSFS"
+ LargeImageText = "OpenSky Agent"
}
});
}
@@ -403,34 +403,34 @@ private void SimConnectPropertyChanged(object sender, PropertyChangedEventArgs e
{
this.redFlashing = false;
this.NotificationIcon = this.openSkyIcon;
- this.NotificationStatusString = $"OpenSky is preparing to track flight {SimConnect.Instance.Flight?.FullFlightNumber}";
+ this.NotificationStatusString = $"OpenSky is preparing to track flight {Agent.Simulator.Simulator.Instance.Flight?.FullFlightNumber}";
this.DiscordRpcClient.SetPresence(new RichPresence
{
- State = SimConnect.Instance.TrackingStatus.ToString(),
- Details = $"Preparing flight {SimConnect.Instance.Flight?.FullFlightNumber}",
+ State = Agent.Simulator.Simulator.Instance.TrackingStatus.ToString(),
+ Details = $"Preparing flight {Agent.Simulator.Simulator.Instance.Flight?.FullFlightNumber}",
Assets = new Assets
{
LargeImageKey = "openskylogo512",
- LargeImageText = "OpenSky Agent for MSFS"
+ LargeImageText = "OpenSky Agent"
}
});
}
}
- else if (SimConnect.Instance.IsPaused)
+ else if (Agent.Simulator.Simulator.Instance.IsPaused)
{
this.redFlashing = false;
this.NotificationIcon = this.pauseIcon;
- this.NotificationStatusString = $"OpenSky tracking and your flight {SimConnect.Instance.Flight?.FullFlightNumber} are paused";
+ this.NotificationStatusString = $"OpenSky tracking and your flight {Agent.Simulator.Simulator.Instance.Flight?.FullFlightNumber} are paused";
this.DiscordRpcClient.SetPresence(new RichPresence
{
- State = $"Paused, {SimConnect.Instance.FlightPhase}",
- Details = $"Tracking flight {SimConnect.Instance.Flight?.FullFlightNumber}",
+ State = $"Paused, {Agent.Simulator.Simulator.Instance.FlightPhase}",
+ Details = $"Tracking flight {Agent.Simulator.Simulator.Instance.Flight?.FullFlightNumber}",
Assets = new Assets
{
LargeImageKey = "openskylogo512",
- LargeImageText = "OpenSky Agent for MSFS",
+ LargeImageText = "OpenSky Agent",
SmallImageKey = "pause512",
SmallImageText = "Paused"
}
@@ -440,16 +440,16 @@ private void SimConnectPropertyChanged(object sender, PropertyChangedEventArgs e
{
this.NotificationIcon = this.redIcon;
this.redFlashing = true;
- this.NotificationStatusString = $"OpenSky is tracking your flight {SimConnect.Instance.Flight?.FullFlightNumber}";
+ this.NotificationStatusString = $"OpenSky is tracking your flight {Agent.Simulator.Simulator.Instance.Flight?.FullFlightNumber}";
this.DiscordRpcClient.SetPresence(new RichPresence
{
- State = $"Recording, {SimConnect.Instance.FlightPhase}",
- Details = $"Tracking flight {SimConnect.Instance.Flight?.FullFlightNumber}",
+ State = $"Recording, {Agent.Simulator.Simulator.Instance.FlightPhase}",
+ Details = $"Tracking flight {Agent.Simulator.Simulator.Instance.Flight?.FullFlightNumber}",
Assets = new Assets
{
LargeImageKey = "openskylogo512",
- LargeImageText = "OpenSky Agent for MSFS",
+ LargeImageText = "OpenSky Agent",
SmallImageKey = "record512",
SmallImageText = "Recording"
}
@@ -699,7 +699,7 @@ private void Quit()
{
UpdateGUIDelegate cleanUp = () =>
{
- SimConnect.Instance.Close();
+ Agent.Simulator.Simulator.Instance.Close();
SleepScheduler.Shutdown();
this.NotificationVisibility = Visibility.Collapsed;
this.DiscordRpcClient.Dispose();
diff --git a/OpenSky.AgentMSFS/Views/Models/TrackingDebugViewModel.cs b/OpenSky.Agent/Views/Models/TrackingDebugViewModel.cs
similarity index 78%
rename from OpenSky.AgentMSFS/Views/Models/TrackingDebugViewModel.cs
rename to OpenSky.Agent/Views/Models/TrackingDebugViewModel.cs
index 3a8dcb1..5a78f7b 100644
--- a/OpenSky.AgentMSFS/Views/Models/TrackingDebugViewModel.cs
+++ b/OpenSky.Agent/Views/Models/TrackingDebugViewModel.cs
@@ -1,15 +1,15 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views.Models
+namespace OpenSky.Agent.Views.Models
{
using JetBrains.Annotations;
- using OpenSky.AgentMSFS.MVVM;
- using OpenSky.AgentMSFS.SimConnect;
+ using OpenSky.Agent.MVVM;
+ using OpenSky.Agent.Simulator;
/// -------------------------------------------------------------------------------------------------
///
@@ -18,16 +18,16 @@ namespace OpenSky.AgentMSFS.Views.Models
///
/// sushi.at, 13/03/2021.
///
- ///
+ ///
/// -------------------------------------------------------------------------------------------------
public class TrackingDebugViewModel : ViewModel
{
/// -------------------------------------------------------------------------------------------------
///
- /// Gets the SimConnect instance.
+ /// Gets the simulator instance.
///
/// -------------------------------------------------------------------------------------------------
[NotNull]
- public SimConnect SimConnect => SimConnect.Instance;
+ public Simulator Simulator => Simulator.Instance;
}
}
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/Views/NewFlightNotification.xaml b/OpenSky.Agent/Views/NewFlightNotification.xaml
similarity index 95%
rename from OpenSky.AgentMSFS/Views/NewFlightNotification.xaml
rename to OpenSky.Agent/Views/NewFlightNotification.xaml
index 4a11aa3..b51b7c7 100644
--- a/OpenSky.AgentMSFS/Views/NewFlightNotification.xaml
+++ b/OpenSky.Agent/Views/NewFlightNotification.xaml
@@ -1,7 +1,7 @@
-
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views
+namespace OpenSky.Agent.Views
{
using System;
using System.Windows;
- using OpenSky.AgentMSFS.Tools;
- using OpenSky.AgentMSFS.Views.Models;
+ using OpenSky.Agent.Simulator.Tools;
+ using OpenSky.Agent.Tools;
+ using OpenSky.Agent.Views.Models;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Views/Settings.xaml b/OpenSky.Agent/Views/Settings.xaml
similarity index 96%
rename from OpenSky.AgentMSFS/Views/Settings.xaml
rename to OpenSky.Agent/Views/Settings.xaml
index 38600ea..3f9a495 100644
--- a/OpenSky.AgentMSFS/Views/Settings.xaml
+++ b/OpenSky.Agent/Views/Settings.xaml
@@ -1,7 +1,7 @@
-
@@ -123,7 +123,7 @@
- Microsoft Flight Simulator
+ Microsoft Flight Simulator (SimConnect)
diff --git a/OpenSky.AgentMSFS/Views/Settings.xaml.cs b/OpenSky.Agent/Views/Settings.xaml.cs
similarity index 98%
rename from OpenSky.AgentMSFS/Views/Settings.xaml.cs
rename to OpenSky.Agent/Views/Settings.xaml.cs
index 31df518..af54ab9 100644
--- a/OpenSky.AgentMSFS/Views/Settings.xaml.cs
+++ b/OpenSky.Agent/Views/Settings.xaml.cs
@@ -1,17 +1,17 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views
+namespace OpenSky.Agent.Views
{
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using System.Windows.Navigation;
- using OpenSky.AgentMSFS.Views.Models;
+ using OpenSky.Agent.Views.Models;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Views/SoundPackTester.xaml b/OpenSky.Agent/Views/SoundPackTester.xaml
similarity index 87%
rename from OpenSky.AgentMSFS/Views/SoundPackTester.xaml
rename to OpenSky.Agent/Views/SoundPackTester.xaml
index f3ec959..40e25e4 100644
--- a/OpenSky.AgentMSFS/Views/SoundPackTester.xaml
+++ b/OpenSky.Agent/Views/SoundPackTester.xaml
@@ -1,7 +1,7 @@
-
@@ -43,7 +43,7 @@
-
+
diff --git a/OpenSky.AgentMSFS/Views/SoundPackTester.xaml.cs b/OpenSky.Agent/Views/SoundPackTester.xaml.cs
similarity index 96%
rename from OpenSky.AgentMSFS/Views/SoundPackTester.xaml.cs
rename to OpenSky.Agent/Views/SoundPackTester.xaml.cs
index a5f99f4..f046aea 100644
--- a/OpenSky.AgentMSFS/Views/SoundPackTester.xaml.cs
+++ b/OpenSky.Agent/Views/SoundPackTester.xaml.cs
@@ -1,14 +1,14 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views
+namespace OpenSky.Agent.Views
{
using System.Windows;
- using OpenSky.AgentMSFS.Views.Models;
+ using OpenSky.Agent.Views.Models;
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.AgentMSFS/Views/Startup.xaml b/OpenSky.Agent/Views/Startup.xaml
similarity index 95%
rename from OpenSky.AgentMSFS/Views/Startup.xaml
rename to OpenSky.Agent/Views/Startup.xaml
index 4c0a27a..71759ee 100644
--- a/OpenSky.AgentMSFS/Views/Startup.xaml
+++ b/OpenSky.Agent/Views/Startup.xaml
@@ -1,7 +1,7 @@
-
@@ -84,7 +84,7 @@
- OPENSKYAgent for Microsoft Flight Simulator 2020
+ OPENSKYFlight Tracking Agent
www.opensky.to
diff --git a/OpenSky.AgentMSFS/Views/Startup.xaml.cs b/OpenSky.Agent/Views/Startup.xaml.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Views/Startup.xaml.cs
rename to OpenSky.Agent/Views/Startup.xaml.cs
index 5e7e32e..0bc7dfd 100644
--- a/OpenSky.AgentMSFS/Views/Startup.xaml.cs
+++ b/OpenSky.Agent/Views/Startup.xaml.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views
+namespace OpenSky.Agent.Views
{
using System;
diff --git a/OpenSky.AgentMSFS/Views/TrackingDebug.xaml b/OpenSky.Agent/Views/TrackingDebug.xaml
similarity index 62%
rename from OpenSky.AgentMSFS/Views/TrackingDebug.xaml
rename to OpenSky.Agent/Views/TrackingDebug.xaml
index c73fb6d..7100a33 100644
--- a/OpenSky.AgentMSFS/Views/TrackingDebug.xaml
+++ b/OpenSky.Agent/Views/TrackingDebug.xaml
@@ -1,7 +1,7 @@
-
@@ -92,21 +92,21 @@
Stall?
Overspeed?
G-force
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Plane Systems
Beacon light?
@@ -128,25 +128,25 @@
Parking brake?
Spoilers armed?
APU Generator
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Tracking Status
Connected to sim?
@@ -166,23 +166,23 @@
Tracking duration
Time warp used?
Paused (time)?
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Realism
@@ -190,10 +190,10 @@
Unlimited fuel?
Slew active?
Crash sequence?
-
-
-
-
+
+
+
+
Plane Identifiers
Plane type
@@ -206,16 +206,16 @@
Gear retractable?
ATC type
ATC model
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
Fuel tanks
Center
@@ -230,93 +230,93 @@
External1
External2
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
Payload Stations [1-10]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Payload Stations [11-20]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Weight and Balance
@@ -329,24 +329,24 @@
CG aft limit
CG lateral
Fuel weight / gallon
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
Landing Analysis
Sample rate
@@ -358,14 +358,14 @@
Speed longitudinal
G-force
Landing rate
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/OpenSky.AgentMSFS/Views/TrackingDebug.xaml.cs b/OpenSky.Agent/Views/TrackingDebug.xaml.cs
similarity index 97%
rename from OpenSky.AgentMSFS/Views/TrackingDebug.xaml.cs
rename to OpenSky.Agent/Views/TrackingDebug.xaml.cs
index f4b1455..addba6f 100644
--- a/OpenSky.AgentMSFS/Views/TrackingDebug.xaml.cs
+++ b/OpenSky.Agent/Views/TrackingDebug.xaml.cs
@@ -1,10 +1,10 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// OpenSky project 2021
+// OpenSky project 2021-2022
//
// --------------------------------------------------------------------------------------------------------------------
-namespace OpenSky.AgentMSFS.Views
+namespace OpenSky.Agent.Views
{
/// -------------------------------------------------------------------------------------------------
///
diff --git a/OpenSky.Agent/app.config b/OpenSky.Agent/app.config
new file mode 100644
index 0000000..05f35e9
--- /dev/null
+++ b/OpenSky.Agent/app.config
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+
+
+ localhost
+
+
+ 500
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SimConnectMSFS
+
+
+
+
+
+
+ http://localhost:5001/apptoken/0932018B-FB9C-4B59-B898-C4244EAC6D0B
+
+
+ http://localhost:5000
+
+
+ https://api.github.com/repos/opensky-to/agent/releases/latest
+
+
+ http://localhost:5001/changepassword
+
+
+
+
\ No newline at end of file
diff --git a/OpenSky.AgentMSFS/pre-build.bat b/OpenSky.Agent/pre-build.bat
similarity index 100%
rename from OpenSky.AgentMSFS/pre-build.bat
rename to OpenSky.Agent/pre-build.bat
diff --git a/OpenSky.AgentMSFS/SimConnect/Enums/TimeOfDay.cs b/OpenSky.AgentMSFS/SimConnect/Enums/TimeOfDay.cs
deleted file mode 100644
index 2e76092..0000000
--- a/OpenSky.AgentMSFS/SimConnect/Enums/TimeOfDay.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-//
-// OpenSky project 2021
-//
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace OpenSky.AgentMSFS.SimConnect.Enums
-{
- /// -------------------------------------------------------------------------------------------------
- ///
- /// SimConnect time of day enum.
- ///
- ///
- /// sushi.at, 14/03/2021.
- ///
- /// -------------------------------------------------------------------------------------------------
- public enum TimeOfDay
- {
- ///
- /// Unknown.
- ///
- Unknown = 0,
-
- ///
- /// Day.
- ///
- Day = 1,
-
- ///
- /// Dusk/Dawn.
- ///
- DuskDawn = 2,
-
- ///
- /// Night.
- ///
- Night = 3
- }
-}
\ No newline at end of file
diff --git a/README.md b/README.md
index f85b04c..0579425 100644
--- a/README.md
+++ b/README.md
@@ -10,9 +10,9 @@
OpenSky is an open-source airline management simulation currently in development. We are actively seeking aviation enthusiast whom would love to be part of this upcoming project and shape it with us! If you have experience in coding, graphical or game design and feel like you could be an asset to the project, please head over to the [contribute page](https://www.opensky.to/contribute) and do not hesitate to jump into our [Discord](https://discord.com/invite/eR3yePrj79) and say hello! We would love to hear your ideas and feedback and are actively collecting them in our [forums](https://forum.opensky.to/)!
-## OpenSky Agent for Microsoft Flight Simulator 2020
+## OpenSky Agent
-This repository contains the C# code for our MSFS flight tracking agent. This part of the project is luckily already pretty mature but if you have a brilliant new feature that
+This repository contains the C# code for our Windows flight tracking agent. It currently supports MSFS via SimConnect but is designed so that other simulators can be added in the future. This part of the project is luckily already pretty mature but if you have a brilliant new feature that
you want to see added, let us know or better open a pull request and help us develop this amazing project further.
## Screenshots
diff --git a/changelog.txt b/changelog.txt
index 7328f38..851b94e 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -2,6 +2,12 @@
OpenSky Agent for MSFS Changelog
======================================================================================
+--------------------------------------------------------------------------------------
+Version 0.4.0 (ALPHA4)
+--------------------------------------------------------------------------------------
+- Common simulator interface code extracted and separated from SimConnect code
+- Minor bug fixes and improvements
+
--------------------------------------------------------------------------------------
Version 0.3.7 (ALPHA3)
--------------------------------------------------------------------------------------