├── KA-panel ├── example.png ├── example2.png ├── example3.png ├── kinetic-ingamepanel │ ├── Build │ │ ├── icon.png │ │ ├── _Temp │ │ │ ├── _timestamps │ │ │ │ └── Output_0 │ │ │ │ │ └── kinetic-ingamepanel │ │ │ │ │ ├── kinetic-ingamepanel.xml │ │ │ │ │ └── kinetic-ingamepanel_output.xml │ │ │ ├── _TimeStampID.xml │ │ │ └── _metadata │ │ │ │ └── kinetic-ingamepanel │ │ │ │ └── kinetic-ingamepanel.xml │ │ ├── kinetic-ingamepanel.xml │ │ ├── PackageSources │ │ │ └── kinetic-ingamepanel.xml │ │ └── PackageDefinitions │ │ │ └── kinetic-ingamepanel.xml │ ├── InGamePanels │ │ └── kinetic-ingamepanel.spb │ ├── manifest.json │ ├── layout.json │ └── html_ui │ │ ├── InGamePanels │ │ └── KineticPanel │ │ │ ├── KineticPanel.css │ │ │ ├── KineticPanel.html │ │ │ └── KineticPanel.js │ │ └── Textures │ │ └── Menu │ │ └── toolbar │ │ └── ICON_TOOLBAR_MAXIMUS_CUSTOM_PANEL.svg ├── build.bat └── README.md ├── MSFS Kinetic Assistant ├── MEDIA │ ├── wp.png │ ├── csv.png │ ├── ctrl.png │ ├── map.png │ ├── push.png │ ├── tow.bmp │ ├── true.wav │ ├── close.png │ ├── ctrl1.png │ ├── ctrl2.png │ ├── error.wav │ ├── false.wav │ ├── glider.bmp │ ├── pinned.png │ ├── solid.png │ ├── arrestor.bmp │ ├── launchpad.bmp │ ├── minimize.png │ ├── settings.bmp │ ├── unpinned.png │ ├── winchIcon.png │ ├── RadarCover.png │ ├── gliderIcon.png │ └── transparent.png ├── logo-l.ico ├── touchcloud-icon-l.ico ├── kinetic-panel │ ├── InGamePanels │ │ └── ka-panel.spb │ ├── manifest.json │ ├── layout.json │ └── html_ui │ │ ├── InGamePanels │ │ └── ka-panel │ │ │ ├── kaPanel.html │ │ │ ├── kaPanel.css │ │ │ └── kaPanel.js │ │ └── Textures │ │ └── Menu │ │ └── toolbar │ │ └── KA_ICON.svg ├── packages │ └── SimConnect SDK │ │ └── lib │ │ ├── SimConnect.dll │ │ └── managed │ │ └── Microsoft.FlightSimulator.SimConnect.dll ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.resx │ └── Resources.Designer.cs ├── App.xaml.cs ├── SimvarsViewModel.cs ├── App.xaml ├── simVars.cs ├── App.config ├── packages.config ├── Requests.cs ├── PlaneInfoResponse.cs ├── MathClass.cs ├── MSFS Kinetic Assistant.csproj ├── Server.cs ├── RadarClass.cs └── Tracking.cs ├── packages └── CTrue.FsConnect.1.0.3 │ ├── .signature.p7s │ ├── build │ ├── simconnect.dll │ └── CTrue.FsConnect.targets │ ├── CTrue.FsConnect.1.0.3.nupkg │ ├── lib │ └── net40 │ │ ├── CTrue.FsConnect.dll │ │ ├── CTrue.FsConnect.pdb │ │ ├── Microsoft.FlightSimulator.SimConnect.dll │ │ └── CTrue.FsConnect.xml │ └── LICENSE.txt ├── LICENSE ├── MSFS Kinetic Assistant.sln └── .gitignore /KA-panel/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/KA-panel/example.png -------------------------------------------------------------------------------- /KA-panel/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/KA-panel/example2.png -------------------------------------------------------------------------------- /KA-panel/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/KA-panel/example3.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/wp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/wp.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/logo-l.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/logo-l.ico -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/csv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/csv.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/ctrl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/ctrl.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/map.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/push.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/push.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/tow.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/tow.bmp -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/true.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/true.wav -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/close.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/ctrl1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/ctrl1.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/ctrl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/ctrl2.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/error.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/error.wav -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/false.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/false.wav -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/glider.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/glider.bmp -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/pinned.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/pinned.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/solid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/solid.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/arrestor.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/arrestor.bmp -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/launchpad.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/launchpad.bmp -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/minimize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/minimize.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/settings.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/settings.bmp -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/unpinned.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/unpinned.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/winchIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/winchIcon.png -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/Build/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/KA-panel/kinetic-ingamepanel/Build/icon.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/RadarCover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/RadarCover.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/gliderIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/gliderIcon.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MEDIA/transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/MEDIA/transparent.png -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/touchcloud-icon-l.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/touchcloud-icon-l.ico -------------------------------------------------------------------------------- /packages/CTrue.FsConnect.1.0.3/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/packages/CTrue.FsConnect.1.0.3/.signature.p7s -------------------------------------------------------------------------------- /packages/CTrue.FsConnect.1.0.3/build/simconnect.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/packages/CTrue.FsConnect.1.0.3/build/simconnect.dll -------------------------------------------------------------------------------- /packages/CTrue.FsConnect.1.0.3/CTrue.FsConnect.1.0.3.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/packages/CTrue.FsConnect.1.0.3/CTrue.FsConnect.1.0.3.nupkg -------------------------------------------------------------------------------- /packages/CTrue.FsConnect.1.0.3/lib/net40/CTrue.FsConnect.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/packages/CTrue.FsConnect.1.0.3/lib/net40/CTrue.FsConnect.dll -------------------------------------------------------------------------------- /packages/CTrue.FsConnect.1.0.3/lib/net40/CTrue.FsConnect.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/packages/CTrue.FsConnect.1.0.3/lib/net40/CTrue.FsConnect.pdb -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/kinetic-panel/InGamePanels/ka-panel.spb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/kinetic-panel/InGamePanels/ka-panel.spb -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/InGamePanels/kinetic-ingamepanel.spb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/KA-panel/kinetic-ingamepanel/InGamePanels/kinetic-ingamepanel.spb -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/packages/SimConnect SDK/lib/SimConnect.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/packages/SimConnect SDK/lib/SimConnect.dll -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/Build/_Temp/_timestamps/Output_0/kinetic-ingamepanel/kinetic-ingamepanel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/CTrue.FsConnect.1.0.3/lib/net40/Microsoft.FlightSimulator.SimConnect.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/packages/CTrue.FsConnect.1.0.3/lib/net40/Microsoft.FlightSimulator.SimConnect.dll -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/Build/_Temp/_TimeStampID.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /KA-panel/build.bat: -------------------------------------------------------------------------------- 1 | 2 | "%MSFS_SDK%\Tools\bin\fspackagetool.exe" "kinetic-ingamepanel\Build\kinetic-ingamepanel.xml" -nomirroring 3 | copy /Y "kinetic-ingamepanel\Build\Packages\kinetic-ingamepanel\Build\kinetic-ingamepanel.spb" "kinetic-ingamepanel\InGamePanels" -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/packages/SimConnect SDK/lib/managed/Microsoft.FlightSimulator.SimConnect.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thealx-eech/msfsKineticAssistant/HEAD/MSFS Kinetic Assistant/packages/SimConnect SDK/lib/managed/Microsoft.FlightSimulator.SimConnect.dll -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/Build/_Temp/_metadata/kinetic-ingamepanel/kinetic-ingamepanel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace MSFS_Kinetic_Assistant 4 | { 5 | /// 6 | /// Interaction logic for App.xaml 7 | /// 8 | public partial class App : Application 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/SimvarsViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace MSFS_Kinetic_Assistant 2 | { 3 | public class SimvarsViewModel 4 | { 5 | public string[] aSimvarNames 6 | { 7 | get { return SimVars.Names; } 8 | private set { } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/Build/kinetic-ingamepanel.xml: -------------------------------------------------------------------------------- 1 | 2 | . 3 | _Temp 4 | 5 | PackageDefinitions\kinetic-ingamepanel.xml 6 | 7 | -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/Build/_Temp/_timestamps/Output_0/kinetic-ingamepanel/kinetic-ingamepanel_output.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/CTrue.FsConnect.1.0.3/build/CTrue.FsConnect.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %(FileName)%(Extension) 6 | PreserveNewest 7 | 8 | 9 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/Build/PackageSources/kinetic-ingamepanel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | InGamePanel_KineticPanel.spb 4 | 5 | 6 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/simVars.cs: -------------------------------------------------------------------------------- 1 | namespace MSFS_Kinetic_Assistant 2 | { 3 | class SimVars 4 | { 5 | static public readonly string[] Names = new string[] 6 | { 7 | "- Control not set -", 8 | "LIGHT PANEL", 9 | "LIGHT STROBE", 10 | "LIGHT LANDING", 11 | "LIGHT TAXI", 12 | "LIGHT BEACON", 13 | "LIGHT NAV", 14 | "LIGHT LOGO", 15 | "LIGHT WING", 16 | "LIGHT RECOGNITION", 17 | "LIGHT CABIN", 18 | "LIGHT GLARESHIELD", 19 | "LIGHT PEDESTRAL", 20 | "LIGHT POTENTIOMETER", 21 | }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": [ 3 | { 4 | "name": "fs-base-propdefs", 5 | "package_version": "0.1.2" 6 | }, 7 | { 8 | "name": "fs-base-ui", 9 | "package_version": "0.1.10" 10 | }, 11 | { 12 | "name": "asobo-vcockpits-core", 13 | "package_version": "0.1.12" 14 | } 15 | ], 16 | "content_type": "", 17 | "title": "Kinetic Panel", 18 | "manufacturer": "TouchingCloud", 19 | "creator": "Maximus", 20 | "package_version": "2.0.0", 21 | "minimum_game_version": "1.8.3", 22 | "release_notes": { 23 | "neutral": { 24 | "LastUpdate": "", 25 | "OlderHistory": "" 26 | } 27 | }, 28 | "total_package_size": "00000000000000014353" 29 | } -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/Build/PackageDefinitions/kinetic-ingamepanel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | SPB 4 | kinetic-ingamepanel 5 | Maximus 6 | Maximus 7 | 8 | 9 | false 10 | false 11 | 12 | 13 | 14 | SPB 15 | 16 | false 17 | 18 | PackageSources\ 19 | Build\ 20 | 21 | 22 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/kinetic-panel/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": [ 3 | { 4 | "name": "fs-base-propdefs", 5 | "package_version": "0.1.2" 6 | }, 7 | { 8 | "name": "fs-base-ui", 9 | "package_version": "0.1.10" 10 | }, 11 | { 12 | "name": "asobo-vcockpits-core", 13 | "package_version": "0.1.12" 14 | } 15 | ], 16 | "content_type": "", 17 | "title": "KineticAssistant/ALBATROSS panel", 18 | "manufacturer": "TouchingCLoud", 19 | "creator": "Maximus", 20 | "package_version": "2.0.0", 21 | "minimum_game_version": "1.8.3", 22 | "release_notes": { 23 | "neutral": { 24 | "LastUpdate": "", 25 | "OlderHistory": "" 26 | } 27 | }, 28 | "total_package_size": "00000000000000014353" 29 | } -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/kinetic-panel/layout.json: -------------------------------------------------------------------------------- 1 | { 2 | "content": [ 3 | { 4 | "path": "InGamePanels/ka-panel.spb", 5 | "size": 633, 6 | "date": 132640886295137633 7 | }, 8 | { 9 | "path": "html_ui/InGamePanels/ka-panel/kaPanel.css", 10 | "size": 5142, 11 | "date": 132640831513619973 12 | }, 13 | { 14 | "path": "html_ui/InGamePanels/ka-panel/kaPanel.html", 15 | "size": 1711, 16 | "date": 132640832760868563 17 | }, 18 | { 19 | "path": "html_ui/InGamePanels/ka-panel/kaPanel.js", 20 | "size": 9226, 21 | "date": 132640832761008615 22 | }, 23 | { 24 | "path": "html_ui/Textures/Menu/toolbar/KA_ICON.svg", 25 | "size": 2641, 26 | "date": 132547798550000000 27 | } 28 | ] 29 | } -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/layout.json: -------------------------------------------------------------------------------- 1 | { 2 | "content": [ 3 | { 4 | "path": "html_ui/InGamePanels/KineticPanel/KineticPanel.css", 5 | "size": 1009, 6 | "date": 132441482909180874 7 | }, 8 | { 9 | "path": "html_ui/InGamePanels/KineticPanel/KineticPanel.html", 10 | "size": 3119, 11 | "date": 132440507097241168 12 | }, 13 | { 14 | "path": "html_ui/InGamePanels/KineticPanel/KineticPanel.js", 15 | "size": 5517, 16 | "date": 132442481411972180 17 | }, 18 | { 19 | "path": "html_ui/Textures/Menu/toolbar/ICON_TOOLBAR_MAXIMUS_CUSTOM_PANEL.svg", 20 | "size": 702, 21 | "date": 132401952992678246 22 | }, 23 | { 24 | "path": "InGamePanels/kinetic-ingamepanel.spb", 25 | "size": 806, 26 | "date": 132453435271410222 27 | } 28 | ] 29 | } -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Alex Marko 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MSFS_Kinetic_Assistant.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/CTrue.FsConnect.1.0.3/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2020 C-True 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | This software contains redistributed binaries, "simconnect.dll" and "Microsoft.FlightSimulator.SimConnect.dll" as released by the Flight Simulator 2020 Software Development Kit, that are the copyright of Microsoft. -------------------------------------------------------------------------------- /KA-panel/README.md: -------------------------------------------------------------------------------- 1 | # msfs2020-toolbar-window-template 2 | Microsoft FlightSimulator 2020 Toolbar Extra Window Template, this example loads UI window with ipify.org website SINCE SKYVECTOR is now blocking their website being loaded from iframe “X-Frame-Options“ = “SAMEORIGIN“. 3 | 4 | 5 | To build the SPB if you have changed UI panel template definition run `build.bat` or manually 6 | 7 | `SDK\Tools\bin\fspackagetool.exe kinetic-ingamepanel\Build\kinetic-ingamepanel.xml -nomirroring` 8 | 9 | It will generate the SPB at `kinetic-ingamepanel\Build\Packages\kinetic-ingamepanel\Build` copy the SPB to `kinetic-ingamepanel\InGamePanels`. 10 | 11 | Copy the package to community folder BUT DO NOT COPY the `kinetic-ingamepanel\Build` directory. 12 | 13 | ## Screenshots 14 | 15 | ![example](example.png) 16 | ![example2](example2.png) 17 | ![example3](example3.png) 18 | 19 | # 20 | ## Please, if you like the source/my addons, consider making a donation to support me/keep development of this and new addons, any amount is welcome. I will buy MSFS2020 from steam since my current version is from a limited game pass access which will be ended. Thank you. 21 |
22 |
23 |
24 | 25 | [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LZH27QQ2ST64N) 26 | 27 |
28 |
29 |
30 |
-------------------------------------------------------------------------------- /MSFS Kinetic Assistant/Requests.cs: -------------------------------------------------------------------------------- 1 | namespace MSFS_Kinetic_Assistant 2 | { 3 | public enum Requests 4 | { 5 | PlaneInfo = 0, 6 | PlaneCommit = 1, 7 | PlaneRotationVelocity = 2, 8 | NearbyObjects = 3, 9 | TowPlane = 4, 10 | Airport = 5, 11 | SystemEvents = 6, 12 | TowPlaneCommit = 7, 13 | PlaneEngineData = 8, 14 | Paused = 9, 15 | Unpaused = 10, 16 | PositionChanged = 11, 17 | SimStart = 12, 18 | SimStop = 13, 19 | WeatherData = 14, 20 | PlaneAvionics = 15, 21 | PlaneLift = 16, 22 | GhostCommit = 17, 23 | PlaneRotateAccel = 18, 24 | ThermalVelocityCommit = 19, 25 | FoldingWindCommit = 20, 26 | RotationVelocityZCommit = 21, 27 | } 28 | 29 | public enum Definitions 30 | { 31 | PlaneInfo = 0, 32 | PlaneCommit = 1, 33 | PlaneRotationVelocity = 2, 34 | NearbyObjects = 3, 35 | TowPlane = 4, 36 | Airport = 5, 37 | SystemEvents = 6, 38 | TowPlaneCommit = 7, 39 | PlaneEngineData = 8, 40 | Paused = 9, 41 | Unpaused = 10, 42 | PositionChanged = 11, 43 | SimStart = 12, 44 | SimStop = 13, 45 | WeatherData = 14, 46 | PlaneAvionics = 15, 47 | PlaneLift = 16, 48 | GhostCommit = 17, 49 | PlaneRotateAccel = 18, 50 | ThermalVelocityCommit = 19, 51 | FoldingWindCommit = 20, 52 | RotationVelocityZCommit = 21, 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30413.136 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSFS Kinetic Assistant", "MSFS Kinetic Assistant\MSFS Kinetic Assistant.csproj", "{69E1DCFD-A320-4266-ABFE-29CCAE4BDAB3}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Release|Any CPU = Release|Any CPU 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {69E1DCFD-A320-4266-ABFE-29CCAE4BDAB3}.Debug|Any CPU.ActiveCfg = Debug|x64 17 | {69E1DCFD-A320-4266-ABFE-29CCAE4BDAB3}.Debug|Any CPU.Build.0 = Debug|x64 18 | {69E1DCFD-A320-4266-ABFE-29CCAE4BDAB3}.Debug|x64.ActiveCfg = Debug|x64 19 | {69E1DCFD-A320-4266-ABFE-29CCAE4BDAB3}.Debug|x64.Build.0 = Debug|x64 20 | {69E1DCFD-A320-4266-ABFE-29CCAE4BDAB3}.Release|Any CPU.ActiveCfg = Release|x64 21 | {69E1DCFD-A320-4266-ABFE-29CCAE4BDAB3}.Release|Any CPU.Build.0 = Release|x64 22 | {69E1DCFD-A320-4266-ABFE-29CCAE4BDAB3}.Release|x64.ActiveCfg = Release|x64 23 | {69E1DCFD-A320-4266-ABFE-29CCAE4BDAB3}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {EF43CBCC-389C-4749-96C7-6E89CD7EA48D} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/html_ui/InGamePanels/KineticPanel/KineticPanel.css: -------------------------------------------------------------------------------- 1 | /** This mixin makes a single line element fit exactly on the Roboto font for easier integration. */ 2 | ingame-ui#KineticPanel { 3 | display:flex; 4 | flex-direction:column; 5 | align-items:center; 6 | justify-content: center; 7 | height:100% !important; 8 | width: 100% !important; 9 | /*border: 2px solid blue !important;*/ 10 | } 11 | ingame-ui#KineticPanel #KineticPanelWrap { 12 | display: flex; 13 | flex-direction: column; 14 | width: 100% !important; 15 | height: 100% !important; 16 | /*border: 2px solid red !important;*/ 17 | min-height: 0; 18 | min-width: 0; 19 | overflow:hidden; 20 | align-items: stretch !important; 21 | flex: 1 1 auto !important; 22 | } 23 | ingame-ui#KineticPanel #KineticPanelWrap #KineticPanelIframe { 24 | flex: 1 1 auto !important; 25 | border: 0; 26 | } 27 | ingame-ui#KineticPanel #MainDisplay.hidden { 28 | display: none; 29 | } 30 | ingame-ui#KineticPanel #Footer.hidden { 31 | display: none; 32 | } 33 | ingame-ui#KineticPanel .ingameUiContent { 34 | /*border: 2px solid green !important;*/ 35 | display: flex !important; 36 | flex-direction: column !important; 37 | width: 100% !important; 38 | height: 100% !important; 39 | min-height: 0 !important; 40 | min-width: 0 !important; 41 | overflow:hidden !important; 42 | align-items: stretch !important; 43 | flex: 1 1 auto !important; 44 | } 45 | ingame-ui#KineticPanel .ingameUiWrapper { 46 | /*border: 2px solid yellow !important;*/ 47 | display: flex !important; 48 | flex-direction: column !important; 49 | width: 100% !important; 50 | height: 100% !important; 51 | min-height: 0 !important; 52 | min-width: 0 !important; 53 | overflow:hidden !important; 54 | align-items: stretch !important; 55 | flex: 1 1 auto !important; 56 | } 57 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/kinetic-panel/html_ui/InGamePanels/ka-panel/kaPanel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 |
30 |
31 | 32 | 33 |
34 |
35 |
36 | 37 | -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/html_ui/InGamePanels/KineticPanel/KineticPanel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
32 |
33 | header 34 |
35 | 38 |
39 |
40 | 41 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("Kinetic Assistant")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("TouchingCloud")] 14 | [assembly: AssemblyProduct("Kinetic Assistant")] 15 | [assembly: AssemblyCopyright("Copyright © 2021")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("0.11.0.0")] 55 | [assembly: AssemblyFileVersion("0.11.0.0")] 56 | -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/html_ui/Textures/Menu/toolbar/ICON_TOOLBAR_MAXIMUS_CUSTOM_PANEL.svg: -------------------------------------------------------------------------------- 1 | 2 | KineticPanel 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/kinetic-panel/html_ui/Textures/Menu/toolbar/KA_ICON.svg: -------------------------------------------------------------------------------- 1 | 2 | ICON_TOOLBAR_MAXIMUS_CUSTOM_PANEL 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/kinetic-panel/html_ui/InGamePanels/ka-panel/kaPanel.css: -------------------------------------------------------------------------------- 1 | /** This mixin makes a single line element fit exactly on the Roboto font for easier integration. */ 2 | ingame-ui#kaPanel { 3 | display:flex; 4 | flex-direction:column; 5 | align-items:center; 6 | justify-content: center; 7 | height:100% !important; 8 | width: 100% !important; 9 | } 10 | ingame-ui#kaPanel #kaPanelWrap { 11 | display: flex; 12 | flex-direction: column; 13 | width: 100% !important; 14 | height: 100% !important; 15 | min-height: 0; 16 | min-width: 0; 17 | overflow:hidden; 18 | align-items: stretch !important; 19 | flex: 1 1 auto !important; 20 | position: relative; 21 | } 22 | ingame-ui#kaPanel #kaPanelWrap #kaPanelImageError { 23 | display: none; 24 | } 25 | ingame-ui#kaPanel #kaPanelWrap #kaPanelImageError.show { 26 | display: block; 27 | z-index: 10; 28 | position: absolute; 29 | top: 0px; 30 | left: 0px; 31 | right: 0px; 32 | bottom: 0px; 33 | background: url(data:image/gif;base64,R0lGODlhGAAYAPIAAMrs8srt8srs88rt88vt8wAAAAAAAAAAACH5BAkKAAUAIf8LTkVUU0NBUEUyLjADAQAAACH/C0ltYWdlTWFnaWNrDWdhbW1hPTAuNDU0NTUALAAAAAAYABgAAANQWLpcRC3KFUSAMysSrmZd8zSVVAnYxKHRGWiu+X7eZ994/o26A3E13OpSmeGKv1SO12s6nw5jxmISUDMxkUUZIVili+uCqQjuOuBlEUqWJAAAIfkECQoABgAh/wtJbWFnZU1hZ2ljaw1nYW1tYT0wLjQ1NDU1ACwAAAAAGAAYAILK7PLK7fLK7PPK7fPL7fP///8AAAAAAAADUGi6bEQtyhVEgDMrEq5mXfM0RSFVAjaVZYQGGmu68Nd+eK7v38g7EI5nx7EUa7qKx8dj/p7QKAdnOQmqmVeEYNRwsQ3wRqUY4oTI3zEK/CQAACH5BAkKAAYAIf8LSW1hZ2VNYWdpY2sNZ2FtbWE9MC40NTQ1NQAsAAAAABgAGACCyuzyyu3yyuzzyu3zy+3z////AAAAAAAAA1BoumxELcoVRIAzKxKuZl3zNEUhVQI2lWWEBhpruvDXfniu79/IGy2OZyfjWHgyh4o4+zmfUEdNc3QJqpNXhGBZbq9TBnbjHeKEYZ4xrfZGEgAh+QQJCgAGACH/C0ltYWdlTWFnaWNrDWdhbW1hPTAuNDU0NTUALAAAAAAYABgAgsrs8srt8srs88rt88vt8////wAAAAAAAANQaLpsRC3KFUSAMysSrmZd8zRFIVUCNpVlhAYaa7rw1354ru/fyBstjmcn41h4MoeKOPs5n1BHLdYECY6ZpMiyjGgb2IVvccMJpz8jOt2NJAAAIfkECQoABgAh/wtJbWFnZU1hZ2ljaw1nYW1tYT0wLjQ1NDU1ACwAAAAAGAAYAILK7PLK7fLK7PPK7fPL7fP///8AAAAAAAADTmi6bEQtyhVEgDMrEq5mXfM0RSFVAjaVZYQGGmu68Nd+eK7v38gbLY5nJ+NYeDKHijj7OZ9QRy3WBAmOmaTIsoxoG9jFTVyljn9f51mSAAAh+QQJCgAGACH/C0ltYWdlTWFnaWNrDWdhbW1hPTAuNDU0NTUALAAAAAAYABgAgsrs8srt8srs88rt88vt8////wAAAAAAAANKaLpsRC3KFUSAMysSrmZd8zRFIVUCNpVlhAYaa7rw1354ru/fyBstjmcn41h4MoeKOPs5n1BgM3MjsWJXa1WSjGylVl3XOSZPJQkAIfkECQoABgAh/wtJbWFnZU1hZ2ljaw1nYW1tYT0wLjQ1NDU1ACwAAAAAGAAYAILK7PLK7fLK7PPK7fPL7fP///8AAAAAAAADR2i6bEQtyhVEgDMrEq5mXfM0RSFVAjaVZYQGGmu68Nd+eK7v9sy3sp+MJQT6djeecskkHVdPRTAzZVQl10VS+tzGiMys8JMAACH5BAkKAAMAIf8LSW1hZ2VNYWdpY2sNZ2FtbWE9MC40NTQ1NQAsAAAAABgAGACByuzyyu3z////AAAAAkCcjxOR7RfAehQuVo8QaaLtbCAlcklZoc2YmtkLx3I7G6AalziMsrJfCwqFwJDrI2oVd6tk83QcFB/Mn5MYbRQAACH5BAkKAAEAIf8LSW1hZ2VNYWdpY2sNZ2FtbWE9MC40NTQ1NQAsAAAAABgAGACA////AAAAAjuMjwGQ7bfWmzBSJDHTLu7nNeE0Jhl1XurKtuTXSuXqzWqYsrnL976xE8EqQeJQYXkFc8wjKNmzuYqHAgA7) 50% 50% no-repeat; 34 | } 35 | ingame-ui#kaPanel #kaPanelWrap #kaPanelImageZoom { 36 | position: absolute !important; 37 | top: 0px !important; 38 | left: 0px !important; 39 | right: 0px !important; 40 | bottom: 0px !important; 41 | display: block !important; 42 | width: 100%; 43 | height: 100%; 44 | z-index: 999; 45 | } 46 | ingame-ui#kaPanel #kaPanelWrap #kaPanelImageFront { 47 | position: absolute !important; 48 | top: 0px !important; 49 | left: 0px !important; 50 | right: 0px !important; 51 | bottom: 0px !important; 52 | display: block !important; 53 | /*border: 1px solid red !important;*/ 54 | width: 100%; 55 | height: 100%; 56 | } 57 | ingame-ui#kaPanel #kaPanelWrap #kaPanelImageFront.hidden { 58 | display: none !important; 59 | } 60 | ingame-ui#kaPanel #kaPanelWrap #kaPanelImageBack { 61 | position: absolute !important; 62 | top: 0px !important; 63 | left: 0px !important; 64 | right: 0px !important; 65 | bottom: 0px !important; 66 | display: block !important; 67 | /*border: 1px solid green !important;*/ 68 | width: 100%; 69 | height: 100%; 70 | } 71 | ingame-ui#kaPanel #kaPanelWrap #kaPanelImageBack.hidden { 72 | display: none !important; 73 | } 74 | ingame-ui#kaPanel #Footer { 75 | /*position: absolute !important; 76 | left: 0px !important; 77 | right: 0px !important; 78 | bottom: 0px !important; 79 | height: 30px;*/ 80 | display: flex; 81 | justify-content: flex-start; 82 | flex-direction: row; 83 | font-size: var(--fontSizePragraph); 84 | text-transform: uppercase; 85 | background-color: rgba(0, 0, 0, 0.75); 86 | width: 100%; 87 | min-height: 40px; 88 | height: 40px; 89 | max-height: 40px; 90 | } 91 | ingame-ui#kaPanel #Footer input[type="text"] { 92 | /*background-color: var(--color-darker-gray);*/ 93 | margin-top: 7px; 94 | margin-left: 13px; 95 | background-color: white; 96 | border: 1px solid white; 97 | height: calc(100% - 12px); 98 | width: 200px; 99 | border-radius: 1px; 100 | } 101 | ingame-ui#kaPanel #Footer #kaPanelSave { 102 | padding: 0px !important; 103 | height: 10px !important; 104 | max-height: 10px !important; 105 | margin-top: 6px; 106 | margin-left: 13px; 107 | width: 60px; 108 | } 109 | ingame-ui#kaPanel #Footer.hidden { 110 | display: none; 111 | } 112 | ingame-ui#kaPanel .ingameUiContent { 113 | display: flex !important; 114 | flex-direction: column !important; 115 | width: 100% !important; 116 | height: 100% !important; 117 | min-height: 0 !important; 118 | min-width: 0 !important; 119 | overflow:hidden !important; 120 | align-items: stretch !important; 121 | flex: 1 1 auto !important; 122 | } 123 | ingame-ui#kaPanel .ingameUiWrapper { 124 | display: flex !important; 125 | flex-direction: column !important; 126 | width: 100% !important; 127 | height: 100% !important; 128 | min-height: 0 !important; 129 | min-width: 0 !important; 130 | overflow:hidden !important; 131 | align-items: stretch !important; 132 | flex: 1 1 auto !important; 133 | } 134 | -------------------------------------------------------------------------------- /KA-panel/kinetic-ingamepanel/html_ui/InGamePanels/KineticPanel/KineticPanel.js: -------------------------------------------------------------------------------- 1 | class IngamePanelKineticPanel extends TemplateElement { 2 | constructor() { 3 | super(...arguments); 4 | 5 | this.panelActive = false; 6 | this.started = false; 7 | this.ingameUi = null; 8 | this.busy = false; 9 | this.debugEnabled = false; 10 | 11 | if (this.debugEnabled) { 12 | var self = this; 13 | setTimeout(() => { 14 | self.isDebugEnabled(); 15 | }, 1000); 16 | } else { 17 | this.initialize(); 18 | } 19 | } 20 | isDebugEnabled() { 21 | var self = this; 22 | if (typeof g_modDebugMgr != "undefined") { 23 | g_modDebugMgr.AddConsole(null); 24 | g_modDebugMgr.AddDebugButton("Identifier", function() { 25 | console.log('Identifier'); 26 | console.log(self.instrumentIdentifier); 27 | }); 28 | g_modDebugMgr.AddDebugButton("TemplateID", function() { 29 | console.log('TemplateID'); 30 | console.log(self.templateID); 31 | }); 32 | g_modDebugMgr.AddDebugButton("Source", function() { 33 | console.log('Source'); 34 | console.log(window.document.documentElement.outerHTML); 35 | }); 36 | g_modDebugMgr.AddDebugButton("close", function() { 37 | console.log('close'); 38 | if (self.ingameUi) { 39 | console.log('ingameUi'); 40 | self.ingameUi.closePanel(); 41 | } 42 | }); 43 | this.initialize(); 44 | } else { 45 | Include.addScript("/JS/debug.js", function () { 46 | if (typeof g_modDebugMgr != "undefined") { 47 | g_modDebugMgr.AddConsole(null); 48 | g_modDebugMgr.AddDebugButton("Identifier", function() { 49 | console.log('Identifier'); 50 | console.log(self.instrumentIdentifier); 51 | }); 52 | g_modDebugMgr.AddDebugButton("TemplateID", function() { 53 | console.log('TemplateID'); 54 | console.log(self.templateID); 55 | }); 56 | g_modDebugMgr.AddDebugButton("Source", function() { 57 | console.log('Source'); 58 | console.log(window.document.documentElement.outerHTML); 59 | }); 60 | g_modDebugMgr.AddDebugButton("close", function() { 61 | console.log('close'); 62 | if (self.ingameUi) { 63 | console.log('ingameUi'); 64 | self.ingameUi.closePanel(); 65 | } 66 | }); 67 | self.initialize(); 68 | } else { 69 | setTimeout(() => { 70 | self.isDebugEnabled(); 71 | }, 2000); 72 | } 73 | }); 74 | } 75 | } 76 | connectedCallback() { 77 | super.connectedCallback(); 78 | 79 | var self = this; 80 | this.ingameUi = this.querySelector('ingame-ui'); 81 | 82 | this.iframeElement = document.getElementById("KineticPanelIframe"); 83 | 84 | this.m_MainDisplay = document.querySelector("#MainDisplay"); 85 | this.m_MainDisplay.classList.add("hidden"); 86 | 87 | this.m_Footer = document.querySelector("#Footer"); 88 | this.m_Footer.classList.add("hidden"); 89 | 90 | if (this.ingameUi) { 91 | this.ingameUi.addEventListener("panelActive", (e) => { 92 | console.log('panelActive'); 93 | self.panelActive = true; 94 | if (self.iframeElement) { 95 | self.iframeElement.src = 'https://www.ipify.org/'; 96 | } 97 | }); 98 | this.ingameUi.addEventListener("panelInactive", (e) => { 99 | console.log('panelInactive'); 100 | self.panelActive = false; 101 | if (self.iframeElement) { 102 | self.iframeElement.src = ''; 103 | } 104 | }); 105 | this.ingameUi.addEventListener("onResizeElement", () => { 106 | //self.updateImage(); 107 | }); 108 | this.ingameUi.addEventListener("dblclick", () => { 109 | if (self.m_Footer) { 110 | self.m_Footer.classList.remove("hidden"); 111 | } 112 | }); 113 | } 114 | } 115 | initialize() { 116 | if (this.started) { 117 | return; 118 | } 119 | 120 | //var self = this; 121 | //this.m_MainDisplay = document.querySelector("#MainDisplay"); 122 | //this.m_MainDisplay.classList.add("hidden"); 123 | 124 | //this.m_Footer = document.querySelector("#Footer"); 125 | //this.m_Footer.classList.add("hidden"); 126 | 127 | //this.iframeElement = document.getElementById("KineticPanelIframe"); 128 | //this.ingameUi = this.querySelector('ingame-ui'); 129 | 130 | /*if (this.ingameUi) { 131 | this.ingameUi.addEventListener("panelActive", (e) => { 132 | console.log('panelActive'); 133 | self.updateImage(); 134 | }); 135 | this.ingameUi.addEventListener("panelInactive", (e) => { 136 | console.log('panelInactive'); 137 | self.iframeElement.src = ''; 138 | }); 139 | this.ingameUi.addEventListener("onResizeElement", () => { 140 | //self.updateImage(); 141 | }); 142 | this.ingameUi.addEventListener("dblclick", () => { 143 | if (self.m_Footer) { 144 | self.m_Footer.classList.remove("hidden"); 145 | } 146 | }); 147 | }*/ 148 | this.started = true; 149 | } 150 | disconnectedCallback() { 151 | super.disconnectedCallback(); 152 | } 153 | updateImage() { 154 | 155 | } 156 | } 157 | window.kineticElements.define("ingamepanel-kinetic", IngamePanelKineticPanel); 158 | checkAutoload(); -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/PlaneInfoResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace MSFS_Kinetic_Assistant 5 | { 6 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] 7 | public struct PlaneInfoResponse 8 | { 9 | public double Latitude; 10 | public double Longitude; 11 | public double AltitudeAboveGround; 12 | public double Altitude; 13 | public double AbsoluteTime; 14 | public double PlaneHeading; 15 | public double PlanePitch; 16 | public double PlaneBank; 17 | public double GpsGroundSpeed; 18 | public double AirspeedIndicated; 19 | public double AirspeedTrue; 20 | public double VerticalSpeed; 21 | public double AmbientWindY; 22 | public double VelocityBodyX; 23 | public double VelocityBodyY; 24 | public double VelocityBodyZ; 25 | public double AccelerationBodyY; 26 | public double AccelerationBodyZ; 27 | public double RotationVelocityBodyX; 28 | public double RotationVelocityBodyY; 29 | public double RotationVelocityBodyZ; 30 | public double RotationAccelerationBodyX; 31 | public double RotationAccelerationBodyY; 32 | public double RotationAccelerationBodyZ; 33 | public double FoldingWindR; 34 | }; 35 | 36 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] 37 | public struct PlaneInfoCommit 38 | { 39 | public double VelocityBodyX; 40 | public double VelocityBodyY; 41 | public double VelocityBodyZ; 42 | }; 43 | 44 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] 45 | public struct PlaneInfoRotateVelocity 46 | { 47 | public double RotationVelocityBodyX; 48 | public double RotationVelocityBodyY; 49 | public double RotationVelocityBodyZ; 50 | }; 51 | 52 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] 53 | public struct PlaneInfoRotateAccel 54 | { 55 | public double RotationAccelerationBodyX; 56 | public double RotationAccelerationBodyY; 57 | public double RotationAccelerationBodyZ; 58 | }; 59 | 60 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] 61 | public struct PlaneAvionicsResponse 62 | { 63 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] 64 | public String Title; 65 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] 66 | public String Type; 67 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] 68 | public String Model; 69 | public double StaticCGtoGround; 70 | public double SimOnGround; 71 | public double BrakeParkingPosition; 72 | public double OnAnyRunway; 73 | public double IsSlewActive; 74 | public double TotalWeight; 75 | public double SimRate; 76 | public double TailhookPosition; 77 | public double LaunchbarPosition; 78 | public double WaterRudderHandlePosition; 79 | public double Smoke; 80 | public double YokeYPosition; 81 | public double YokeXPosition; 82 | public double RudderPosition; 83 | public double LIGHTPANEL; 84 | public double LIGHTSTROBE; 85 | public double LIGHTLANDING; 86 | public double LIGHTTAXI; 87 | public double LIGHTBEACON; 88 | public double LIGHTNAV; 89 | public double LIGHTLOGO; 90 | public double LIGHTWING; 91 | public double LIGHTRECOGNITION; 92 | public double LIGHTCABIN; 93 | public double LIGHTGLARESHIELD; 94 | public double LIGHTPEDESTRAL; 95 | public double LIGHTPOTENTIOMETER; 96 | }; 97 | 98 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] 99 | public struct PlaneInfoLift 100 | { 101 | public double Altitude; 102 | }; 103 | 104 | public struct ThermalVelocity 105 | { 106 | public double VelocityBodyY; 107 | public double VelocityBodyZ; 108 | public double RotationAccelerationBodyX; 109 | //public double FoldingWindR; 110 | 111 | }; 112 | 113 | 114 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] 115 | public struct NearbyInfoResponse 116 | { 117 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] 118 | public String Title; 119 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] 120 | public String Category; 121 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] 122 | public String FlightNumber; 123 | 124 | public double Latitude; 125 | public double Longitude; 126 | public double Altitude; 127 | public double Airspeed; 128 | public double Verticalspeed; 129 | public double Heading; 130 | public double Pitch; 131 | public double Bank; 132 | public double SimOnGround; 133 | public double OnAnyRunway; 134 | //public double AmbientInCloud; 135 | } 136 | 137 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] 138 | public struct TowInfoResponse 139 | { 140 | public double Latitude; 141 | public double Longitude; 142 | public double Altitude; 143 | public double Heading; 144 | public double Bank; 145 | public double VelocityBodyX; 146 | public double VelocityBodyY; 147 | public double VelocityBodyZ; 148 | }; 149 | 150 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] 151 | public struct TowInfoPitch 152 | { 153 | public double Heading; 154 | public double Pitch; 155 | public double Bank; 156 | public double VelocityBodyY; 157 | public double VelocityBodyZ; 158 | }; 159 | 160 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] 161 | public struct GhostCommit 162 | { 163 | public double VelocityBodyX; 164 | public double VelocityBodyY; 165 | public double VelocityBodyZ; 166 | //public double RotationVelocityBodyX; 167 | //public double RotationVelocityBodyY; 168 | //public double RotationVelocityBodyZ; 169 | public double planeHeading; 170 | public double planePitch; 171 | public double planeRoll; 172 | 173 | }; 174 | 175 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] 176 | public struct PlaneEngineData 177 | { 178 | public double TURBTHRUST1; 179 | public double TURBTHRUST2; 180 | public double TURBTHRUST3; 181 | public double TURBTHRUST4; 182 | public double ENGTORQUE1; 183 | public double ENGTORQUE2; 184 | public double ENGTORQUE3; 185 | public double ENGTORQUE4; 186 | public double ThrottleLeverPosition1; 187 | public double ThrottleLeverPosition2; 188 | public double ThrottleLeverPosition3; 189 | public double ThrottleLeverPosition4; 190 | }; 191 | 192 | 193 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] 194 | public struct WeatherReport 195 | { 196 | public double AmbientAirTemperature; 197 | public double AmbientBarometerPressure; 198 | public double AmbientDensity; 199 | public double AmbientInCloud; 200 | public double AmbientPrecipState; 201 | public double AmbientPrecipRate; 202 | public double AmbientPressure; 203 | public double AmbientSeaLevelPressure; 204 | public double AmbientStandardAtmTemperature; 205 | public double AmbientTemperature; 206 | public double AmbientVisibility; 207 | public double AmbientWindDirection; 208 | public double AmbientWindVelocity; 209 | public double LocalDayOfYear; 210 | public double LocalTime; 211 | public double TimeOfDay; 212 | }; 213 | 214 | } 215 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Check failed 122 | 123 | 124 | Checking for update... 125 | 126 | 127 | Connection failed 128 | 129 | 130 | error {0} 131 | 132 | 133 | Exit 134 | 135 | 136 | GPS: 137 | 138 | 139 | Server: 140 | 141 | 142 | Start 143 | 144 | 145 | Started 146 | 147 | 148 | Starting 149 | 150 | 151 | Stop 152 | 153 | 154 | Stopped 155 | 156 | 157 | Stopping 158 | 159 | 160 | Too many connections 161 | 162 | 163 | waiting 164 | 165 | 166 | {0} connected 167 | 168 | 169 | {0} disconnected 170 | 171 | 172 | {0} refused (too many connections) 173 | 174 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MSFS_Kinetic_Assistant.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MSFS_Kinetic_Assistant.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to {0} connected. 65 | /// 66 | internal static string _0Connected { 67 | get { 68 | return ResourceManager.GetString("_0Connected", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to {0} disconnected. 74 | /// 75 | internal static string _0Disconnected { 76 | get { 77 | return ResourceManager.GetString("_0Disconnected", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to {0} refused (too many connections). 83 | /// 84 | internal static string _0RefusedTooManyConnections { 85 | get { 86 | return ResourceManager.GetString("_0RefusedTooManyConnections", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to Check failed. 92 | /// 93 | internal static string CheckFailed { 94 | get { 95 | return ResourceManager.GetString("CheckFailed", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to Checking for update.... 101 | /// 102 | internal static string CheckingForUpdate { 103 | get { 104 | return ResourceManager.GetString("CheckingForUpdate", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to Connection failed. 110 | /// 111 | internal static string ConnectionFailed { 112 | get { 113 | return ResourceManager.GetString("ConnectionFailed", resourceCulture); 114 | } 115 | } 116 | 117 | /// 118 | /// Looks up a localized string similar to error {0}. 119 | /// 120 | internal static string Error0 { 121 | get { 122 | return ResourceManager.GetString("Error0", resourceCulture); 123 | } 124 | } 125 | 126 | /// 127 | /// Looks up a localized string similar to Exit. 128 | /// 129 | internal static string Exit { 130 | get { 131 | return ResourceManager.GetString("Exit", resourceCulture); 132 | } 133 | } 134 | 135 | /// 136 | /// Looks up a localized string similar to GPS: . 137 | /// 138 | internal static string GPS_ { 139 | get { 140 | return ResourceManager.GetString("GPS_", resourceCulture); 141 | } 142 | } 143 | 144 | /// 145 | /// Looks up a localized string similar to Server: . 146 | /// 147 | internal static string Server_ { 148 | get { 149 | return ResourceManager.GetString("Server_", resourceCulture); 150 | } 151 | } 152 | 153 | /// 154 | /// Looks up a localized string similar to Start. 155 | /// 156 | internal static string Start { 157 | get { 158 | return ResourceManager.GetString("Start", resourceCulture); 159 | } 160 | } 161 | 162 | /// 163 | /// Looks up a localized string similar to Started. 164 | /// 165 | internal static string Started { 166 | get { 167 | return ResourceManager.GetString("Started", resourceCulture); 168 | } 169 | } 170 | 171 | /// 172 | /// Looks up a localized string similar to Starting. 173 | /// 174 | internal static string Starting { 175 | get { 176 | return ResourceManager.GetString("Starting", resourceCulture); 177 | } 178 | } 179 | 180 | /// 181 | /// Looks up a localized string similar to Stop. 182 | /// 183 | internal static string Stop { 184 | get { 185 | return ResourceManager.GetString("Stop", resourceCulture); 186 | } 187 | } 188 | 189 | /// 190 | /// Looks up a localized string similar to Stopped. 191 | /// 192 | internal static string Stopped { 193 | get { 194 | return ResourceManager.GetString("Stopped", resourceCulture); 195 | } 196 | } 197 | 198 | /// 199 | /// Looks up a localized string similar to Stopping. 200 | /// 201 | internal static string Stopping { 202 | get { 203 | return ResourceManager.GetString("Stopping", resourceCulture); 204 | } 205 | } 206 | 207 | /// 208 | /// Looks up a localized string similar to Too many connections. 209 | /// 210 | internal static string TooManyConnections { 211 | get { 212 | return ResourceManager.GetString("TooManyConnections", resourceCulture); 213 | } 214 | } 215 | 216 | /// 217 | /// Looks up a localized string similar to waiting. 218 | /// 219 | internal static string Waiting { 220 | get { 221 | return ResourceManager.GetString("Waiting", resourceCulture); 222 | } 223 | } 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/kinetic-panel/html_ui/InGamePanels/ka-panel/kaPanel.js: -------------------------------------------------------------------------------- 1 | class kaPanel extends TemplateElement { 2 | constructor() { 3 | super(...arguments); 4 | 5 | this.started = false; 6 | this.isActive = false; 7 | this.busy = false; 8 | this.front = true; 9 | this.url = ""; 10 | this.zoom = 0; 11 | this.debugEnabled = false; 12 | this.onStorageReady = () => { 13 | if (this.debugEnabled) { 14 | var self = this; 15 | setTimeout(() => { 16 | self.isDebugEnabled(); 17 | }, 1000); 18 | } else { 19 | this.initialize(); 20 | } 21 | }; 22 | } 23 | isDebugEnabled() { 24 | var self = this; 25 | if (typeof g_modDebugMgr != "undefined") { 26 | g_modDebugMgr.AddConsole(null); 27 | g_modDebugMgr.AddDebugButton("Clear", function() { 28 | g_modDebugMgr.ClearConsole(); 29 | console.log('Clear'); 30 | }); 31 | g_modDebugMgr.AddDebugButton("Reload", function() { 32 | console.log('Reload'); 33 | window.document.location.reload(true); 34 | }); 35 | g_modDebugMgr.AddDebugButton("Source", function() { 36 | console.log('Source'); 37 | console.log(window.document.documentElement.outerHTML); 38 | }); 39 | g_modDebugMgr.AddDebugButton("close", function() { 40 | console.log('close'); 41 | if (self.ingameUi) { 42 | console.log('ingameUi'); 43 | self.ingameUi.closePanel(); 44 | } 45 | }); 46 | g_modDebugMgr.AddDebugButton("min", function() { 47 | console.log('min'); 48 | if (self.ingameUi && self.ingameUi.m_toolbar_listener) { 49 | console.log('ingameUi'); 50 | self.ingameUi.m_toolbar_listener.setMinimized('KA_PANEL', true); 51 | } 52 | }); 53 | this.initialize(); 54 | } else { 55 | Include.addScript("/JS/debug.js", function () { 56 | if (typeof g_modDebugMgr != "undefined") { 57 | g_modDebugMgr.AddConsole(null); 58 | g_modDebugMgr.AddDebugButton("Clear", function() { 59 | g_modDebugMgr.ClearConsole(); 60 | console.log('Clear'); 61 | }); 62 | g_modDebugMgr.AddDebugButton("Reload", function() { 63 | console.log('Reload'); 64 | window.document.location.reload(true); 65 | }); 66 | g_modDebugMgr.AddDebugButton("Source", function() { 67 | console.log('Source'); 68 | console.log(window.document.documentElement.outerHTML); 69 | }); 70 | g_modDebugMgr.AddDebugButton("close", function() { 71 | console.log('close'); 72 | if (self.ingameUi) { 73 | console.log('ingameUi'); 74 | self.ingameUi.closePanel(); 75 | } 76 | }); 77 | g_modDebugMgr.AddDebugButton("min", function() { 78 | console.log('min'); 79 | if (self.ingameUi && self.ingameUi.m_toolbar_listener) { 80 | console.log('ingameUi'); 81 | self.ingameUi.m_toolbar_listener.setMinimized('KA_PANEL', true); 82 | } 83 | }); 84 | self.initialize(); 85 | } else { 86 | setTimeout(() => { 87 | self.isDebugEnabled(); 88 | }, 2000); 89 | } 90 | }); 91 | } 92 | } 93 | connectedCallback() { 94 | super.connectedCallback(); 95 | document.addEventListener("dataStorageReady", this.onStorageReady); 96 | } 97 | initialize() { 98 | if (this.started) { 99 | return; 100 | } 101 | 102 | var self = this; 103 | 104 | this.url = "http://localhost:8212"; 105 | 106 | this.errorElement = document.getElementById("kaPanelImageError"); 107 | this.imageElementFront = document.getElementById("kaPanelImageFront"); 108 | this.imageElementBack = document.getElementById("kaPanelImageBack"); 109 | this.imageElementZoom = document.getElementById("kaPanelImageZoom"); 110 | this.ingameUi = this.querySelector('ingame-ui'); 111 | 112 | 113 | if (this.imageElementFront && this.imageElementBack) { 114 | this.imageElementFront.addEventListener("error", () => { 115 | self.onImageError(); 116 | }); 117 | this.imageElementFront.addEventListener("load", () => { 118 | self.onImageLoad(); 119 | }); 120 | this.imageElementBack.addEventListener("error", () => { 121 | self.onImageError(); 122 | }); 123 | this.imageElementBack.addEventListener("load", () => { 124 | self.onImageLoad(); 125 | }); 126 | if (this.imageElementZoom) { 127 | this.imageElementZoom.addEventListener('wheel', () => { 128 | event.preventDefault(); 129 | this.zoom += event.deltaY * 0.01; 130 | self.updateImage(); 131 | }); 132 | } 133 | } 134 | 135 | if (this.ingameUi) { 136 | this.ingameUi.addEventListener("panelActive", (e) => { 137 | this.isActive = true; 138 | self.updateImage(); 139 | }); 140 | this.ingameUi.addEventListener("panelInactive", (e) => { 141 | this.isActive = false; 142 | }); 143 | this.ingameUi.addEventListener("onResizeElement", () => { 144 | self.updateImage(); 145 | }); 146 | this.ingameUi.addEventListener("dblclick", () => { 147 | }); 148 | } 149 | 150 | this.started = true; 151 | 152 | setInterval(function() { 153 | if (!this.isActive) 154 | return; 155 | 156 | self.updateImage(); 157 | }, 10000); 158 | } 159 | disconnectedCallback() { 160 | document.removeEventListener("dataStorageReady", this.onStorageReady); 161 | super.disconnectedCallback(); 162 | } 163 | onImageError() { 164 | var self = this; 165 | 166 | if (!this.isActive) 167 | return; 168 | 169 | if (this.front) { 170 | if (this.imageElementFront) { 171 | this.imageElementFront.setAttribute('style', ''); 172 | this.imageElementFront.setAttribute('class', 'hidden'); 173 | } 174 | this.front = false; 175 | } else { 176 | if (this.imageElementBack) { 177 | this.imageElementBack.setAttribute('style', ''); 178 | this.imageElementBack.setAttribute('class', 'hidden'); 179 | } 180 | this.front = true; 181 | } 182 | if (this.errorElement) { 183 | this.errorElement.setAttribute('class', 'show'); 184 | } 185 | //this.busy = false; 186 | setTimeout(function() { 187 | self.updateImage(); 188 | }, 250); 189 | } 190 | onImageLoad() { 191 | var self = this; 192 | 193 | if (!this.isActive) 194 | return; 195 | 196 | if (this.errorElement) { 197 | this.errorElement.setAttribute('class', ''); 198 | } 199 | 200 | if (this.front) { 201 | if (this.imageElementFront) { 202 | this.imageElementFront.setAttribute('class', 'show'); 203 | setTimeout(function(){ 204 | this.imageElementBack.setAttribute('class', 'hidden'); 205 | }, 0); 206 | //this.imageElementFront.setAttribute('style', 'z-index: 2'); 207 | //if (this.imageElementBack) { 208 | // this.imageElementBack.setAttribute('style', ''); 209 | //} 210 | } 211 | this.front = false; 212 | } else { 213 | if (this.imageElementBack) { 214 | this.imageElementBack.setAttribute('class', 'show'); 215 | setTimeout(function(){ 216 | this.imageElementFront.setAttribute('class', 'hidden'); 217 | }, 0); 218 | //this.imageElementBack.setAttribute('style', 'z-index: 2'); 219 | //if (this.imageElementFront) { 220 | // this.imageElementFront.setAttribute('style', ''); 221 | //} 222 | } 223 | this.front = true; 224 | } 225 | 226 | this.front != this.front; 227 | //this.busy = false; 228 | setTimeout(function() { 229 | self.updateImage(); 230 | }, 250); 231 | } 232 | updateImage() { 233 | if (! this.url) { 234 | return; 235 | } 236 | 237 | var url = this.url + "/?width=" + Math.max(this.imageElementFront.width, 138) + "&height=" + Math.max(this.imageElementFront.height, 155) +"&zoom="+this.zoom.toString()+"&cmd=" + Math.random(); 238 | this.zoom = 0; 239 | if (this.front) { 240 | if (this.imageElementFront) { 241 | //if (! this.busy) { 242 | //this.busy = true; 243 | this.imageElementFront.src = url; 244 | //this.imageElementFront.setAttribute('class', 'hidden'); 245 | //} 246 | } 247 | } else { 248 | if (this.imageElementBack) { 249 | //if (! this.busy) { 250 | //this.busy = true; 251 | this.imageElementBack.src = url; 252 | //this.imageElementBack.setAttribute('class', 'hidden'); 253 | //} 254 | } 255 | } 256 | } 257 | } 258 | window.customElements.define("ingamepanel-ka", kaPanel); 259 | checkAutoload(); -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MathClass.cs: -------------------------------------------------------------------------------- 1 | using Accord.Math; 2 | using System; 3 | 4 | namespace MSFS_Kinetic_Assistant 5 | { 6 | class MathClass 7 | { 8 | public winchPosition getWinchPosition(PlaneInfoResponse _planeInfoResponse, double _stringLength) 9 | { 10 | winchPosition _winchPosition = new winchPosition(); 11 | _winchPosition.location = FindPointAtDistanceFrom(new GeoLocation(_planeInfoResponse.Latitude, _planeInfoResponse.Longitude), _planeInfoResponse.PlaneHeading, _stringLength / 1000); 12 | _winchPosition.alt = _planeInfoResponse.Altitude + 2; 13 | 14 | return _winchPosition; 15 | } 16 | 17 | public winchDirection getForceDirection(winchPosition _winchPosition, PlaneInfoResponse _planeInfoResponse) 18 | { 19 | winchDirection _winchDirection = new winchDirection(); 20 | 21 | double globalX = (_winchPosition.location.Longitude - _planeInfoResponse.Longitude) * Math.Cos(_winchPosition.location.Latitude) * 6378137; 22 | double globalY = _winchPosition.alt - _planeInfoResponse.Altitude; 23 | double globalZ = (_winchPosition.location.Latitude - _planeInfoResponse.Latitude) * 180 / Math.PI * 111694; 24 | Vector3 globalToWinch = new Vector3((float)globalX, (float)globalY, (float)globalZ); 25 | Vector3 globalToWinchNorm = globalToWinch; 26 | globalToWinchNorm.Normalize(); 27 | 28 | _winchDirection.climbAngle = Math.Abs(Math.Asin(globalToWinchNorm.Y)); 29 | 30 | Matrix3x3 attitude = Matrix3x3.CreateFromYawPitchRoll((float)_planeInfoResponse.PlaneHeading, (float)_planeInfoResponse.PlanePitch, (float)_planeInfoResponse.PlaneBank); 31 | _winchDirection.localForceDirection = Matrix3x3.Multiply(attitude.Inverse(), globalToWinchNorm); 32 | _winchDirection.localForceDirection.Normalize(); 33 | 34 | _winchDirection.heading = -_planeInfoResponse.PlaneHeading + findBearingToPoint(_planeInfoResponse.Latitude, _planeInfoResponse.Longitude, _winchPosition.location.Latitude, _winchPosition.location.Longitude); 35 | _winchDirection.pitch = Math.Asin(_winchDirection.localForceDirection.Y); 36 | _winchDirection.distance = (double)(globalToWinch.Norm); 37 | _winchDirection.groundDistance = findDistanceBetweenPoints(_planeInfoResponse.Latitude, _planeInfoResponse.Longitude, _winchPosition.location.Latitude, _winchPosition.location.Longitude); 38 | globalToWinch.Y = 0; 39 | 40 | if (_winchDirection.heading > Math.PI) { _winchDirection.heading -= 2 * Math.PI; } 41 | if (_winchDirection.heading < -Math.PI) { _winchDirection.heading += 2 * Math.PI; } 42 | if (_winchDirection.pitch > Math.PI) { _winchDirection.pitch -= 2 * Math.PI; } 43 | if (_winchDirection.pitch < -Math.PI) { _winchDirection.pitch += 2 * Math.PI; } 44 | 45 | return _winchDirection; 46 | } 47 | 48 | public GeoLocation FindPointAtDistanceFrom(GeoLocation startPoint, double initialBearingRadians, double distanceKilometres) 49 | { 50 | const double radiusEarthKilometres = 6371.01; 51 | double distRatio = distanceKilometres / radiusEarthKilometres; 52 | double distRatioSine = Math.Sin(distRatio); 53 | double distRatioCosine = Math.Cos(distRatio); 54 | 55 | double startLatCos = Math.Cos(startPoint.Latitude); 56 | double startLatSin = Math.Sin(startPoint.Latitude); 57 | 58 | double endLatRads = Math.Asin((startLatSin * distRatioCosine) + (startLatCos * distRatioSine * Math.Cos(initialBearingRadians))); 59 | 60 | double endLonRads = startPoint.Longitude 61 | + Math.Atan2( 62 | Math.Sin(initialBearingRadians) * distRatioSine * startLatCos, 63 | distRatioCosine - startLatSin * Math.Sin(endLatRads)); 64 | 65 | return new GeoLocation(endLatRads, endLonRads); 66 | } 67 | public GeoLocation RotatePointFrom(GeoLocation startPoint, double initialBearingRadians, GeoLocation endPoint) 68 | { 69 | double dist = findDistanceBetweenPoints(startPoint.Latitude, startPoint.Longitude, endPoint.Latitude, endPoint.Longitude); 70 | double bearing = findBearingToPoint(startPoint.Latitude, startPoint.Longitude, endPoint.Latitude, endPoint.Longitude); 71 | 72 | return FindPointAtDistanceFrom(startPoint, bearing + initialBearingRadians, dist / 1000); 73 | } 74 | public double findDistanceBetweenPoints(double rlat1, double rlon1, double rlat2, double rlon2) 75 | { 76 | double rtheta = rlon1 - rlon2; 77 | double dist = Math.Sin(rlat1) * Math.Sin(rlat2) + Math.Cos(rlat1) * 78 | Math.Cos(rlat2) * Math.Cos(rtheta); 79 | dist = Math.Acos(dist); 80 | dist = dist * 180 / Math.PI; 81 | dist = dist * 60 * 1852; 82 | 83 | return dist; 84 | } 85 | 86 | public double findBearingToPoint(double rlat1, double rlon1, double rlat2, double rlon2) 87 | { 88 | double rtheta = rlon2 - rlon1; 89 | double dPhi = Math.Log( 90 | Math.Tan(rlat2 / 2 + Math.PI / 4) / Math.Tan(rlat1 / 2 + Math.PI / 4)); 91 | if (Math.Abs(rtheta) > Math.PI) 92 | rtheta = rtheta > 0 ? -(2 * Math.PI - rtheta) : (2 * Math.PI + rtheta); 93 | return Math.Atan2(rtheta, dPhi) % Math.PI; 94 | } 95 | 96 | public double restrictAirspeed(double speed, double _targetSpeed, double lastFrameTiming) 97 | { 98 | if (Math.Abs(speed) > _targetSpeed) 99 | speed -= speed * Math.Sign(speed) * Math.Pow((Math.Abs(speed) - _targetSpeed) / _targetSpeed, 2) * lastFrameTiming; 100 | 101 | return speed; 102 | } 103 | 104 | public double getCableTension(double cableLength, double elasticExtension, winchDirection _winchDirection) 105 | { 106 | double cableTension = 0; 107 | double dumpingLength = Math.Max(5.0, cableLength * elasticExtension / 100); 108 | 109 | // CALCULATION TENSION MODIFIER 110 | if (cableLength < _winchDirection.distance) 111 | { 112 | cableTension = (_winchDirection.distance - cableLength) / dumpingLength; 113 | } 114 | 115 | return cableTension; 116 | } 117 | 118 | public double getBodyVelocity(winchDirection _winchDirection, PlaneInfoCommit _planeCommit, double cableTension, double accelerationLimit, double cableLength, double cableLengthPrev, double cableLengthPrePrev, double lastFrameTiming) 119 | { 120 | double baseAcceleration = 5 * 9.81; 121 | 122 | if (Math.Abs(cableLength - cableLengthPrev) > 10) { cableLengthPrev = cableLength; } 123 | if (Math.Abs(cableLengthPrev - cableLengthPrePrev) > 10) { cableLengthPrePrev = cableLengthPrev; } 124 | double lengthDiff = (cableLength - cableLengthPrev) * 0.5 + (cableLengthPrev - cableLengthPrePrev) * 0.5; 125 | double cableSpeed = lengthDiff / lastFrameTiming * cableTension; 126 | if (cableTension > 1 && lengthDiff > 0) 127 | cableSpeed += baseAcceleration * Math.Pow(cableTension - 1, 2); 128 | 129 | if (cableSpeed < 2 * accelerationLimit && cableSpeed > accelerationLimit) 130 | { 131 | cableSpeed = Math.Min(cableSpeed, 0.99 * accelerationLimit); 132 | } 133 | 134 | Vector3 planeMotion = new Vector3((float)(_planeCommit.VelocityBodyX * Math.Cos(_winchDirection.heading) * Math.Cos(_winchDirection.pitch)), 135 | (float)(_planeCommit.VelocityBodyY * Math.Sin(_winchDirection.heading)), 136 | (float)(_planeCommit.VelocityBodyZ * Math.Cos(_winchDirection.heading) * Math.Sin(_winchDirection.pitch))); 137 | 138 | double appliedVelocity = cableSpeed - planeMotion.Norm; 139 | 140 | //Console.WriteLine($"getBodyVelocity: {cableTension:F4} {appliedVelocity:F4}m/s lengthDiff{lengthDiff:F4}m cableSpeed{cableSpeed:F4}"); 141 | //Console.WriteLine($"cabC: {cableLength:F4}m cabP{cableLengthPrev:F4}m cabPP{cableLengthPrePrev:F4}m"); 142 | 143 | return appliedVelocity > 0 ? appliedVelocity : 0; 144 | } 145 | } 146 | 147 | public class winchPosition 148 | { 149 | public winchPosition() { } 150 | public winchPosition(GeoLocation Location, double Altitude, double Radius = 0, double Airspeed = 0, string Title = "", string Category = "") 151 | { 152 | location = Location; 153 | alt = Altitude; 154 | radius = Radius; 155 | airspeed = Airspeed; 156 | title = Title; 157 | category = Category; 158 | } 159 | 160 | public GeoLocation location { get; set; } 161 | public double alt { get; set; } 162 | public double radius { get; set; } 163 | public double airspeed { get; set; } 164 | public string title { get; set; } 165 | public string category { get; set; } 166 | } 167 | 168 | public class winchDirection 169 | { 170 | public double heading { get; set; } 171 | public double pitch { get; set; } 172 | public double distance { get; set; } 173 | public double groundDistance { get; set; } 174 | public double climbAngle { get; set; } 175 | public Vector3 localForceDirection { get; set; } 176 | } 177 | 178 | public class GeoLocation 179 | { 180 | public GeoLocation(double latitude, double longitude) 181 | { 182 | Latitude = latitude; 183 | Longitude = longitude; 184 | } 185 | 186 | public double Latitude { get; set; } 187 | public double Longitude { get; set; } 188 | } 189 | public class Waypoint 190 | { 191 | public Waypoint(int id, GeoLocation loc, string name, string entered, string passed, double fine, double weight, string wind, double altitude, double elevation, double height, double width, bool bottomMeasurement, bool topMeasurement) 192 | { 193 | ID = id; 194 | Location = loc; 195 | Name = name; 196 | Entered = entered; 197 | Passed = passed; 198 | Fine = fine; 199 | Weight = weight; 200 | Wind = wind; 201 | Altitude = altitude; 202 | Elevation = elevation; 203 | Height = height; 204 | Width = width; 205 | BottomMeasurement = bottomMeasurement; 206 | TopMeasurement = topMeasurement; 207 | } 208 | 209 | public int ID { get; set; } 210 | public GeoLocation Location { get; set; } 211 | public string Name { get; set; } 212 | public string Entered { get; set; } 213 | public string Passed { get; set; } 214 | public double Fine { get; set; } 215 | public double Weight { get; set; } 216 | public string Wind { get; set; } 217 | public double Altitude { get; set; } 218 | public double Elevation { get; set; } 219 | public double Height { get; set; } 220 | public double Width { get; set; } 221 | public bool BottomMeasurement { get; set; } 222 | public bool TopMeasurement { get; set; } 223 | } 224 | } 225 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/MSFS Kinetic Assistant.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {69E1DCFD-A320-4266-ABFE-29CCAE4BDAB3} 8 | WinExe 9 | MSFS_Kinetic_Assistant 10 | Kinetic Assistant 11 | v4.7.2 12 | 512 13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 4 15 | true 16 | true 17 | 18 | 19 | 20 | publish\ 21 | true 22 | Disk 23 | false 24 | Foreground 25 | 7 26 | Days 27 | false 28 | false 29 | true 30 | 0 31 | 1.0.0.%2a 32 | false 33 | false 34 | true 35 | 36 | 37 | AnyCPU 38 | true 39 | full 40 | false 41 | bin\Debug\ 42 | DEBUG;TRACE 43 | prompt 44 | 4 45 | 46 | 47 | AnyCPU 48 | pdbonly 49 | true 50 | bin\Release\ 51 | TRACE 52 | prompt 53 | 4 54 | 55 | 56 | true 57 | bin\x64\Debug\ 58 | DEBUG;TRACE 59 | full 60 | x64 61 | 7.3 62 | prompt 63 | MinimumRecommendedRules.ruleset 64 | true 65 | 66 | 67 | bin\x64\Release\ 68 | TRACE 69 | true 70 | pdbonly 71 | x64 72 | 7.3 73 | prompt 74 | MinimumRecommendedRules.ruleset 75 | true 76 | 77 | 78 | touchcloud-icon-l.ico 79 | 80 | 81 | 82 | ..\packages\Accord.3.8.0\lib\net46\Accord.dll 83 | 84 | 85 | ..\packages\Accord.Math.3.8.0\lib\net46\Accord.Math.dll 86 | 87 | 88 | ..\packages\Accord.Math.3.8.0\lib\net46\Accord.Math.Core.dll 89 | 90 | 91 | ..\packages\CTrue.FsConnect.1.0.3\lib\net40\CTrue.FsConnect.dll 92 | 93 | 94 | ..\packages\CTrue.FsConnect.1.0.3\lib\net40\Microsoft.FlightSimulator.SimConnect.dll 95 | 96 | 97 | ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll 98 | 99 | 100 | 101 | 102 | ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll 103 | True 104 | True 105 | 106 | 107 | ..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll 108 | 109 | 110 | 111 | 112 | ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll 113 | 114 | 115 | ..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll 116 | True 117 | True 118 | 119 | 120 | 4.0 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | MSBuild:Compile 131 | Designer 132 | 133 | 134 | MSBuild:Compile 135 | Designer 136 | 137 | 138 | App.xaml 139 | Code 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | MainWindow.xaml 151 | Code 152 | 153 | 154 | 155 | 156 | Code 157 | 158 | 159 | True 160 | True 161 | Resources.resx 162 | 163 | 164 | True 165 | Settings.settings 166 | True 167 | 168 | 169 | ResXFileCodeGenerator 170 | Resources.Designer.cs 171 | 172 | 173 | 174 | SettingsSingleFileGenerator 175 | Settings.Designer.cs 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | False 187 | Microsoft .NET Framework 4.6.1 %28x86 and x64%29 188 | true 189 | 190 | 191 | False 192 | .NET Framework 3.5 SP1 193 | false 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 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}. 239 | 240 | 241 | 242 | 243 | 244 | -------------------------------------------------------------------------------- /packages/CTrue.FsConnect.1.0.3/lib/net40/CTrue.FsConnect.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CTrue.FsConnect 5 | 6 | 7 | 8 | 9 | Used to hold data received from Flight Simulator. 10 | 11 | 12 | 13 | 14 | The request id of the received data. 15 | 16 | 17 | 18 | 19 | The data that was received. 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | MY DOCUMENTS IS DANGEROUS METHOD!!! 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | Disconnects and disposes the client. 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | Used to hold data received from Flight Simulator. 80 | 81 | 82 | 83 | 84 | The request id of the received data. 85 | 86 | 87 | 88 | 89 | The data that was received. 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | Utilities for handling Flight Simulator 109 | 110 | 111 | 112 | 113 | Converts degrees to radians. 114 | 115 | 116 | 117 | 118 | 119 | 120 | Converts radians to degrees. 121 | 122 | 123 | 124 | 125 | A wrapper / helper class for connection to Microsoft Flight Simulator. 126 | 127 | 128 | The wraps the SimConnect.dll and managed 129 | 130 | 131 | 132 | 133 | The event is raised when the connection status to Flight Simulator has changed. 134 | 135 | 136 | 137 | 138 | The event is raised when data has been received from Flight Simulator. 139 | 140 | 141 | 142 | 143 | The event is raised when an error has been raised by SimConnect. 144 | 145 | 146 | 147 | 148 | Gets a boolean value indication whether a connection to Flight Simulator is established. 149 | 150 | 151 | 152 | 153 | Gets or sets where to write the SimConnect.cfg file, that specifies how to connect to Flight Simulator. 154 | 155 | 156 | 157 | 158 | Connects to Flight Simulator using an existing SimConnect.cfg. 159 | 160 | A name identifying this client to Flight Simulator. 161 | The index to a specified configuration in the SimConnect.cfg file. Default is index 0. 162 | 163 | 164 | 165 | Connects to Flight Simulator on the specified host name and port. 166 | 167 | A name identifying this client to Flight Simulator. 168 | A hostname or IP address. 169 | A TCP or pipe port number. 170 | The protocol to use to connect to Flight Simulator. 171 | 172 | A SimConnect.cfg file will be generated containing connection information. 173 | Flight Simulator must be configured for remote connections by editing the SimConnect.xml file that are part of the installation. 174 | 175 | 176 | 177 | 178 | Disconnects from Flight Simulator. 179 | 180 | 181 | 182 | 183 | Requests data from Flight Simulator. 184 | 185 | 186 | 187 | 188 | Registers data structures for requesting data from Flight Simulator. 189 | 190 | 191 | A connection to Flight Simulator must have been established before registering data definitions. 192 | 193 | 194 | 195 | 196 | Displays a text in Flight Simulator. 197 | 198 | The text to display. 199 | Duration to display text, in seconds. 200 | 201 | 202 | 203 | Updated data. 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | Used to hold data received from Flight Simulator. 212 | 213 | 214 | 215 | 216 | The request id of the received data. 217 | 218 | 219 | 220 | 221 | The data that was received. 222 | 223 | 224 | 225 | 226 | The SimConnect.cfg file will be written to the MyDocuments location. 227 | 228 | 229 | 230 | 231 | The SimConnect.cfg file will be written to the same location that the application was started from. 232 | 233 | 234 | The application must have write access to this folder. 235 | 236 | 237 | 238 | 239 | Specifies the protocol to use to connect to Flight Simulator. 240 | 241 | 242 | 243 | 244 | Named pipes 245 | 246 | 247 | 248 | 249 | TCP.IP v4 250 | 251 | 252 | 253 | 254 | TCP.IP v6 255 | 256 | 257 | 258 | 259 | The class is used to define a data definition. 260 | 261 | 262 | 263 | 264 | The name of the definition. See the SimVars class in the Simvars example in the SDK. 265 | 266 | 267 | 268 | 269 | The unit of the definition. See the Units class in the Simvars example in the SDK. 270 | 271 | 272 | 273 | 274 | The data type of the definition. 275 | 276 | 277 | 278 | 279 | Creates an uninitialized instance of the class. 280 | 281 | 282 | 283 | 284 | Creates an initialized instance of the class. 285 | 286 | 287 | 288 | 289 | Creates an initialized instance using enums for known values. 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/Server.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Location Bridge 3 | 4 | http://eartoearoak.com/software/location-bridge 5 | 6 | Copyright 2014-2015 Al Brown 7 | 8 | A simple server that provides NMEA sentences over TCP from the 9 | Windows location sensors. 10 | 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, or (at your option) 15 | any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | */ 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Globalization; 29 | using System.Net; 30 | using System.Net.Sockets; 31 | using System.Text; 32 | using System.Threading; 33 | using System.Timers; 34 | using MSFS_Kinetic_Assistant.Properties; 35 | 36 | namespace MSFS_Kinetic_Assistant 37 | { 38 | 39 | // Based on http://msdn.microsoft.com/en-us/library/fx6588te.aspx 40 | 41 | class Client 42 | { 43 | public Socket socket { get; set; } 44 | 45 | public Client(Socket socket) 46 | { 47 | this.socket = socket; 48 | } 49 | } 50 | 51 | class Server 52 | { 53 | public const int MAX_CLIENTS = 10; 54 | 55 | private static byte[] warnMaxClients = Encoding.ASCII.GetBytes( 56 | Resources.TooManyConnections); 57 | 58 | private object lockGps; 59 | private CallbackUI callback; 60 | 61 | private volatile bool cancel = false; 62 | private Object lockClients = new Object(); 63 | private List clients = new List(); 64 | private IPAddress ipAddress; 65 | 66 | public static ManualResetEvent signal = new ManualResetEvent(false); 67 | 68 | public Server(object gpsLock, CallbackUI callback, string ip) 69 | { 70 | ipAddress = IPAddress.Parse(ip); 71 | lockGps = gpsLock; 72 | this.callback = callback; 73 | UpdateCount(); 74 | 75 | System.Timers.Timer timerAlive = new System.Timers.Timer(); 76 | timerAlive.Elapsed += new ElapsedEventHandler(OnTimerAlive); 77 | timerAlive.Interval = 1000; 78 | timerAlive.Enabled = true; 79 | } 80 | 81 | public void Start() 82 | { 83 | IPEndPoint localEndPoint; 84 | /*if (Properties.Settings.Default.LocalOnly) 85 | localEndPoint = new IPEndPoint(IPAddress.Loopback, 10110); 86 | else*/ 87 | localEndPoint = new IPEndPoint(ipAddress, 10110); 88 | 89 | var socketServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); 90 | callback(new ServerStatus(Resources.Waiting)); 91 | 92 | try 93 | { 94 | socketServer.Bind(localEndPoint); 95 | socketServer.Listen(100); 96 | 97 | while (!cancel) 98 | { 99 | signal.Reset(); 100 | socketServer.BeginAccept(new AsyncCallback(ClientCallback), 101 | socketServer); 102 | signal.WaitOne(); 103 | } 104 | } 105 | catch (SocketException e) 106 | { 107 | Console.Write("EXCEPTION: Start error " + e.Message); 108 | callback(new ServerStatus(ServerStatusCode.ERROR, 109 | String.Format(Resources.Error0, e.SocketErrorCode.ToString()))); 110 | if (socketServer.IsBound) 111 | socketServer.Shutdown(SocketShutdown.Both); 112 | } 113 | finally 114 | { 115 | socketServer.Close(); 116 | foreach (var client in clients.ToArray()) 117 | ClientRemove(client); 118 | } 119 | } 120 | 121 | private static string GetHostName(string address) 122 | { 123 | /*string host = address.Split(':')[0]; 124 | string hostName = ""; 125 | try 126 | { 127 | IPHostEntry hostEntry = Dns.GetHostEntry(host); 128 | 129 | hostName = hostEntry.HostName; 130 | } 131 | catch (SocketException ex) 132 | { 133 | Console.Write("EXCEPTION: Can't get host name " + ex.Message); 134 | hostName = host; 135 | } 136 | 137 | return "'" + hostName + "'";*/ 138 | 139 | try 140 | { 141 | IPHostEntry entry = Dns.GetHostEntry(address); 142 | if (entry != null) 143 | { 144 | return entry.HostName; 145 | } 146 | } 147 | catch (SocketException ex) 148 | { 149 | Console.Write("EXCEPTION: Can't get host name " + ex.Message); 150 | } 151 | 152 | return ""; 153 | } 154 | 155 | 156 | private void ClientAdd(Client client) 157 | { 158 | lock (lockClients) 159 | clients.Add(client); 160 | } 161 | 162 | private void ClientRemove(Client client) 163 | { 164 | lock (lockClients) 165 | clients.Remove(client); 166 | var addr = GetHostName(client.socket.RemoteEndPoint.ToString()); 167 | client.socket.Shutdown(SocketShutdown.Both); 168 | client.socket.Close(); 169 | callback(new ServerStatus(String.Format(Resources._0Disconnected, addr))); 170 | UpdateCount(); 171 | } 172 | 173 | private void ClientCallback(IAsyncResult ar) 174 | { 175 | signal.Set(); 176 | 177 | try 178 | { 179 | var socketServer = (Socket)ar.AsyncState; 180 | var socketClient = socketServer.EndAccept(ar); 181 | var addr = GetHostName(socketClient.RemoteEndPoint.ToString()); 182 | 183 | if (clients.Count < MAX_CLIENTS) 184 | { 185 | var client = new Client(socketClient); 186 | ClientAdd(client); 187 | callback(new ServerStatus( 188 | String.Format(Resources._0Connected, addr))); 189 | UpdateCount(); 190 | } 191 | else 192 | { 193 | socketClient.Send(warnMaxClients); 194 | socketClient.Shutdown(SocketShutdown.Both); 195 | socketClient.Close(); 196 | callback(new ServerStatus( 197 | String.Format(Resources._0RefusedTooManyConnections, addr))); 198 | } 199 | } 200 | catch (Exception ex) 201 | { 202 | Console.Write("EXCEPTION: Can't process callback " + ex.Message); 203 | } 204 | } 205 | 206 | private void Send(Client client, String data) 207 | { 208 | var byteData = Encoding.ASCII.GetBytes(data); 209 | try 210 | { 211 | client.socket.BeginSend(byteData, 0, byteData.Length, 0, 212 | new AsyncCallback(SendCallback), client); 213 | } 214 | catch (SocketException ex) 215 | { 216 | Console.Write("EXCEPTION: Send error " + ex.Message); 217 | ClientRemove(client); 218 | } 219 | } 220 | 221 | private void SendCallback(IAsyncResult ar) 222 | { 223 | var client = (Client)ar.AsyncState; 224 | try 225 | { 226 | client.socket.EndSend(ar); 227 | } 228 | catch (SocketException ex) 229 | { 230 | Console.Write("EXCEPTION: SendCallback error " + ex.Message); 231 | ClientRemove(client); 232 | } 233 | } 234 | 235 | private bool IsConnected(Socket socket) 236 | { 237 | try 238 | { 239 | return !(socket.Poll(1, SelectMode.SelectRead) && socket.Available == 0); 240 | } 241 | catch (SocketException ex) 242 | { 243 | Console.Write("EXCEPTION: IsConnected error " + ex.Message); 244 | return false; 245 | } 246 | } 247 | 248 | private void OnTimerAlive(object source, ElapsedEventArgs e) 249 | { 250 | List disconnected = new List(); 251 | 252 | lock (lockClients) 253 | { 254 | foreach (Client client in clients) 255 | if (!IsConnected(client.socket)) 256 | disconnected.Add(client); 257 | foreach (Client client in disconnected) 258 | ClientRemove(client); 259 | } 260 | } 261 | 262 | private static string NmeaCoord(double coord, bool isLat) 263 | { 264 | string direct; 265 | 266 | if (isLat) 267 | { 268 | if (coord < 0) 269 | direct = "S"; 270 | else 271 | direct = "N"; 272 | } 273 | else 274 | { 275 | if (coord < 0) 276 | direct = "W"; 277 | else 278 | direct = "E"; 279 | } 280 | 281 | coord = Math.Abs(coord); 282 | 283 | int deg = (int)Math.Floor(coord); 284 | double min = (coord % 1) * 60; 285 | var nmea = deg.ToString() + min.ToString("00.0000000", CultureInfo.InvariantCulture) + "," + direct; 286 | return nmea; 287 | } 288 | 289 | private static string NmeaChecksum(string sentence) 290 | { 291 | var checksum = 0; 292 | 293 | for (var i = 0; i < sentence.Length; i++) 294 | checksum ^= sentence[i]; 295 | 296 | return "*" + checksum.ToString("X2"); 297 | } 298 | 299 | private static string NmeaFormat(Location location) 300 | { 301 | var lat = NmeaCoord(location.lat, true); 302 | var lon = NmeaCoord(location.lon, false); 303 | var alt = location.alt.ToString("F1"); 304 | var speed = (location.speed * 1.9).ToString("F3"); 305 | var time = location.time.ToString("HHmmss.ff"); 306 | var date = location.time.ToString("ddMMyy"); 307 | var ha = location.ha.ToString("0.00", CultureInfo.InvariantCulture); 308 | 309 | var gga = String.Format("GPGGA,{0},{1},{2},1,12,1,{3},M,,,,", time, lat, lon, alt); 310 | var gll = String.Format("GPGLL,{0},{1},{2},A", lat, lon, time); 311 | var rmc = String.Format("GPRMC,{0},A,{1},{2},{3},{4},{5},0.0,E,A", time, lat, lon, speed, ha, date); 312 | var gsa = "GPGSA,A,3,04,05,06,09,12,20,22,24,25,26,28,30,1,1,1,"; 313 | var vgt = String.Format("GPVTG,{0},T,{0},M,0,N,0,K", ha); 314 | 315 | gga = "$" + gga + NmeaChecksum(gga) + "\r\n"; 316 | gll = "$" + gll + NmeaChecksum(gll) + "\r\n"; 317 | rmc = "$" + rmc + NmeaChecksum(rmc) + "\r\n"; 318 | gsa = "$" + gsa + NmeaChecksum(gsa) + "\r\n"; 319 | vgt = "$" + vgt + NmeaChecksum(vgt) + "\r\n"; 320 | 321 | string responce = gga + gll + rmc + gsa + vgt; 322 | 323 | return responce; 324 | 325 | /* 326 | +$GPGGA,101338.00,4630.9471,N,00719.523,E,1,12,1,3623.8,M,,,,*26 327 | +$GPGLL,4630.9471,N,00719.523,E,101338.00,A*3D 328 | +$GPRMC,101338.00,A,4630.9471,N,00719.523,E,0,33.83,250221,0.91,E*4A 329 | $GPGSV,3,1,12,04,26,291,92,05,32,062,86,06,05,029,33,09,47,095,98*78 330 | $GPGSV,3,2,12,12,60,224,88,20,21,240,85,22,28,311,93,24,81,037,77*78 331 | $GPGSV,3,3,12,25,160,124,85,26,321,240,90,28,90,200,90,30,181,137,87*65 332 | +$GPGSA,A,3,04,05,06,09,12,20,22,24,25,26,28,30,1,1,1,*02 333 | $GPVTG,33.84,T,32.93,M,0,N,0,K*49 334 | */ 335 | } 336 | 337 | private void UpdateCount() 338 | { 339 | callback(new ServerStatus(ServerStatusCode.CONN, 340 | clients.Count)); 341 | } 342 | 343 | public void GpsUpdate(Location location) 344 | { 345 | lock (lockGps) 346 | location = new Location(location); 347 | 348 | lock (lockClients) 349 | foreach (var client in clients.ToArray()) 350 | Send(client, NmeaFormat(location)); 351 | } 352 | 353 | public void Stop() 354 | { 355 | cancel = true; 356 | signal.Set(); 357 | } 358 | } 359 | 360 | enum ServerStatusCode { OK, ERROR, CONN }; 361 | 362 | class ServerStatus 363 | { 364 | public ServerStatusCode status { get; set; } 365 | public string message { get; set; } 366 | public int value { get; set; } 367 | 368 | public ServerStatus(string message) 369 | { 370 | this.status = ServerStatusCode.OK; 371 | this.message = message; 372 | this.value = 0; 373 | } 374 | 375 | public ServerStatus(ServerStatusCode status, string message) 376 | { 377 | this.status = status; 378 | this.message = message; 379 | this.value = 0; 380 | } 381 | 382 | public ServerStatus(ServerStatusCode status, int value) 383 | { 384 | this.status = status; 385 | this.message = null; 386 | this.value = value; 387 | } 388 | 389 | } 390 | 391 | class Location 392 | { 393 | public double lat { get; set; } 394 | public double lon { get; set; } 395 | public double alt { get; set; } 396 | public double speed { get; set; } 397 | public double ha { get; set; } 398 | public double va { get; set; } 399 | public DateTimeOffset time { get; set; } 400 | 401 | public Location() 402 | { 403 | } 404 | 405 | public Location(Location original) 406 | { 407 | lat = original.lat; 408 | lon = original.lon; 409 | alt = original.alt; 410 | speed = original.speed; 411 | ha = original.ha; 412 | va = original.va; 413 | time = original.time; 414 | } 415 | } 416 | 417 | delegate void CallbackUI(ServerStatus status); 418 | } -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/RadarClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text.RegularExpressions; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Input; 8 | using System.Windows.Media; 9 | using System.Windows.Media.Imaging; 10 | using System.Windows.Shapes; 11 | 12 | namespace MSFS_Kinetic_Assistant 13 | { 14 | class RadarClass 15 | { 16 | public void InitRadar(Canvas RadarCanvas, double coverScale, double allowedRadarScale) 17 | { 18 | Canvas group = new Canvas(); 19 | group.Width = 250; 20 | group.Height = 250; 21 | group.Name = "CompassRose"; 22 | 23 | for (int i = 0; i < 36; i++) 24 | { 25 | Polyline polyline1 = new Polyline(); 26 | polyline1.Points.Add(new Point(125, 0)); 27 | polyline1.Points.Add(new Point(125, i % 9 == 0 ? 20 : 10)); 28 | polyline1.Stroke = i == 0 ? Brushes.DarkRed : Brushes.Black; 29 | polyline1.StrokeThickness = i % 9 == 0 ? 2 : 1; 30 | 31 | RotateTransform rotateTransform = new RotateTransform(10 * i, 125, 125); 32 | polyline1.RenderTransform = rotateTransform; 33 | 34 | Canvas.SetLeft(polyline1, 0); 35 | Canvas.SetTop(polyline1, 0); 36 | group.Children.Add(polyline1); 37 | 38 | if (i % 9 == 0) 39 | { 40 | TextBlock northLabel = new TextBlock(); 41 | northLabel.FontSize = 14; 42 | northLabel.Margin = new Thickness(100, 20, 100, 0); 43 | northLabel.Width = 50; 44 | northLabel.TextAlignment = TextAlignment.Center; 45 | 46 | switch (i) 47 | { 48 | case 0: 49 | northLabel.Text = "N"; 50 | northLabel.Foreground = new SolidColorBrush(Colors.DarkRed); 51 | break; 52 | case 9: 53 | northLabel.Text = "E"; 54 | northLabel.Foreground = new SolidColorBrush(Colors.Black); 55 | break; 56 | case 18: 57 | northLabel.Text = "S"; 58 | northLabel.Foreground = new SolidColorBrush(Colors.Black); 59 | break; 60 | case 27: 61 | northLabel.Text = "W"; 62 | northLabel.Foreground = new SolidColorBrush(Colors.Black); 63 | break; 64 | } 65 | 66 | RotateTransform rotateTransform2 = new RotateTransform(10 * i, 25, 105); 67 | northLabel.RenderTransform = rotateTransform2; 68 | group.Children.Add(northLabel); 69 | } 70 | } 71 | 72 | Canvas.SetZIndex(group, 1001); 73 | RadarCanvas.Children.Add(group); 74 | 75 | Canvas group2 = new Canvas(); 76 | group2.Width = 250; 77 | group2.Height = 250; 78 | group2.Name = "WindPointer"; 79 | 80 | Polygon polygon = new Polygon(); 81 | polygon.Points.Add(new Point(125, 20)); 82 | polygon.Points.Add(new Point(145, 0)); 83 | polygon.Points.Add(new Point(105, 0)); 84 | polygon.Fill = Brushes.DarkBlue; 85 | 86 | Canvas.SetLeft(polygon, 0); 87 | Canvas.SetTop(polygon, 0); 88 | group2.Children.Add(polygon); 89 | 90 | TextBlock windForce = new TextBlock(); 91 | windForce.Foreground = new SolidColorBrush(Colors.White); 92 | windForce.FontSize = 14; 93 | windForce.Margin = new Thickness(100, -2, 100, 0); 94 | windForce.Width = 50; 95 | windForce.Text = "0"; 96 | windForce.TextAlignment = TextAlignment.Center; 97 | group2.Children.Add(windForce); 98 | Canvas.SetZIndex(group2, 1002); 99 | 100 | RadarCanvas.Children.Add(group2); 101 | 102 | Canvas group3 = new Canvas(); 103 | group3.Width = 50; 104 | group3.Height = 30; 105 | group3.Name = "Plane"; 106 | group3.Opacity = 0.5; 107 | group3.Background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/media/gliderIcon.png"))); 108 | 109 | Line dashV = new Line(); 110 | Line dashH = new Line(); 111 | dashV.Fill = dashH.Fill = new SolidColorBrush(Color.FromArgb(255, 0, 0, 255)); 112 | dashV.Stroke = dashH.Stroke = new SolidColorBrush(Color.FromArgb(255, 0, 0, 255)); 113 | DoubleCollection dashArray = new DoubleCollection(); 114 | dashArray.Add(2); 115 | dashArray.Add(4); 116 | dashH.StrokeDashArray = dashV.StrokeDashArray = dashArray; 117 | dashH.StrokeThickness = 1; 118 | dashH.X1 = dashV.Y1 = 0; 119 | dashH.X2 = dashV.Y2 = 250; 120 | dashH.Y1 = dashH.Y2 = dashV.X1 = dashV.X2 = 125; 121 | 122 | RadarCanvas.Children.Add(dashH); 123 | Canvas.SetZIndex(dashH, 1003); 124 | RadarCanvas.Children.Add(dashV); 125 | Canvas.SetZIndex(dashV, 1003); 126 | 127 | 128 | Canvas.SetLeft(group3, 100); 129 | Canvas.SetTop(group3, 110); 130 | Canvas.SetZIndex(group3, 1003); 131 | 132 | RadarCanvas.Children.Add(group3); 133 | 134 | if (allowedRadarScale < 50) 135 | { 136 | Canvas group4 = new Canvas(); 137 | group4.Name = "RadarCover"; 138 | group4.Background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/media/RadarCover.png"))); 139 | Canvas.SetZIndex(group4, 1000); 140 | RadarCanvas.Children.Add(group4); 141 | updateRadarCover(RadarCanvas, coverScale); 142 | } 143 | } 144 | public void ClearRadar(Canvas RadarCanvas) 145 | { 146 | RadarCanvas.Children.Clear(); 147 | } 148 | 149 | // COVER 150 | public void updateRadarCover(Canvas RadarCanvas, double coverScale) 151 | { 152 | foreach (var el in RadarCanvas.Children) 153 | { 154 | if (el.GetType() == typeof(Canvas) && ((Canvas)el).Name == "RadarCover") 155 | { 156 | Canvas cover = ((Canvas)el); 157 | cover.Width = 250 / coverScale; 158 | cover.Height = 250 / coverScale; 159 | Canvas.SetLeft(cover, -cover.Width / 2 + 125); 160 | Canvas.SetTop(cover, -cover.Height / 2 + 125); 161 | 162 | break; 163 | } 164 | } 165 | } 166 | 167 | // COMPASS 168 | public void updateCompassWind(Canvas RadarCanvas, double heading, double windDirection, double windForce) 169 | { 170 | foreach (var el in RadarCanvas.Children) 171 | { 172 | if (el.GetType() == typeof(Canvas) && ((Canvas)el).Name == "CompassRose") 173 | { 174 | RotateTransform rotateTransform1 = new RotateTransform(-heading * 180 / Math.PI, 125, 125); 175 | ((Canvas)el).RenderTransform = rotateTransform1; 176 | } 177 | else if (el.GetType() == typeof(Canvas) && ((Canvas)el).Name == "WindPointer") 178 | { 179 | RotateTransform rotateTransform1 = new RotateTransform((-heading + windDirection) * 180 / Math.PI, 125, 125); 180 | ((Canvas)el).RenderTransform = rotateTransform1; 181 | 182 | foreach (var lbl in ((Canvas)el).Children) 183 | { 184 | if (lbl.GetType() == typeof(TextBlock)) 185 | { 186 | ((TextBlock)lbl).Text = windForce.ToString("0"); 187 | } 188 | } 189 | } 190 | } 191 | } 192 | 193 | // WINCH 194 | public void InsertWinch(Canvas RadarCanvas) 195 | { 196 | Canvas group = new Canvas(); 197 | group.Width = 20; 198 | group.Height = 20; 199 | group.Name = "Winch"; 200 | 201 | group.Background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/media/winchIcon.png"))); 202 | group.Opacity = 0.5; 203 | 204 | RadarCanvas.Children.Add(group); 205 | } 206 | 207 | public void RemoveWinch(Canvas RadarCanvas) 208 | { 209 | try 210 | { 211 | var forRemoving = new List(); 212 | foreach (UIElement el in RadarCanvas.Children) 213 | { 214 | if (el.GetType() == typeof(Canvas) && (((Canvas)el).Name == "Winch")) 215 | { 216 | forRemoving.Add((Canvas)el); 217 | } 218 | } 219 | 220 | foreach (var item in forRemoving) 221 | RadarCanvas.Children.Remove(item); 222 | 223 | } 224 | catch (Exception ex) 225 | { 226 | Console.WriteLine("FAILED to clear winch: " + ex.Message); 227 | } 228 | } 229 | 230 | public void UpdateWinch(Canvas RadarCanvas, winchDirection winchPosition, double scale) 231 | { 232 | scale = Math.Max(0.1, scale) / 125 * 1000; 233 | 234 | try 235 | { 236 | foreach (UIElement el in RadarCanvas.Children) 237 | { 238 | if (el.GetType() == typeof(Canvas) && (((Canvas)el).Name == "Winch")) 239 | { 240 | Canvas canvas = (Canvas)el; 241 | Canvas.SetLeft(canvas, 125 - 10 + winchPosition.groundDistance / scale * Math.Sin(winchPosition.heading)); 242 | Canvas.SetTop(canvas, 125 - 10 - winchPosition.groundDistance / scale * Math.Cos(winchPosition.heading)); 243 | } 244 | } 245 | } 246 | catch (Exception ex) 247 | { 248 | Console.WriteLine("FAILED to update winch position: " + ex.Message); 249 | } 250 | } 251 | 252 | // NEARBY 253 | public void InsertRadarNearby(Canvas RadarCanvas, SortedDictionary nearbyDict, MainWindow parent) 254 | { 255 | clearRadarNearby(RadarCanvas); 256 | 257 | Canvas group = new Canvas(); 258 | group.Width = 250; 259 | group.Height = 250; 260 | group.Name = "Nearbies"; 261 | Canvas.SetZIndex(group, 1005); 262 | 263 | int id = 0; 264 | 265 | foreach (KeyValuePair btn in nearbyDict) 266 | { 267 | Ellipse ellipse = new Ellipse(); 268 | ellipse.Name = "Nearby_" + btn.Value.Tag.ToString(); 269 | ellipse.Visibility = Visibility.Collapsed; 270 | group.Children.Add(ellipse); 271 | 272 | Button label = new Button(); 273 | label.Cursor = Cursors.Hand; 274 | label.Name = "NearbyLabel_" + btn.Value.Tag.ToString(); 275 | label.Tag = btn.Value.Tag; 276 | label.Click += parent.attachTowCable; 277 | label.Content = btn.Value.Content.ToString().Split('(')[0]; 278 | label.BorderThickness = new Thickness(0); 279 | label.Visibility = Visibility.Collapsed; 280 | label.Background = new SolidColorBrush(Colors.Transparent); 281 | group.Children.Add(label); 282 | 283 | id++; 284 | } 285 | 286 | Console.WriteLine(id + " radar nearbies loaded"); 287 | RadarCanvas.Children.Add(group); 288 | } 289 | 290 | public void clearRadarNearby(Canvas RadarCanvas) 291 | { 292 | try 293 | { 294 | var forRemoving = new List(); 295 | foreach (UIElement el in RadarCanvas.Children) 296 | { 297 | if (el.GetType() == typeof(Canvas) && (((Canvas)el).Name == "Nearbies")) 298 | { 299 | forRemoving.Add((Canvas)el); 300 | } 301 | } 302 | 303 | foreach (var item in forRemoving) 304 | RadarCanvas.Children.Remove(item); 305 | } 306 | catch (Exception ex) 307 | { 308 | Console.WriteLine("FAILED to clear radar nearbies: " + ex.Message); 309 | } 310 | } 311 | 312 | public void updateRadarNearby(Canvas RadarCanvas, uint id, winchDirection planeDirection, winchPosition planePosition, bool currentTowPlane, double scale) 313 | { 314 | scale = Math.Max(0.1, scale) / 125 * 1000; 315 | 316 | try 317 | { 318 | foreach (UIElement canv in RadarCanvas.Children) 319 | { 320 | if (canv.GetType() == typeof(Canvas) && ((Canvas)canv).Name == "Nearbies") 321 | { 322 | foreach (UIElement el in ((Canvas)canv).Children) 323 | { 324 | if (el.GetType() == typeof(Ellipse) && ((Ellipse)el).Name == "Nearby_" + id.ToString()) 325 | { 326 | Ellipse circle = (Ellipse)el; 327 | 328 | circle.Width = 10; 329 | circle.Height = 10; 330 | SolidColorBrush strokeBrush = new SolidColorBrush(currentTowPlane ? Colors.DarkRed : Colors.DarkGreen); 331 | //strokeBrush.Opacity = Math.Abs(finalModifier); 332 | circle.Fill = strokeBrush; 333 | circle.Visibility = Visibility.Visible; 334 | Canvas.SetLeft(circle, 125 - circle.Width / 2 + planeDirection.groundDistance / scale * Math.Sin(planeDirection.heading)); 335 | Canvas.SetTop(circle, 125 - circle.Height / 2 - planeDirection.groundDistance / scale * Math.Cos(planeDirection.heading)); 336 | } 337 | else if (el.GetType() == typeof(Button) && ((Button)el).Name == "NearbyLabel_" + id.ToString()) 338 | { 339 | Button label = (Button)el; 340 | 341 | label.Visibility = Visibility.Visible; 342 | label.Foreground = new SolidColorBrush(currentTowPlane ? Colors.DarkRed : Colors.DarkGreen); 343 | label.Margin = new Thickness(125 + planeDirection.groundDistance / scale * Math.Sin(planeDirection.heading), 344 | 125 - planeDirection.groundDistance / scale * Math.Cos(planeDirection.heading), 0, 0); 345 | } 346 | } 347 | 348 | break; 349 | } 350 | } 351 | } 352 | catch (Exception ex) 353 | { 354 | Console.WriteLine("Failed to update radar nearby: " + ex.Message); 355 | } 356 | } 357 | 358 | 359 | // THERMALS 360 | public void insertRadarThermals(Canvas RadarCanvas, List thermalsList, string lbl) 361 | { 362 | Canvas group = new Canvas(); 363 | group.Width = 250; 364 | group.Height = 250; 365 | group.Name = lbl + "s"; 366 | 367 | int id = 0; 368 | for (; id < thermalsList.Count; id++) 369 | { 370 | Ellipse ellipse = new Ellipse(); 371 | ellipse.Name = lbl + "_" + id; 372 | group.Children.Add(ellipse); 373 | 374 | Label label = new Label(); 375 | label.Name = "Label_" + lbl + "_" + id; 376 | label.FontSize = 12; 377 | label.Content = Math.Round(thermalsList[id].airspeed) + "m/s" + (thermalsList[id].alt > 1000 ? Environment.NewLine + (thermalsList[id].alt / 0.305).ToString("0") + "ft AGL" : ""); 378 | label.Foreground = new SolidColorBrush(Colors.DarkRed); 379 | group.Children.Add(label); 380 | } 381 | 382 | Console.WriteLine(id + " radar " + lbl + "s loaded"); 383 | RadarCanvas.Children.Add(group); 384 | } 385 | 386 | public void clearRadarThermals(Canvas RadarCanvas, string lbl) 387 | { 388 | try 389 | { 390 | var forRemoving = new List(); 391 | foreach (UIElement el in RadarCanvas.Children) 392 | { 393 | if (el.GetType() == typeof(Canvas) && (((Canvas)el).Name == lbl + "s")) 394 | { 395 | forRemoving.Add((Canvas)el); 396 | } 397 | } 398 | 399 | foreach (var item in forRemoving) 400 | RadarCanvas.Children.Remove(item); 401 | } 402 | catch (Exception ex) 403 | { 404 | Console.WriteLine("FAILED to clear radar thermals: " + ex.Message); 405 | } 406 | } 407 | 408 | public void updateRadarThermals(Canvas RadarCanvas, string id, winchDirection thermalDirection, winchPosition thermalPosition, double finalModifier, double scale) 409 | { 410 | scale = Math.Max(0.1, scale) / 125 * 1000; 411 | 412 | try 413 | { 414 | foreach (UIElement canv in RadarCanvas.Children) 415 | { 416 | if (canv.GetType() == typeof(Canvas) && ((Canvas)canv).Name == id.Split('_')[0] + "s") 417 | { 418 | foreach (UIElement el in ((Canvas)canv).Children) 419 | { 420 | if (el.GetType() == typeof(Ellipse) && ((Ellipse)el).Name == id) 421 | { 422 | Ellipse circle = (Ellipse)el; 423 | 424 | circle.Width = thermalPosition.radius * 2 / scale; 425 | circle.Height = thermalPosition.radius * 2 / scale; 426 | SolidColorBrush strokeBrush = new SolidColorBrush(finalModifier >= 0 ? Colors.Red : Colors.Blue); 427 | strokeBrush.Opacity = Math.Abs(finalModifier >= 0 ? Math.Max(0.1, finalModifier) : Math.Min(-0.1, finalModifier)); 428 | circle.Fill = strokeBrush; 429 | Canvas.SetLeft(circle, 125 - circle.Width / 2 + thermalDirection.groundDistance / scale * Math.Sin(thermalDirection.heading)); 430 | Canvas.SetTop(circle, 125 - circle.Height / 2 - thermalDirection.groundDistance / scale * Math.Cos(thermalDirection.heading)); 431 | 432 | //Console.WriteLine(id + " scale: " + scale + " modif: " + finalModifier); 433 | 434 | //break; 435 | } 436 | else if (el.GetType() == typeof(Label) && ((Label)el).Name == "Label_" + id) 437 | { 438 | Label label = (Label)el; 439 | 440 | Canvas.SetLeft(label, 110 + thermalDirection.groundDistance / scale * Math.Sin(thermalDirection.heading)); 441 | Canvas.SetTop(label, 115 - thermalDirection.groundDistance / scale * Math.Cos(thermalDirection.heading)); 442 | 443 | //break; 444 | } 445 | } 446 | 447 | break; 448 | } 449 | } 450 | } 451 | catch (Exception ex) 452 | { 453 | Console.WriteLine("Failed to update radar thermals: " + ex.Message); 454 | } 455 | } 456 | 457 | // WAYPOINTS 458 | public string sanitizeString(string name) 459 | { 460 | if (name.Contains('|')) 461 | name = name.Split('|')[0]; 462 | 463 | Regex rgx = new Regex("[^a-zA-Z0-9]"); 464 | return rgx.Replace(name, "_"); 465 | } 466 | public void insertRadarWaypoints(Canvas RadarCanvas, List waypointsList) 467 | { 468 | clearRadarWaypoints(RadarCanvas); 469 | 470 | Canvas group = new Canvas(); 471 | group.Width = 250; 472 | group.Height = 250; 473 | group.Name = "Waypoints"; 474 | 475 | int id = 0; 476 | foreach (var wp in waypointsList) 477 | { 478 | /*Ellipse ellipse = new Ellipse(); 479 | ellipse.Name = "Waypoint_" + wp.Name;*/ 480 | Canvas arc = new Canvas(); 481 | arc.Name = "Waypoint_" + sanitizeString(wp.Name) + wp.ID; // UNIQUE NAME! 482 | group.Children.Add(arc); 483 | 484 | Line leg = new Line(); 485 | leg.Name = "Leg_" + sanitizeString(wp.Name) + wp.ID; 486 | group.Children.Add(leg); 487 | 488 | Label label = new Label(); 489 | label.Name = "Label_" + sanitizeString(wp.Name) + wp.ID; 490 | label.FontSize = 10; 491 | string name = wp.Name; 492 | if (name.Contains('|')) 493 | { 494 | string data = name.Split('|')[1].Trim(); 495 | name = name.Split('|')[0].Trim(); 496 | } 497 | label.Content = name + Environment.NewLine + "MIN: " + wp.Elevation + "ft" + Environment.NewLine + "MAX: " + wp.Height + "ft"; 498 | group.Children.Add(label); 499 | 500 | id++; 501 | } 502 | 503 | Console.WriteLine(id + " radar waypoints loaded"); 504 | RadarCanvas.Children.Add(group); 505 | } 506 | 507 | public void clearRadarWaypoints(Canvas RadarCanvas) 508 | { 509 | try 510 | { 511 | var forRemoving = new List(); 512 | foreach (UIElement el in RadarCanvas.Children) 513 | { 514 | if (el.GetType() == typeof(Canvas) && (((Canvas)el).Name == "Waypoints")) 515 | { 516 | forRemoving.Add((Canvas)el); 517 | } 518 | } 519 | 520 | foreach (var item in forRemoving) 521 | RadarCanvas.Children.Remove(item); 522 | } 523 | catch (Exception ex) 524 | { 525 | Console.WriteLine("FAILED to clear radar waypoints: " + ex.Message); 526 | } 527 | } 528 | 529 | public void updateRadarWaypoints(Canvas RadarCanvas, Waypoint wp, double distance, double heading, double width, double scale, double nextBearing, double nextDistance, double altitude) 530 | { 531 | scale = Math.Max(0.1, scale) / 125 * 1000; 532 | 533 | try 534 | { 535 | foreach (UIElement canv in RadarCanvas.Children) 536 | { 537 | if (canv.GetType() == typeof(Canvas) && ((Canvas)canv).Name == "Waypoints") 538 | { 539 | foreach (var el in ((Canvas)canv).Children) 540 | { 541 | double opacity = !string.IsNullOrEmpty(wp.Entered) || !string.IsNullOrEmpty(wp.Passed) ? 0.1 : 0.5; ; 542 | 543 | if (el.GetType() == typeof(Canvas) && ((Canvas)el).Name == "Waypoint_" + sanitizeString(wp.Name) + wp.ID) 544 | { 545 | Canvas cnv = (Canvas)el; 546 | 547 | cnv.Width = width / scale; 548 | cnv.Height = width / 2 / scale; 549 | Canvas.SetLeft(cnv, 125 - cnv.Width / 2 + distance / scale * Math.Sin(heading)); 550 | Canvas.SetTop(cnv, 125 - distance / scale * Math.Cos(heading)); 551 | cnv.Background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/media/wp.png"))); 552 | cnv.Background.Opacity = opacity; 553 | 554 | RotateTransform rotateTransform = new RotateTransform(nextBearing * 180 / Math.PI, cnv.Width / 2, 0); 555 | cnv.RenderTransform = rotateTransform; 556 | 557 | //break; 558 | } 559 | else if (el.GetType() == typeof(Line) && ((Line)el).Name == "Leg_" + sanitizeString(wp.Name) + wp.ID) 560 | { 561 | Line leg = (Line)el; 562 | 563 | SolidColorBrush strokeBrush = new SolidColorBrush(Color.FromArgb(255, 0, 170, 0)); 564 | strokeBrush.Opacity = 0.5; 565 | leg.Stroke = strokeBrush; 566 | 567 | leg.X1 = 125 + distance / scale * Math.Sin(heading); 568 | leg.X2 = 125 + distance / scale * Math.Sin(heading) + nextDistance / scale * Math.Sin(nextBearing); ; 569 | leg.Y1 = 125 - distance / scale * Math.Cos(heading); 570 | leg.Y2 = 125 - distance / scale * Math.Cos(heading) - nextDistance / scale * Math.Cos(nextBearing); 571 | 572 | //break; 573 | } 574 | else if (el.GetType() == typeof(Label) && ((Label)el).Name == "Label_" + sanitizeString(wp.Name) + wp.ID) 575 | { 576 | Label label = (Label)el; 577 | if (altitude == 0) 578 | label.Foreground = new SolidColorBrush(Colors.Black); 579 | else 580 | label.Foreground = new SolidColorBrush(altitude > 0 ? Colors.DarkRed : Colors.DarkBlue); 581 | 582 | Canvas.SetLeft(label, 125 + distance / scale * Math.Sin(heading)); 583 | Canvas.SetTop(label, 125 - distance / scale * Math.Cos(heading)); 584 | 585 | break; 586 | } 587 | } 588 | 589 | break; 590 | } 591 | } 592 | } 593 | catch (Exception ex) 594 | { 595 | Console.WriteLine("Failed to update radar waypoints: " + ex.Message); 596 | } 597 | } 598 | } 599 | } 600 | -------------------------------------------------------------------------------- /MSFS Kinetic Assistant/Tracking.cs: -------------------------------------------------------------------------------- 1 | using CTrue.FsConnect; 2 | using Newtonsoft.Json; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Globalization; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows; 11 | using System.Windows.Controls; 12 | using System.Windows.Input; 13 | using System.Xml.Linq; 14 | 15 | namespace MSFS_Kinetic_Assistant 16 | { 17 | class Tracking 18 | { 19 | public double lastTrackCapture = 0; 20 | public List trackRecording = null; 21 | public List trackRecorded = null; 22 | public double recordingCounter = 0; 23 | public double lastRecordingCounter = 0; 24 | const uint TARGETMAX = 99999999; 25 | 26 | //public List trackPlaying = null; 27 | //public double trackPlayingTimer = 0; 28 | //public string trackPlayingModel = ""; 29 | //public GeoLocation trackPlayingCoords = null; 30 | 31 | public KeyValuePair message = new KeyValuePair(); 32 | public string lastMessage = ""; 33 | 34 | public List ghostPlanes = new List(); 35 | public winchPosition ghostTeleport = new winchPosition(); 36 | public List competitiorsList = new List(); 37 | 38 | public short normalizeAngle(double rad) 39 | { 40 | short deg = (short)((rad * 180 / Math.PI) % 360); 41 | 42 | if (deg < 0) 43 | deg += 360; 44 | else if (deg >= 360) 45 | deg -= 360; 46 | 47 | return deg; 48 | } 49 | public double normalizeRadAngle(double angle) 50 | { 51 | if (angle < 0) { angle += 2 * Math.PI; } 52 | return angle; 53 | } 54 | 55 | public double zeroeRadAngle(double angle) 56 | { 57 | angle %= 2 * Math.PI; 58 | 59 | if (angle > Math.PI) { angle -= 2 * Math.PI; } 60 | else if (angle < -Math.PI) { angle += 2 * Math.PI; } 61 | 62 | return angle; 63 | } 64 | 65 | 66 | public void captureTrackPoint(PlaneInfoResponse _planeInfoResponse, PlaneAvionicsResponse _planeAvionicsResponse, double absoluteTime, double baseInterval = 0.5) 67 | { 68 | double trackCaptureInterval = Math.Abs(_planeInfoResponse.AirspeedIndicated) > baseInterval ? 69 | Math.Max(baseInterval, Math.Abs(_planeInfoResponse.AirspeedIndicated) / 30 - 1) : 70 | baseInterval * 5; 71 | 72 | if (absoluteTime - lastTrackCapture >= trackCaptureInterval) 73 | { 74 | lastTrackCapture = absoluteTime; 75 | trackRecording.Add(new TrackPoint(new GeoLocation(_planeInfoResponse.Latitude, _planeInfoResponse.Longitude), _planeInfoResponse.Altitude, (int)_planeInfoResponse.AltitudeAboveGround, 76 | _planeInfoResponse.VelocityBodyZ, _planeInfoResponse.AirspeedIndicated, normalizeAngle(_planeInfoResponse.PlaneHeading), normalizeAngle(_planeInfoResponse.PlanePitch), normalizeAngle(_planeInfoResponse.PlaneBank), 77 | packLights(_planeAvionicsResponse), packAvionics(_planeAvionicsResponse), DateTime.UtcNow, recordingCounter)); 78 | 79 | Console.WriteLine("Track capture: " + recordingCounter); 80 | } 81 | } 82 | 83 | public KeyValuePair buildTrackFile(string appName, string nickName, PlaneInfoResponse _planeInfoResponse, PlaneAvionicsResponse _planeAvionicsResponse, MathClass _mathClass, string filename, bool timeAligned = false) 84 | { 85 | string str = "" + _planeAvionicsResponse.Title + " - " + nickName + ""; 86 | TrackPoint prev = new TrackPoint(new GeoLocation(0, 0), 0, 0, 0, 0, 0, 0, 0, 0, 0, DateTime.Now, 0); 87 | double distance = 0; 88 | 89 | foreach (TrackPoint trackPoint in trackRecording) 90 | { 91 | if (prev.Elevation != 0) 92 | { 93 | double flatDistance = _mathClass.findDistanceBetweenPoints(prev.Location.Latitude, prev.Location.Longitude, trackPoint.Location.Latitude, trackPoint.Location.Longitude); 94 | distance += flatDistance / Math.Cos((prev.Elevation - trackPoint.Elevation) / flatDistance); 95 | } 96 | 97 | DateTime timestamp = !timeAligned ? trackPoint.Time : (new DateTime(2000, 1, 1)).AddSeconds(trackPoint.Timer); 98 | 99 | str += Environment.NewLine + "" + 100 | Environment.NewLine + " " + trackPoint.Elevation.ToString(CultureInfo.InvariantCulture) + "" + 101 | Environment.NewLine + " " + trackPoint.AltitudeAboveGround.ToString() + "" + 102 | Environment.NewLine + " " + trackPoint.Velocity.ToString(CultureInfo.InvariantCulture) + "" + 103 | Environment.NewLine + " " + trackPoint.Airspeed.ToString(CultureInfo.InvariantCulture) + "" + 104 | Environment.NewLine + " " + trackPoint.Heading + "" + 105 | Environment.NewLine + " " + trackPoint.Pitch + "" + 106 | Environment.NewLine + " " + trackPoint.Roll + "" + 107 | Environment.NewLine + " " + trackPoint.Lights.ToString() + "" + 108 | Environment.NewLine + " " + trackPoint.Avionics.ToString() + "" + 109 | Environment.NewLine + " " + 110 | Environment.NewLine + ""; 111 | 112 | prev = trackPoint; 113 | } 114 | 115 | str += ""; 116 | 117 | if (trackRecording.Count <= 1) 118 | { 119 | //addLogMessage("Track data damaged!", 2); 120 | } 121 | 122 | 123 | return new KeyValuePair(distance, str); 124 | } 125 | 126 | public GhostPlane parseTrackFile(string file, MathClass _mathClass, double allowedRecordLength) 127 | { 128 | GhostPlane ghostPlane = new GhostPlane(); 129 | 130 | Console.WriteLine("Parsing " + file); 131 | XElement trackpointsXml = XElement.Load(file); 132 | if (trackpointsXml != null) 133 | { 134 | ghostPlane.TrackPoints = new List(); 135 | ghostPlane.ID = TARGETMAX; 136 | 137 | if (trackpointsXml.Descendants("name").First() != null) 138 | { 139 | string[] title = trackpointsXml.Descendants("name").First().Value.Split(new string[] { " - " }, StringSplitOptions.None); 140 | ghostPlane.Name = title[0].Trim(); 141 | ghostPlane.Username = title.Length > 1 ? title[1] : ""; 142 | } 143 | else 144 | { 145 | ghostPlane.Name = "DA40-NG Asobo"; 146 | ghostPlane.Username = ""; 147 | } 148 | 149 | double counter = 0; 150 | DateTime lastTimer = new DateTime(); 151 | 152 | double latitudeOffset = 0; 153 | double longitudeOffset = 0; 154 | double headingOffset = 0; 155 | double altitudeOffset = 0; 156 | GeoLocation root = new GeoLocation(0, 0); 157 | 158 | foreach (var trackPoint in trackpointsXml.Descendants("trkseg").First().Elements("trkpt")) 159 | { 160 | try 161 | { 162 | // FREE VERSION 163 | if (counter > allowedRecordLength) 164 | break; 165 | 166 | double.TryParse(trackPoint.Attribute("lat").Value, NumberStyles.Any, CultureInfo.InvariantCulture, out double lat); 167 | double.TryParse(trackPoint.Attribute("lon").Value, NumberStyles.Any, CultureInfo.InvariantCulture, out double lon); 168 | lat *= Math.PI / 180; 169 | lon *= Math.PI / 180; 170 | 171 | if (counter == 0) 172 | root = new GeoLocation(lat, lon); 173 | 174 | double ele = 1000; 175 | double.TryParse(trackPoint.Element("ele").Value, NumberStyles.Any, CultureInfo.InvariantCulture, out ele); 176 | DateTime time = DateTime.Parse(trackPoint.Element("time").Value); 177 | 178 | int agl = 10; 179 | if (trackPoint.Element("agl") != null) 180 | int.TryParse(trackPoint.Element("agl").Value, NumberStyles.Any, CultureInfo.InvariantCulture, out agl); 181 | 182 | double velocity = 0; 183 | if (trackPoint.Element("velocity") != null) 184 | double.TryParse(trackPoint.Element("velocity").Value, NumberStyles.Any, CultureInfo.InvariantCulture, out velocity); 185 | 186 | double airspeed = 0; 187 | if (trackPoint.Element("airspeed") != null) 188 | double.TryParse(trackPoint.Element("airspeed").Value, NumberStyles.Any, CultureInfo.InvariantCulture, out velocity); 189 | 190 | short heading = 0; 191 | if (trackPoint.Element("heading") != null) 192 | short.TryParse(trackPoint.Element("heading").Value, NumberStyles.Any, CultureInfo.InvariantCulture, out heading); 193 | 194 | short pitch = 0; 195 | if (trackPoint.Element("pitch") != null) 196 | short.TryParse(trackPoint.Element("pitch").Value, NumberStyles.Any, CultureInfo.InvariantCulture, out pitch); 197 | 198 | short roll = 0; 199 | if (trackPoint.Element("roll") != null) 200 | short.TryParse(trackPoint.Element("roll").Value, NumberStyles.Any, CultureInfo.InvariantCulture, out roll); 201 | 202 | int lights = 0; 203 | if (trackPoint.Element("lights") != null) 204 | int.TryParse(trackPoint.Element("lights").Value, NumberStyles.Any, CultureInfo.InvariantCulture, out lights); 205 | 206 | int avionics = 0; 207 | if (trackPoint.Element("avionics") != null) 208 | int.TryParse(trackPoint.Element("avionics").Value, NumberStyles.Any, CultureInfo.InvariantCulture, out avionics); 209 | 210 | if (counter != 0) 211 | counter += (time - lastTimer).TotalSeconds; 212 | 213 | GeoLocation loc = new GeoLocation(lat, lon); 214 | 215 | // START OFFSETS 216 | if (ghostTeleport.alt != 0 && altitudeOffset == 0) 217 | { 218 | //Console.WriteLine(JsonConvert.SerializeObject(ghostTeleport, Formatting.Indented)); 219 | latitudeOffset = ghostTeleport.location.Latitude - loc.Latitude; 220 | longitudeOffset = ghostTeleport.location.Longitude - loc.Longitude; 221 | headingOffset = (ghostTeleport.radius * 180 / Math.PI) - heading; 222 | altitudeOffset = ghostTeleport.alt - ele; 223 | Console.WriteLine("Offsets: lat" + latitudeOffset + " lon" + longitudeOffset + " head" + headingOffset + " alt" + altitudeOffset); 224 | } 225 | // CONTINUE OFFSETS 226 | if (ghostTeleport.alt != 0 && ghostPlane.TrackPoints.Count > 0 && _mathClass.findDistanceBetweenPoints(ghostTeleport.location.Latitude, ghostTeleport.location.Longitude, root.Latitude, root.Longitude) > 100) 227 | { 228 | loc = _mathClass.RotatePointFrom(root, headingOffset * Math.PI / 180, loc); 229 | } 230 | 231 | loc.Latitude += latitudeOffset; 232 | loc.Longitude += longitudeOffset; 233 | 234 | heading += (short)headingOffset; 235 | ele += altitudeOffset; 236 | 237 | ghostPlane.TrackPoints.Add(new TrackPoint(loc, ele, agl, velocity, airspeed, 238 | (short)(heading > 180 ? heading - 360 : heading), (short)(pitch > 180 ? pitch - 360 : pitch), (short)(roll > 180 ? roll - 360 : roll), 239 | lights, avionics, time, counter, trackPoint.Element("message") != null ? trackPoint.Element("message").Value : "")); 240 | 241 | if (counter == 0) 242 | { 243 | counter += 0.0001; 244 | } 245 | 246 | lastTimer = time; 247 | } 248 | catch { } 249 | } 250 | 251 | ghostPlane.Length = counter; 252 | 253 | if (ghostPlane.TrackPoints.Count > 0) 254 | { 255 | Console.WriteLine(ghostPlane.TrackPoints.Count + " track points loaded"); 256 | ghostPlanes.Add(ghostPlane); 257 | } 258 | } 259 | else 260 | { 261 | MessageBox.Show("GPX file is invalid"); 262 | } 263 | 264 | //trackPlaying = null; 265 | return ghostPlane; 266 | } 267 | 268 | public int packLights(PlaneAvionicsResponse _planeAvionicsResponse) 269 | { 270 | bool[] myBools = new bool[] { 271 | _planeAvionicsResponse.LIGHTBEACON == 100, 272 | _planeAvionicsResponse.LIGHTCABIN == 100, 273 | _planeAvionicsResponse.LIGHTGLARESHIELD == 100, 274 | _planeAvionicsResponse.LIGHTLANDING == 100, 275 | _planeAvionicsResponse.LIGHTLOGO == 100, 276 | _planeAvionicsResponse.LIGHTNAV == 100, 277 | _planeAvionicsResponse.LIGHTPANEL == 100, 278 | _planeAvionicsResponse.LIGHTPEDESTRAL == 100, 279 | _planeAvionicsResponse.LIGHTPOTENTIOMETER == 100, 280 | _planeAvionicsResponse.LIGHTRECOGNITION == 100, 281 | _planeAvionicsResponse.LIGHTSTROBE == 100, 282 | _planeAvionicsResponse.LIGHTTAXI == 100, 283 | _planeAvionicsResponse.LIGHTWING == 100, 284 | }; 285 | 286 | byte[] byteArray = myBools.Select(b => (byte)(b ? 1 : 0)).ToArray(); 287 | int lights = BitConverter.ToInt32(byteArray, 0); 288 | 289 | return lights; 290 | } 291 | public int packAvionics(PlaneAvionicsResponse _planeAvionicsResponse) 292 | { 293 | return 0; 294 | } 295 | public GhostPlane tryCaptureGhostPlane(uint ID, double absoluteTime) 296 | { 297 | int index = ghostPlanes.FindIndex(m => m.ID == TARGETMAX); 298 | if (index >= 0) 299 | { 300 | GhostPlane gp = ghostPlanes[index]; 301 | gp.ID = ID; 302 | //gp.Progress = 0.00001; 303 | //gp.LastTrackPlayed = absoluteTime; 304 | 305 | ghostPlanes[index] = gp; 306 | 307 | return ghostPlanes[index]; 308 | } 309 | 310 | return new GhostPlane(); 311 | } 312 | public GhostPlane getGhostPlane(uint ID) 313 | { 314 | int index = ghostPlanes.FindIndex(m => m.ID == ID); 315 | if (index >= 0) 316 | { 317 | return ghostPlanes[index]; 318 | } 319 | 320 | return new GhostPlane(); 321 | } 322 | public string possiblyGetPlaneName(uint ID, string name) 323 | { 324 | if (ghostPlanes.Count > 0 && ID > 1) 325 | { 326 | GhostPlane gp = getGhostPlane(ID); 327 | if (!string.IsNullOrEmpty(gp.Username)) 328 | { 329 | return gp.Username; 330 | } 331 | } 332 | 333 | return name; 334 | } 335 | public void playRecords(double absoluteTime) 336 | { 337 | int index; 338 | while ((index = ghostPlanes.FindIndex(m => m.Progress == 0)) >= 0) 339 | { 340 | GhostPlane gp = ghostPlanes[index]; 341 | gp.Progress = 0.00001; 342 | gp.LastTrackPlayed = absoluteTime; 343 | 344 | ghostPlanes[index] = gp; 345 | } 346 | } 347 | 348 | public void clearRecords(FsConnect _fsConnect) 349 | { 350 | foreach (GhostPlane ghostPlane in ghostPlanes) 351 | { 352 | if (ghostPlane.ID != TARGETMAX) 353 | { 354 | _fsConnect.RemoveObject(ghostPlane.ID, Requests.TowPlane); 355 | } 356 | } 357 | ghostPlanes = new List(); 358 | } 359 | 360 | public void clearRecord(FsConnect _fsConnect, uint ID) 361 | { 362 | for (int i = ghostPlanes.Count - 1; i >= 0; i--) 363 | { 364 | if (ID == ghostPlanes[i].ID) 365 | { 366 | _fsConnect.RemoveObject(ghostPlanes[i].ID, Requests.TowPlane); 367 | ghostPlanes.RemoveAt(i); 368 | } 369 | } 370 | } 371 | 372 | public void saveTrackfile(string str, string zipDirectory, string filename, string log = "") 373 | { 374 | try 375 | { 376 | string path = zipDirectory + filename; 377 | Console.WriteLine("Saving to " + path); 378 | 379 | if (!Directory.Exists(zipDirectory)) 380 | { 381 | try 382 | { 383 | Directory.CreateDirectory(zipDirectory); 384 | } 385 | catch 386 | { 387 | MessageBox.Show("Can't create task directory"); 388 | } 389 | } 390 | 391 | File.WriteAllText(path, str); 392 | 393 | if (!string.IsNullOrEmpty(log)) 394 | { 395 | File.WriteAllText(path.Replace(".gpx", ".log"), log); 396 | } 397 | 398 | Console.WriteLine("Track file saved"); 399 | } 400 | catch 401 | { 402 | } 403 | } 404 | public GhostCommit updateGhostPlayer(uint ID, NearbyInfoResponse response, GhostCommit towCommit, FsConnect _fsConnect, MathClass _mathClass, double absoluteTime) 405 | { 406 | int index = 0; 407 | double deltaTime = 0; 408 | 409 | foreach (GhostPlane ghostPlane in ghostPlanes) 410 | { 411 | if (ghostPlane.ID == ID && ghostPlane.Progress > 0 && ghostPlane.TrackPoints.Count > 0) 412 | { 413 | deltaTime = absoluteTime - ghostPlane.LastTrackPlayed; 414 | 415 | TrackPoint prev = new TrackPoint(); 416 | TrackPoint curr = new TrackPoint(); 417 | TrackPoint next = new TrackPoint(); 418 | 419 | bool found = false; 420 | foreach (var point in ghostPlane.TrackPoints) 421 | { 422 | if (!found) 423 | curr = point; 424 | else 425 | { 426 | next = point; 427 | break; 428 | } 429 | 430 | if (prev.Timer < (ghostPlane.Progress + deltaTime) && point.Timer >= (ghostPlane.Progress + deltaTime)) 431 | { 432 | found = true; 433 | 434 | if (!string.IsNullOrEmpty(curr.Message) && lastMessage != curr.Message) 435 | { 436 | message = new KeyValuePair(ghostPlane.ID, point.Message); 437 | lastMessage = point.Message; 438 | } 439 | } 440 | else 441 | prev = point; 442 | } 443 | 444 | if (found && prev.Location != null && curr.Location != null && next.Location != null) 445 | { 446 | try 447 | { 448 | double progress = ((ghostPlane.Progress + deltaTime) - prev.Timer) / (curr.Timer - prev.Timer); 449 | double timeLeft = curr.Timer - (ghostPlane.Progress + deltaTime); 450 | 451 | //double distancePrev = _mathClass.findDistanceBetweenPoints(response.Latitude, response.Longitude, prev.Location.Latitude, prev.Location.Longitude); 452 | double distanceCurr = _mathClass.findDistanceBetweenPoints(response.Latitude, response.Longitude, curr.Location.Latitude, curr.Location.Longitude); 453 | //double distanceNext = _mathClass.findDistanceBetweenPoints(response.Latitude, response.Longitude, next.Location.Latitude, next.Location.Longitude); 454 | 455 | /*if (distanceCurr / timeLeft > 1.25 * curr.Velocity) 456 | { 457 | distanceCurr = 1.25 * curr.Velocity * timeLeft; 458 | Console.WriteLine($"TOO FAR FROM NEXT POINT: {distanceCurr:F6}"); 459 | }*/ 460 | 461 | 462 | double bearing = normalizeRadAngle(_mathClass.findBearingToPoint(response.Latitude, response.Longitude, next.Location.Latitude, next.Location.Longitude)); 463 | response.Heading = normalizeRadAngle(response.Heading); 464 | bearing = zeroeRadAngle(bearing - response.Heading); 465 | double newHeading = zeroeRadAngle(response.Heading + (absoluteTime - ghostPlane.LastTrackPlayed) * bearing); 466 | //towCommit.RotationVelocityBodyY = Math.Sin(newHeading - response.Heading); 467 | towCommit.planeHeading = newHeading; 468 | //Console.WriteLine($"Tracking heading: {response.Heading:F4} bearing: {bearing:F4} newHeading: {newHeading:F4}"); 469 | 470 | double requiredBank = ((1 - progress) * (prev.Roll * Math.PI / 180 - response.Bank) + progress * (curr.Roll * Math.PI / 180 - response.Bank)) / 2; 471 | //towCommit.RotationVelocityBodyZ = Math.Sin(requiredBank - response.Bank); 472 | towCommit.planeRoll = requiredBank; 473 | double requiredPitch = ((1 - progress) * (prev.Pitch * Math.PI / 180 - response.Pitch) + progress * (prev.Pitch * Math.PI / 180 - response.Pitch)) / 2; 474 | //towCommit.RotationVelocityBodyX = Math.Sin(requiredPitch - response.Pitch); 475 | towCommit.planePitch = requiredPitch; 476 | 477 | //Console.WriteLine($"RotationVelocityBodyX: {towCommit.RotationVelocityBodyX:F4} RotationVelocityBodyY: {towCommit.RotationVelocityBodyY:F4} RotationVelocityBodyZ: {towCommit.RotationVelocityBodyZ:F4}"); 478 | //towCommit.Heading = newHeading; 479 | 480 | towCommit.VelocityBodyX = 0; 481 | towCommit.VelocityBodyY = ((1 - progress) * (prev.Elevation - response.Altitude) + progress * (curr.Elevation - response.Altitude)) / 2; 482 | towCommit.VelocityBodyZ = (0.9 * curr.Velocity + 0.1 * distanceCurr / Math.Max(1, timeLeft)) * (distanceCurr < 10 ? distanceCurr / 10 : 1); 483 | 484 | // TAXIING 485 | if (towCommit.VelocityBodyZ < 1 && towCommit.VelocityBodyZ > -1) 486 | { 487 | towCommit.VelocityBodyZ = Math.Sign(towCommit.VelocityBodyZ) * Math.Pow(Math.Abs(towCommit.VelocityBodyZ), 4); 488 | } 489 | 490 | 491 | if (towCommit.VelocityBodyY > 10) 492 | { 493 | TowInfoResponse towInfo = new TowInfoResponse(); 494 | towInfo.Altitude = response.Altitude + towCommit.VelocityBodyY; 495 | towInfo.Latitude = response.Latitude; 496 | towInfo.Longitude = response.Longitude; 497 | towInfo.Heading = response.Heading; 498 | towInfo.Bank = response.Bank; 499 | 500 | if (!double.IsNaN(towInfo.Altitude) && !double.IsNaN(towInfo.Latitude) && !double.IsNaN(towInfo.Longitude) && !double.IsNaN(towInfo.Heading) && !double.IsNaN(towInfo.Bank)) 501 | { 502 | try 503 | { 504 | Console.WriteLine("Sinking, TELEPORT!"); 505 | _fsConnect.UpdateData(Definitions.TowPlane, towInfo, ID); 506 | } 507 | catch (Exception ex) 508 | { 509 | } 510 | } 511 | } 512 | 513 | //Console.WriteLine("Tracking animation " + (ghostPlane.Progress + deltaTime) + " h" + towCommit.VelocityBodyZ + " v" + towCommit.VelocityBodyY + " d" + distanceCurr); 514 | } 515 | catch { } 516 | } 517 | else if (curr.Location != null && next.Location == null) 518 | { 519 | message = new KeyValuePair(ghostPlane.ID, "REMOVE"); 520 | } 521 | 522 | break; 523 | } 524 | 525 | index++; 526 | } 527 | 528 | 529 | if (index < ghostPlanes.Count) 530 | { 531 | GhostPlane gp = ghostPlanes[index]; 532 | gp.LastTrackPlayed = absoluteTime; 533 | gp.Progress += deltaTime; 534 | 535 | ghostPlanes[index] = gp; 536 | } 537 | else 538 | { 539 | 540 | } 541 | 542 | 543 | return towCommit; 544 | } 545 | 546 | public void stopGhostPlayer(uint ID) 547 | { 548 | GhostPlane gp = ghostPlanes.Find(x => x.ID == ID); 549 | gp.Progress = 0; 550 | } 551 | 552 | public bool ghostPlayerActive(uint ID = TARGETMAX) 553 | { 554 | foreach (GhostPlane ghostPlane in ghostPlanes) 555 | { 556 | if (ghostPlane.Progress != 0 && (ID == TARGETMAX || ghostPlane.ID == ID)) 557 | { 558 | return true; 559 | } 560 | } 561 | 562 | return false; 563 | } 564 | } 565 | 566 | public struct GhostPlane 567 | { 568 | public GhostPlane(string name, string username, uint id, double length, double progress, double lastTrackPlayed, List trackPoints) 569 | { 570 | Name = name; 571 | Username = username; 572 | ID = id; 573 | Length = length; 574 | Progress = progress; 575 | LastTrackPlayed = lastTrackPlayed; 576 | TrackPoints = trackPoints; 577 | } 578 | public string Name; 579 | public string Username; 580 | public uint ID; 581 | public double Length; 582 | public double Progress; 583 | public double LastTrackPlayed; 584 | public List TrackPoints; 585 | } 586 | 587 | public struct TrackPoint 588 | { 589 | public TrackPoint(GeoLocation location, double elevation, int altitudeAboveGround, double velocity, double airspeed, short heading, short pitch, short roll, int lights, int avionics, DateTime time, double timer, string message = "") 590 | { 591 | Location = location; 592 | Elevation = elevation; 593 | AltitudeAboveGround = altitudeAboveGround; 594 | Velocity = velocity; 595 | Airspeed = airspeed; 596 | Heading = heading; 597 | Pitch = pitch; 598 | Roll = roll; 599 | Lights = lights; 600 | Avionics = avionics; 601 | Time = time; 602 | Timer = timer; 603 | Message = message; 604 | } 605 | public GeoLocation Location { get; set; } 606 | public double Elevation { get; set; } 607 | public double AltitudeAboveGround { get; set; } 608 | public double Velocity { get; set; } 609 | public double Airspeed { get; set; } 610 | public short Heading { get; set; } 611 | public short Pitch { get; set; } 612 | public short Roll { get; set; } 613 | public int Lights { get; set; } 614 | public int Avionics { get; set; } 615 | public DateTime Time { get; set; } 616 | public double Timer { get; set; } 617 | public string Message { get; set; } 618 | } 619 | 620 | } 621 | 622 | --------------------------------------------------------------------------------