├── doc
├── screenshot.JPG
├── screenshot2.JPG
├── screenshot3.JPG
├── showNewValue.JPG
└── installInstruction1.JPG
├── sfx-100-streamdeck-plugin
├── Images
│ ├── icon.png
│ ├── Blank.png
│ ├── Blank@2x.png
│ ├── SFB-Exit.png
│ ├── SFB-Start.png
│ ├── ValueDown.png
│ ├── ValueUp.png
│ ├── icon@2x.png
│ ├── IntensityUp.png
│ ├── MotionStart.png
│ ├── MotionStop.png
│ ├── SFB-Exit@2x.png
│ ├── ValueUp@2x.png
│ ├── pluginIcon.png
│ ├── EffectsDisable.png
│ ├── EffectsEnable.png
│ ├── IntensityDown.png
│ ├── IntensityUp@2x.png
│ ├── MotionStart@2x.png
│ ├── MotionStop@2x.png
│ ├── PropertyEnable.png
│ ├── SFB-Start@2x.png
│ ├── ValueDown@2x.png
│ ├── categoryIcon.png
│ ├── pluginAction.png
│ ├── pluginIcon@2x.png
│ ├── EffectsEnable@2x.png
│ ├── IntensityDown@2x.png
│ ├── PropertyDisable.png
│ ├── categoryIcon@2x.png
│ ├── pluginAction@2x.png
│ ├── EffectsDisable@2x.png
│ ├── PropertyDisable@2x.png
│ └── PropertyEnable@2x.png
├── PropertyInspector
│ ├── check.png
│ ├── rcheck.svg
│ ├── caret.svg
│ ├── check.svg
│ ├── empty.html
│ ├── elg_calendar_inv.svg
│ ├── EnableDisableAllEffects.html
│ ├── ShowOverallIntensityValue.html
│ ├── SetOverallIntensityValue.html
│ ├── DecrementOverallIntensity.html
│ ├── IncrementOverallIntensity.html
│ ├── DisableControllerProperty.html
│ ├── EnableControllerProperty.html
│ ├── DisableEffectProperty.html
│ ├── EnableEffectProperty.html
│ ├── elg_calendar.svg
│ ├── ShowEffectValue.html
│ ├── ShowControllerValue.html
│ ├── SetEffectValue.html
│ ├── DecrementEffectValues.html
│ ├── IncrementEffectValues.html
│ ├── StartStopMotionToggle.html
│ ├── Start.html
│ ├── SetControllerValue.html
│ ├── DecrementControllerValues.html
│ ├── IncrementControllerValues.html
│ ├── IsRunning.html
│ ├── IsTelemetryProviderConnected.html
│ └── StartProfile.html
├── tools
│ ├── DistributionTool.exe
│ └── install.bat
├── packages.config
├── Program.cs
├── App.config
├── Properties
│ └── AssemblyInfo.cs
├── PluginActions
│ ├── General
│ │ ├── StopMotion.cs
│ │ ├── StartMotion.cs
│ │ ├── ExitSimFeedback.cs
│ │ ├── IsRunning.cs
│ │ ├── IsTelemetryProviderConnected.cs
│ │ └── StartSimFeedback.cs
│ ├── Effects
│ │ ├── EnableAllEffects.cs
│ │ ├── DisableAllEffects.cs
│ │ ├── EnableEffectProperty.cs
│ │ ├── ShowEffectValue.cs
│ │ ├── DisableEffectProperty.cs
│ │ └── SetEffectValue.cs
│ ├── OverallIntensity
│ │ ├── ShowOverallIntensityValue.cs
│ │ ├── SetOverallIntensityValue.cs
│ │ ├── IncrementOverallIntensity.cs
│ │ └── DecrementOverallIntensity.cs
│ └── Controllers
│ │ ├── EnableControllerProperty.cs
│ │ ├── DisableControllerProperty.cs
│ │ └── ShowControllerValue.cs
└── PipeServerConnection.cs
├── sfx-100-streamdeck-sfb-extension
├── lib
│ └── SimFeedbackExtension.dll
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ └── AssemblyInfo.cs
├── SimFeedbackFacadeProvider.cs
├── App.config
├── ActionElements.cs
├── GuiLoggerProvider.cs
├── StreamdeckExtensionControlGui.xaml
├── StreamdeckExtensionControl.Designer.cs
├── AutomationExtensions.cs
├── StreamdeckExtension.cs
├── StreamdeckExtensionControl.cs
├── StreamdeckExtensionControlGui.xaml.cs
├── sfx-100-streamdeck-extension.csproj
└── StreamdeckExtensionControl.resx
├── sfx-100-streamdeck-console
├── App.config
├── Properties
│ └── AssemblyInfo.cs
├── PipeServerConnection.cs
├── sfx-100-streamdeck-console.csproj
└── Program.cs
├── .gitignore
├── sfx-100-streamdeck-pipecontract
├── Properties
│ └── AssemblyInfo.cs
├── sfx-100-streamdeck-pipecontract.csproj
└── ISfxStreamDeckPipeContract.cs
├── sfx-100-streamdeck.sln
└── README.md
/doc/screenshot.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/doc/screenshot.JPG
--------------------------------------------------------------------------------
/doc/screenshot2.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/doc/screenshot2.JPG
--------------------------------------------------------------------------------
/doc/screenshot3.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/doc/screenshot3.JPG
--------------------------------------------------------------------------------
/doc/showNewValue.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/doc/showNewValue.JPG
--------------------------------------------------------------------------------
/doc/installInstruction1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/doc/installInstruction1.JPG
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/icon.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/Blank.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/Blank.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/Blank@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/Blank@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/SFB-Exit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/SFB-Exit.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/SFB-Start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/SFB-Start.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/ValueDown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/ValueDown.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/ValueUp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/ValueUp.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/icon@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/IntensityUp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/IntensityUp.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/MotionStart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/MotionStart.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/MotionStop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/MotionStop.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/SFB-Exit@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/SFB-Exit@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/ValueUp@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/ValueUp@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/pluginIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/pluginIcon.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/EffectsDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/EffectsDisable.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/EffectsEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/EffectsEnable.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/IntensityDown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/IntensityDown.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/IntensityUp@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/IntensityUp@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/MotionStart@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/MotionStart@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/MotionStop@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/MotionStop@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/PropertyEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/PropertyEnable.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/SFB-Start@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/SFB-Start@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/ValueDown@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/ValueDown@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/categoryIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/categoryIcon.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/pluginAction.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/pluginAction.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/pluginIcon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/pluginIcon@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/EffectsEnable@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/EffectsEnable@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/IntensityDown@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/IntensityDown@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/PropertyDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/PropertyDisable.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/categoryIcon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/categoryIcon@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/pluginAction@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/pluginAction@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/check.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/PropertyInspector/check.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/tools/DistributionTool.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/tools/DistributionTool.exe
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/EffectsDisable@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/EffectsDisable@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/PropertyDisable@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/PropertyDisable@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Images/PropertyEnable@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-plugin/Images/PropertyEnable@2x.png
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/lib/SimFeedbackExtension.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ashupp/SFX-100-Streamdeck/HEAD/sfx-100-streamdeck-sfb-extension/lib/SimFeedbackExtension.dll
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/rcheck.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-console/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/caret.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/check.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | .vs/
3 |
4 | sfx-100-streamdeck-sfb-extension/obj/
5 |
6 | packages/
7 |
8 | sfx-100-streamdeck-plugin/obj/
9 |
10 | sfx-100-streamdeck-plugin/bin/
11 |
12 | sfx-100-streamdeck-sfb-extension/bin/
13 |
14 | sfx-100-streamdeck-pipecontract/obj/
15 |
16 | sfx-100-streamdeck-pipecontract/bin/
17 |
18 | *.user
19 |
20 | sfx-100-streamdeck-console/bin/
21 |
22 | sfx-100-streamdeck-console/obj/
23 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 500
7 |
8 |
9 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Program.cs:
--------------------------------------------------------------------------------
1 | using BarRaider.SdTools;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace sfx_100_streamdeck_plugin
9 | {
10 | class Program
11 | {
12 | static void Main(string[] args)
13 | {
14 | // Uncomment this line of code to allow for debugging
15 | //while (!System.Diagnostics.Debugger.IsAttached) { System.Threading.Thread.Sleep(100); }
16 |
17 | SDWrapper.Run(args);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/empty.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/SimFeedbackFacadeProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Threading;
3 |
4 | namespace sfx_100_streamdeck_sfb_extension
5 | {
6 | class SimFeedbackFacadeProvider
7 | {
8 | #region Singleton
9 | private static readonly Lazy lazy
10 | = new Lazy(() => new SimFeedbackFacadeProvider());
11 |
12 | public static SimFeedbackFacadeProvider Instance
13 | => lazy.Value;
14 |
15 | private SimFeedbackFacadeProvider() { }
16 | #endregion
17 |
18 |
19 | public SimFeedback.extension.SimFeedbackExtensionFacade SimFeedbackFacade;
20 |
21 | public Dispatcher DispatcherHelper { get; set; }
22 | }
23 | }
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/tools/install.bat:
--------------------------------------------------------------------------------
1 | REM USAGE: Install.bat
2 | REM Example: Install.bat RELEASE com.barraider.spotify
3 | setlocal
4 | cd /d %~dp0
5 | cd ../bin/%1
6 |
7 | REM MAKE SURE THE FOLLOWING ARE CORRECT
8 | REM ALSO, UPDATE YOUR_USERNAME ON LINE 16
9 | SET OUTPUT_DIR="C:\TEMP"
10 | SET DISTRIBUTION_TOOL="..\..\tools\DistributionTool.exe"
11 | SET STREAM_DECK_FILE="C:\Program Files\Elgato\StreamDeck\StreamDeck.exe"
12 |
13 | taskkill /f /im streamdeck.exe
14 | taskkill /f /im %2.exe
15 | timeout /t 2
16 | del %OUTPUT_DIR%\%2.streamDeckPlugin
17 | %DISTRIBUTION_TOOL% -b -i %2.sdPlugin -o %OUTPUT_DIR%
18 | rmdir C:\Users\ahupp\AppData\Roaming\Elgato\StreamDeck\Plugins\%2.sdPlugin /s /q
19 | START "" %STREAM_DECK_FILE%
20 | timeout /t 3
21 | %OUTPUT_DIR%\%2.streamDeckPlugin
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/elg_calendar_inv.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/EnableDisableAllEffects.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | Attention: This works only during motion is active. This does NOT check/uncheck the enabled box of the effects.
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 500
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/ShowOverallIntensityValue.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | Title must be empty to work. This is not a button, only a display.
16 |
17 |
18 |
Refresh Rate (milliseconds)
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/SetOverallIntensityValue.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 |
Value (0-100)
16 |
17 |
18 |
19 |
20 |
21 | Show new value on button after change
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/DecrementOverallIntensity.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 |
Decrement by steps
16 |
17 |
18 |
19 |
20 |
21 | Show new value on button after change
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/IncrementOverallIntensity.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 |
Increment by steps
16 |
17 |
18 |
19 |
20 |
21 | Show new value on button after change
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/DisableControllerProperty.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | The Controller name MUST exactly match the Controller name in SimFeedback
16 |
17 |
18 |
Controller Name
19 |
20 |
21 |
22 |
Property to Disable
23 |
24 | Smoothness
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/EnableControllerProperty.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | The Controller name MUST exactly match the Controller name in SimFeedback
16 |
17 |
18 |
Controller Name
19 |
20 |
21 |
22 |
Property to Enable
23 |
24 | Smoothness
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/DisableEffectProperty.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | The Effect name MUST exactly match the effect name in SimFeedback
16 |
17 |
18 |
Effect Name
19 |
20 |
21 |
22 |
Property to Disable
23 |
24 | Enable
25 | Linear
26 | Mute
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/EnableEffectProperty.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | The Effect name MUST exactly match the effect name in SimFeedback
16 |
17 |
18 |
Effect Name
19 |
20 |
21 |
22 |
Property to Enable
23 |
24 | Enable
25 | Linear
26 | Mute
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/elg_calendar.svg:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("sfx-100-streamdeck-plugin")]
9 | [assembly: AssemblyDescription("!")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("sfx-100-streamdeck-plugin")]
13 | [assembly: AssemblyCopyright("Copyright © ashnet GmbH 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("5c548a63-46cd-40d4-8e84-ec87272f072e")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("0.0.3.0")]
36 | [assembly: AssemblyFileVersion("0.0.3.0")]
37 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/ActionElements.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Windows.Automation;
3 |
4 | namespace sfx_100_streamdeck_sfb_extension
5 | {
6 | class ActionElements
7 | {
8 | public Dictionary Controllers = new Dictionary();
9 | public Dictionary Effects = new Dictionary();
10 |
11 | public List ControllerIndexAssignment = new List();
12 | public List EffectIndexAssignment = new List();
13 |
14 | public AutomationElement OverallIntensity;
15 | public AutomationElement BtnResetOverallIntensity;
16 | public AutomationElement BtnEnableAllEffects;
17 | public AutomationElement BtnDisableAllEffects;
18 | }
19 |
20 | class EffectActionElement
21 | {
22 | public string Name;
23 | public AutomationElement Intensity;
24 | public AutomationElement Smoothing;
25 | public AutomationElement LinearInterpolated;
26 | public AutomationElement Enabled;
27 | public AutomationElement Muted;
28 | }
29 |
30 | class ControllerActionElement
31 | {
32 | public string Name;
33 | public AutomationElement Intensity;
34 | public AutomationElement IntensityResetButton;
35 | public AutomationElement SmoothnessEnabled;
36 | public AutomationElement Smoothness;
37 | public AutomationElement Acceleration;
38 | public AutomationElement MinSpeed;
39 | public AutomationElement MaxSpeed;
40 | }
41 | }
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.42000
5 | //
6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
7 | // der Code erneut generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace sfx_100_streamdeck_sfb_extension.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.3.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 | [global::System.Configuration.ApplicationScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("500")]
29 | public int UIAutomationDelay {
30 | get {
31 | return ((int)(this["UIAutomationDelay"]));
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-console/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die einer Assembly zugeordnet sind.
8 | [assembly: AssemblyTitle("sfx-100-streamdeck-console")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("sfx-100-streamdeck-console")]
13 | [assembly: AssemblyCopyright("Copyright © ashnet GmbH 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
18 | // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
19 | // COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23 | [assembly: Guid("4bb0fb0e-85cb-464c-ab2e-1aacc42f9554")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
33 | // indem Sie "*" wie unten gezeigt eingeben:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("0.0.3.0")]
36 | [assembly: AssemblyFileVersion("0.0.3.0")]
37 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/ShowEffectValue.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | Title must be empty to work. The Effect name MUST exactly match the effect name in SimFeedback. This is not a button, only a display.
16 |
17 |
18 |
Effect Name
19 |
20 |
21 |
22 |
Value to display
23 |
24 | Intensity
25 | Smoothness
26 |
27 |
28 |
29 |
Refresh Rate (milliseconds)
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-pipecontract/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die einer Assembly zugeordnet sind.
8 | [assembly: AssemblyTitle("sfx-100-streamdeck-pipecontract")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("sfx-100-streamdeck-pipecontract")]
13 | [assembly: AssemblyCopyright("Copyright © ashnet GmbH 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
18 | // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
19 | // COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23 | [assembly: Guid("0dd43943-2b44-489d-8478-75c5b2f87e8c")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
33 | // indem Sie "*" wie unten gezeigt eingeben:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("0.0.3.0")]
36 | [assembly: AssemblyFileVersion("0.0.3.0")]
37 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die einer Assembly zugeordnet sind.
8 | [assembly: AssemblyTitle("sfx-100-streamdeck-sfb-extension")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("sfx-100-streamdeck-sfb-extension")]
13 | [assembly: AssemblyCopyright("Copyright © ashnet GmbH 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
18 | // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
19 | // COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23 | [assembly: Guid("0192378e-d173-4661-a198-a7976ab3d7e0")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
33 | // indem Sie "*" wie unten gezeigt eingeben:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("0.0.3.0")]
36 | [assembly: AssemblyFileVersion("0.0.3.0")]
37 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/General/StopMotion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ServiceModel;
3 | using BarRaider.SdTools;
4 |
5 |
6 | namespace sfx_100_streamdeck_plugin.PluginActions
7 | {
8 | [PluginActionId("sfx-100-streamdeck-plugin.stopmotion")]
9 | public class StopMotion : PluginBase
10 | {
11 | public StopMotion(SDConnection connection, InitialPayload payload) : base(connection, payload) { }
12 |
13 | public override void Dispose() { }
14 |
15 | public override void KeyPressed(KeyPayload payload) { }
16 |
17 | public override void KeyReleased(KeyPayload payload)
18 | {
19 | try
20 | {
21 | PipeServerConnection.Instance.RestartChannel();
22 | PipeServerConnection.Instance.Channel.StopMotion();
23 | }
24 | catch (EndpointNotFoundException endpointNotFoundException)
25 | {
26 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: Endpoint not found - Is SimFeedback available and is the Plugin enabled? " + endpointNotFoundException.Message);
27 | }
28 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
29 | {
30 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: communicationObjectFaultedException: " + communicationObjectFaultedException.Message);
31 | }
32 | catch (Exception ex)
33 | {
34 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error during Key processing: " + ex.Message);
35 | }
36 | }
37 |
38 | public override void OnTick() { }
39 |
40 | public override void ReceivedSettings(ReceivedSettingsPayload payload) { }
41 |
42 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
43 |
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/General/StartMotion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ServiceModel;
3 | using BarRaider.SdTools;
4 |
5 |
6 | namespace sfx_100_streamdeck_plugin.PluginActions
7 | {
8 | [PluginActionId("sfx-100-streamdeck-plugin.startmotion")]
9 | public class StartMotion : PluginBase
10 | {
11 | public StartMotion(SDConnection connection, InitialPayload payload) : base(connection, payload) { }
12 |
13 | public override void Dispose() { }
14 |
15 | public override void KeyPressed(KeyPayload payload) { }
16 |
17 | public override void KeyReleased(KeyPayload payload)
18 | {
19 | try
20 | {
21 | PipeServerConnection.Instance.RestartChannel();
22 | PipeServerConnection.Instance.Channel.StartMotion();
23 | }
24 | catch (EndpointNotFoundException endpointNotFoundException)
25 | {
26 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: Endpoint not found - Is SimFeedback available and is the Plugin enabled? " + endpointNotFoundException.Message);
27 | }
28 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
29 | {
30 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: communicationObjectFaultedException: " + communicationObjectFaultedException.Message);
31 | }
32 | catch (Exception ex)
33 | {
34 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error during Key processing: " + ex.Message);
35 | }
36 | }
37 |
38 | public override void OnTick() { }
39 |
40 | public override void ReceivedSettings(ReceivedSettingsPayload payload) { }
41 |
42 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
43 |
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/Effects/EnableAllEffects.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ServiceModel;
3 | using BarRaider.SdTools;
4 |
5 |
6 | namespace sfx_100_streamdeck_plugin.PluginActions
7 | {
8 | [PluginActionId("sfx-100-streamdeck-plugin.enablealleffects")]
9 | public class EnableAllEffects : PluginBase
10 | {
11 | public EnableAllEffects(SDConnection connection, InitialPayload payload) : base(connection, payload) { }
12 |
13 | public override void Dispose() { }
14 |
15 | public override void KeyPressed(KeyPayload payload) { }
16 |
17 | public override void KeyReleased(KeyPayload payload)
18 | {
19 | try
20 | {
21 | PipeServerConnection.Instance.RestartChannel();
22 | PipeServerConnection.Instance.Channel.EnableAllEffects();
23 | }
24 | catch (EndpointNotFoundException endpointNotFoundException)
25 | {
26 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: Endpoint not found - Is SimFeedback available and is the Plugin enabled? " + endpointNotFoundException.Message);
27 | }
28 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
29 | {
30 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: communicationObjectFaultedException: " + communicationObjectFaultedException.Message);
31 | }
32 | catch (Exception ex)
33 | {
34 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error during Key processing: " + ex.Message);
35 | }
36 | }
37 |
38 | public override void OnTick() { }
39 |
40 | public override void ReceivedSettings(ReceivedSettingsPayload payload) { }
41 |
42 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/Effects/DisableAllEffects.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ServiceModel;
3 | using BarRaider.SdTools;
4 |
5 |
6 | namespace sfx_100_streamdeck_plugin.PluginActions
7 | {
8 | [PluginActionId("sfx-100-streamdeck-plugin.disablealleffects")]
9 | public class DisableAllEffects : PluginBase
10 | {
11 | public DisableAllEffects(SDConnection connection, InitialPayload payload) : base(connection, payload) { }
12 |
13 | public override void Dispose() { }
14 |
15 | public override void KeyPressed(KeyPayload payload) { }
16 |
17 | public override void KeyReleased(KeyPayload payload)
18 | {
19 | try
20 | {
21 | PipeServerConnection.Instance.RestartChannel();
22 | PipeServerConnection.Instance.Channel.DisableAllEffects();
23 | }
24 | catch (EndpointNotFoundException endpointNotFoundException)
25 | {
26 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: Endpoint not found - Is SimFeedback available and is the Plugin enabled? " + endpointNotFoundException.Message);
27 | }
28 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
29 | {
30 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: communicationObjectFaultedException: " + communicationObjectFaultedException.Message);
31 | }
32 | catch (Exception ex)
33 | {
34 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error during Key processing: " + ex.Message);
35 | }
36 | }
37 |
38 | public override void OnTick() { }
39 |
40 | public override void ReceivedSettings(ReceivedSettingsPayload payload) { }
41 |
42 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/ShowControllerValue.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | Title must be empty to work. The Controller name MUST exactly match the Controller name in SimFeedback. This is not a button, only a display.
16 |
17 |
18 |
Effect Name
19 |
20 |
21 |
22 |
Value to display
23 |
24 | Intensity
25 | Smoothness
26 | Acceleration
27 | MinSpeed
28 | MaxSpeed
29 |
30 |
31 |
32 |
Refresh Rate (milliseconds)
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/SetEffectValue.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | The Effect name MUST exactly match the effect name in SimFeedback
16 |
17 |
18 |
Effect Name
19 |
20 |
21 |
22 |
Value to change
23 |
24 | Intensity
25 | Smoothness
26 |
27 |
28 |
29 |
Intensity (0-20)
30 |
31 |
32 |
33 |
34 |
35 | Show new value on button after change
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/DecrementEffectValues.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | The Effect name MUST exactly match the effect name in SimFeedback
16 |
17 |
18 |
Effect Name
19 |
20 |
21 |
22 |
Value to change
23 |
24 | Intensity
25 | Smoothness
26 |
27 |
28 |
29 |
Decrement by steps
30 |
31 |
32 |
33 |
34 |
35 | Show new value on button after change
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/IncrementEffectValues.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | The Effect name MUST exactly match the effect name in SimFeedback
16 |
17 |
18 |
Effect Name
19 |
20 |
21 |
22 |
Value to change
23 |
24 | Intensity
25 | Smoothness
26 |
27 |
28 |
29 |
Increment by steps
30 |
31 |
32 |
33 |
34 |
35 | Show new value on button after change
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/GuiLoggerProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 | using System.Windows.Threading;
5 |
6 | namespace sfx_100_streamdeck_sfb_extension
7 | {
8 | class GuiLoggerProvider
9 | {
10 | #region Singleton
11 | private static volatile GuiLoggerProvider instance;
12 | private static object syncRoot = new Object();
13 |
14 | private GuiLoggerProvider() { }
15 |
16 | public static GuiLoggerProvider Instance
17 | {
18 | get
19 | {
20 | if (instance == null)
21 | {
22 | lock (syncRoot)
23 | {
24 | if (instance == null)
25 | {
26 | instance = new GuiLoggerProvider();
27 | }
28 | return instance;
29 | }
30 | }
31 | return instance;
32 | }
33 | }
34 |
35 | public ListBox LogBox { get; set; }
36 | public bool LoggingEnabled = false;
37 |
38 | #endregion
39 |
40 |
41 | ///
42 | /// Simple logging to window. Holds only limited entries to prevent scrolling
43 | ///
44 | /// Object to log
45 | public void Log(object logEntry)
46 | {
47 | if (!Instance.LoggingEnabled)
48 | return;
49 | lock (syncRoot)
50 | {
51 |
52 | if (LogBox != null)
53 | {
54 | if (LogBox.Items.Count >= 1000)
55 | {
56 | LogBox.Items.RemoveAt(0);
57 | }
58 |
59 | LogBox.Items.Add(DateTime.Now + ": " + logEntry);
60 | LogBox.SelectedIndex = LogBox.Items.Count - 1;
61 | LogBox.ScrollIntoView(LogBox.SelectedItem);
62 | }
63 | }
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/StartStopMotionToggle.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 |
Not running image
16 |
17 |
18 | No file...
19 | Choose file...
20 |
21 |
22 |
23 |
Running image
24 |
25 |
26 | No file...
27 | Choose file...
28 |
29 |
30 |
31 |
Check Interval (Seconds)
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/Start.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 |
SimFeedbackstart exe Path
16 |
17 |
18 | No file...
19 | Choose file...
20 |
21 |
22 |
23 |
24 |
25 | Start Motion after SimFeedback started
26 |
27 |
28 |
29 |
Startup window mode
30 |
31 | Normal window
32 | Minimized window
33 | Maximized window
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/General/ExitSimFeedback.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Threading;
4 | using BarRaider.SdTools;
5 |
6 | namespace sfx_100_streamdeck_plugin.PluginActions
7 | {
8 | [PluginActionId("sfx-100-streamdeck-plugin.exitsimfeedback")]
9 | public class ExitSimFeedback : PluginBase
10 | {
11 | bool _actionInProgress = false;
12 |
13 | public ExitSimFeedback(SDConnection connection, InitialPayload payload) : base(connection, payload) { }
14 |
15 | public override void Dispose() { }
16 |
17 | public override void KeyPressed(KeyPayload payload) { }
18 |
19 | public override void KeyReleased(KeyPayload payload)
20 | {
21 | if (!_actionInProgress)
22 | {
23 | _actionInProgress = true;
24 | foreach (var process in Process.GetProcessesByName("SimFeedbackStart"))
25 | {
26 | Logger.Instance.LogMessage(TracingLevel.INFO, "Shutting down SimFeedback Process");
27 | process.EnableRaisingEvents = true;
28 |
29 | process.Exited += delegate (object o, EventArgs args)
30 | {
31 | Logger.Instance.LogMessage(TracingLevel.INFO, "Shutting down SimFeedback Process completed. Exit Code: " + process.ExitCode);
32 | _actionInProgress = false;
33 | };
34 |
35 | DateTime start = DateTime.Now;
36 | while (!process.HasExited && DateTime.Now - start <= TimeSpan.FromSeconds(15))
37 | {
38 | process.WaitForInputIdle(5000);
39 | process.CloseMainWindow();
40 | Thread.Sleep(500);
41 | }
42 | }
43 | _actionInProgress = false;
44 | }
45 | }
46 |
47 | public override void OnTick() { }
48 |
49 | public override void ReceivedSettings(ReceivedSettingsPayload payload) { }
50 |
51 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/SetControllerValue.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | The Controller name MUST exactly match the Controller name in SimFeedback
16 |
17 |
18 |
Controller Name
19 |
20 |
21 |
22 |
Value to change
23 |
24 | Intensity
25 | Smoothness
26 | Acceleration
27 | MinSpeed
28 | MaxSpeed
29 |
30 |
31 |
32 |
Value (0-100)
33 |
34 |
35 |
36 |
37 |
38 | Show new value on button after change
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/DecrementControllerValues.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | The Controller name MUST exactly match the Controller name in SimFeedback
16 |
17 |
18 |
Controller Name
19 |
20 |
21 |
22 |
Value to change
23 |
24 | Intensity
25 | Smoothness
26 | Acceleration
27 | MinSpeed
28 | MaxSpeed
29 |
30 |
31 |
32 |
Decrement by steps
33 |
34 |
35 |
36 |
37 |
38 | Show new value on button after change
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/IncrementControllerValues.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | The Controller name MUST exactly match the Controller name in SimFeedback
16 |
17 |
18 |
Controller Name
19 |
20 |
21 |
22 |
Value to change
23 |
24 | Intensity
25 | Smoothness
26 | Acceleration
27 | MinSpeed
28 | MaxSpeed
29 |
30 |
31 |
32 |
Increment by steps
33 |
34 |
35 |
36 |
37 |
38 | Show new value on button after change
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/IsRunning.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | This is no pushable button. It only shows if motion is running or not.
16 |
17 |
18 |
Not running image
19 |
20 |
21 | No file...
22 | Choose file...
23 |
24 |
25 |
26 |
Running image
27 |
28 |
29 | No file...
30 | Choose file...
31 |
32 |
33 |
34 |
Check Interval (Seconds)
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/StreamdeckExtensionControlGui.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/IsTelemetryProviderConnected.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | This is no pushable button. It only shows if telemetryprovider is connected or not. Please note this value can be incorrect since the value seems not to be reset by the SFB API.
16 |
17 |
18 |
Disconnected image
19 |
20 |
21 | No file...
22 | Choose file...
23 |
24 |
25 |
26 |
Connected image
27 |
28 |
29 | No file...
30 | Choose file...
31 |
32 |
33 |
34 |
Check Interval (Seconds)
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-console/PipeServerConnection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ServiceModel;
3 | using sfx_100_streamdeck_pipecontract;
4 |
5 | namespace sfx_100_streamdeck_plugin
6 | {
7 | class PipeServerConnection
8 | {
9 | #region Singleton
10 | private static volatile PipeServerConnection instance;
11 | private static object syncRoot = new Object();
12 | public ISfxStreamDeckPipeContract Channel;
13 | private NetNamedPipeBinding _binding;
14 | private EndpointAddress _ep ;
15 |
16 | private PipeServerConnection() { }
17 |
18 | void createServer()
19 | {
20 | string address = "net.pipe://localhost/ashnet/StreamDeckExtension";
21 | _binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None)
22 | {
23 | CloseTimeout = TimeSpan.FromSeconds(5),
24 | OpenTimeout = TimeSpan.FromSeconds(5),
25 | ReceiveTimeout = TimeSpan.FromSeconds(10),
26 | SendTimeout = TimeSpan.FromSeconds(5)
27 | };
28 |
29 | _ep = new EndpointAddress(address);
30 | Channel = ChannelFactory.CreateChannel(_binding, _ep);
31 | }
32 |
33 | public static PipeServerConnection Instance
34 | {
35 | get
36 | {
37 | if (instance == null)
38 | {
39 | lock (syncRoot)
40 | {
41 | if (instance == null)
42 | {
43 | instance = new PipeServerConnection();
44 | }
45 | return instance;
46 |
47 |
48 | }
49 | }
50 | return instance;
51 | }
52 | }
53 | #endregion
54 |
55 | public void RestartChannel()
56 | {
57 | try
58 | {
59 | if (Channel != null)
60 | {
61 | ((ICommunicationObject) Channel).Abort();
62 | ((ICommunicationObject) Channel).Close();
63 | }
64 | createServer();
65 | }
66 | catch (Exception ex)
67 | {
68 | Console.WriteLine("Error during RestartChannel: " + ex.Message);
69 | }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PipeServerConnection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ServiceModel;
3 | using BarRaider.SdTools;
4 | using sfx_100_streamdeck_pipecontract;
5 |
6 | namespace sfx_100_streamdeck_plugin
7 | {
8 | class PipeServerConnection
9 | {
10 | #region Singleton
11 | private static volatile PipeServerConnection instance;
12 | private static object syncRoot = new Object();
13 | public ISfxStreamDeckPipeContract Channel;
14 | private NetNamedPipeBinding _binding;
15 | private EndpointAddress _ep ;
16 |
17 | private PipeServerConnection() { }
18 |
19 | void createServer()
20 | {
21 | string address = "net.pipe://localhost/ashnet/StreamDeckExtension";
22 | _binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None)
23 | {
24 | CloseTimeout = TimeSpan.FromSeconds(5),
25 | OpenTimeout = TimeSpan.FromSeconds(5),
26 | ReceiveTimeout = TimeSpan.FromSeconds(10),
27 | SendTimeout = TimeSpan.FromSeconds(5)
28 | };
29 |
30 | _ep = new EndpointAddress(address);
31 | Channel = ChannelFactory.CreateChannel(_binding, _ep);
32 | }
33 |
34 | public static PipeServerConnection Instance
35 | {
36 | get
37 | {
38 | if (instance == null)
39 | {
40 | lock (syncRoot)
41 | {
42 | if (instance == null)
43 | {
44 | instance = new PipeServerConnection();
45 | }
46 | return instance;
47 |
48 |
49 | }
50 | }
51 | return instance;
52 | }
53 | }
54 | #endregion
55 |
56 | public void RestartChannel()
57 | {
58 | try
59 | {
60 | if (Channel != null)
61 | {
62 | ((ICommunicationObject) Channel).Abort();
63 | ((ICommunicationObject) Channel).Close();
64 | }
65 | createServer();
66 | }
67 | catch (Exception ex)
68 | {
69 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error during RestartChannel: " + ex.Message);
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-pipecontract/sfx-100-streamdeck-pipecontract.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {0DD43943-2B44-489D-8478-75C5B2F87E8C}
8 | Library
9 | Properties
10 | sfx_100_streamdeck_pipecontract
11 | sfx-100-streamdeck-pipecontract
12 | v4.7.2
13 | 512
14 | true
15 |
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | none
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 | x86
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PropertyInspector/StartProfile.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | sfx_100_streamdeck_plugin Settings
9 |
10 |
11 |
12 |
13 |
14 |
15 | The selected profile xml below MUST be located in the SimFeedback profiles folder.
16 |
17 |
18 |
Profile XML to start
19 |
20 |
21 | No file...
22 | Choose file...
23 |
24 |
25 |
26 |
SimFeedbackstart exe Path
27 |
28 |
29 | No file...
30 | Choose file...
31 |
32 |
33 |
34 |
35 |
36 | Start Motion after SimFeedback started
37 |
38 |
39 |
40 |
Startup window mode
41 |
42 | Normal window
43 | Minimized window
44 | Maximized window
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/StreamdeckExtensionControl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace sfx_100_streamdeck_sfb_extension
2 | {
3 | partial class StreamdeckExtensionControl
4 | {
5 | ///
6 | /// Erforderliche Designervariable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Verwendete Ressourcen bereinigen.
12 | ///
13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Vom Komponenten-Designer generierter Code
24 |
25 | ///
26 | /// Erforderliche Methode für die Designerunterstützung.
27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.elementHost = new System.Windows.Forms.Integration.ElementHost();
32 | this._streamdeckExtensionControlGui1 = new sfx_100_streamdeck_sfb_extension.StreamdeckExtensionControlGui();
33 | this.SuspendLayout();
34 | //
35 | // elementHost
36 | //
37 | this.elementHost.AutoSize = true;
38 | this.elementHost.Dock = System.Windows.Forms.DockStyle.Fill;
39 | this.elementHost.Location = new System.Drawing.Point(0, 0);
40 | this.elementHost.Name = "elementHost";
41 | this.elementHost.Size = new System.Drawing.Size(1186, 814);
42 | this.elementHost.TabIndex = 1;
43 | this.elementHost.Text = "elementHost1";
44 | this.elementHost.Child = this._streamdeckExtensionControlGui1;
45 | //
46 | // StreamdeckExtensionControl
47 | //
48 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
49 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
50 | this.Controls.Add(this.elementHost);
51 | this.Name = "StreamdeckExtensionControl";
52 | this.Size = new System.Drawing.Size(1186, 814);
53 | this.Load += new System.EventHandler(this.ModBusExtensionControl_Load);
54 | this.ResumeLayout(false);
55 | this.PerformLayout();
56 |
57 | }
58 |
59 | #endregion
60 | private System.Windows.Forms.Integration.ElementHost elementHost;
61 | private StreamdeckExtensionControlGui _streamdeckExtensionControlGui1;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/AutomationExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Automation;
3 |
4 | namespace sfx_100_streamdeck_sfb_extension
5 | {
6 | public static class AutomationExtensions
7 | {
8 | public static string GetText(this AutomationElement element)
9 | => element.TryGetCurrentPattern(ValuePattern.Pattern, out object patternValue) ? ((ValuePattern)patternValue).Current.Value
10 | : element.TryGetCurrentPattern(TextPattern.Pattern, out object patternText) ? ((TextPattern)patternText).DocumentRange.GetText(-1).TrimEnd('\r') // often there is an extra '\r' hanging off the end.
11 | : element.Current.Name;
12 |
13 | // Does not notify...
14 | public static void SetSliderValue(AutomationElement element, double theValue)
15 | {
16 | element.SetFocus();
17 | var range = element.GetCurrentPattern(RangeValuePattern.Pattern) as RangeValuePattern;
18 | range.SetValue(theValue);
19 | }
20 |
21 | // This will bring the window to front if it is in normal or maximized state. Using Win32 Click instead
22 | public static void ChangeCheckBoxState(AutomationElement element)
23 | {
24 | TogglePattern targetInvokePattern = element.GetCurrentPattern(TogglePattern.Pattern) as TogglePattern;
25 | if (targetInvokePattern == null)
26 | return;
27 | targetInvokePattern.Toggle();
28 | }
29 |
30 | // Currently Unused
31 | public static void InvokeElement(AutomationElement element)
32 | {
33 | InvokePattern targetInvokePattern = element.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;
34 | if (targetInvokePattern == null)
35 | return;
36 | targetInvokePattern.Invoke();
37 | }
38 |
39 | public static bool IsElementToggledOn(AutomationElement element)
40 | {
41 | if (element == null)
42 | {
43 | // TODO: Invalid parameter error handling.
44 | return false;
45 | }
46 |
47 | Object objPattern;
48 | TogglePattern togPattern;
49 | if (true == element.TryGetCurrentPattern(TogglePattern.Pattern, out objPattern))
50 | {
51 | togPattern = objPattern as TogglePattern;
52 | if (togPattern.Current.ToggleState == ToggleState.On)
53 | {
54 | return true;
55 | }
56 | else
57 | {
58 | return false;
59 | }
60 | }
61 | // TODO: Object doesn't support TogglePattern error handling.
62 | return false;
63 | }
64 |
65 |
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/StreamdeckExtension.cs:
--------------------------------------------------------------------------------
1 | using System.ServiceModel;
2 | using SimFeedback.extension;
3 | using System.Windows.Forms;
4 | using sfx_100_streamdeck_pipecontract;
5 |
6 | namespace sfx_100_streamdeck_sfb_extension
7 | {
8 | public class StreamdeckExtension : AbstractSimFeedbackExtension
9 | {
10 | private StreamdeckExtensionControl _extCtrl;
11 | private ServiceHost _serviceHost;
12 | private SimFeedbackInvoker sfbInvoker;
13 |
14 | public StreamdeckExtension()
15 | {
16 | Name = "Stream Deck Extension";
17 | Info = "Control your SFX-100 with your Stream Deck";
18 | Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
19 | Author = "ashupp";
20 | NeedsOwnTab = false;
21 | HasControl = true;
22 | }
23 |
24 | public override void Init(SimFeedbackExtensionFacade facade, ExtensionConfig config)
25 | {
26 | base.Init(facade, config);
27 | Log("Initialize Streamdeck Extension");
28 | _extCtrl = new StreamdeckExtensionControl(this, facade);
29 | }
30 |
31 | public void SetIsRunning(bool status)
32 | {
33 | IsRunning = status;
34 | }
35 |
36 | private void StartServer()
37 | {
38 | string address = "net.pipe://localhost/ashnet/StreamDeckExtension";
39 | _serviceHost = new ServiceHost(typeof(SfxStreamDeckPipeServer));
40 | NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
41 | _serviceHost.AddServiceEndpoint(typeof(ISfxStreamDeckPipeContract), binding, address);
42 | _serviceHost.Open();
43 | GuiLoggerProvider.Instance.Log("Waiting for commands");
44 | }
45 |
46 |
47 |
48 | private void ShutdownServer()
49 | {
50 | _serviceHost.Abort();
51 | _serviceHost.Close();
52 | GuiLoggerProvider.Instance.Log("Shutdown Server");
53 | }
54 |
55 | public override void Start()
56 | {
57 | if (IsRunning) return;
58 | SimFeedbackFacade.Log("Starting Stream Deck Extension");
59 | GuiLoggerProvider.Instance.Log("Starting Stream Deck Extension");
60 |
61 | StartServer();
62 | _extCtrl.Start();
63 | IsRunning = true;
64 | GuiLoggerProvider.Instance.Log("Stream Deck Extension running");
65 | }
66 |
67 |
68 | public override void Stop()
69 | {
70 | if (!IsRunning) return;
71 | Log("Stopping Stream Deck Extension");
72 | GuiLoggerProvider.Instance.Log("Stopping Stream Deck Extension");
73 | ShutdownServer();
74 | _extCtrl.Stop();
75 | IsRunning = false;
76 | }
77 |
78 | public override Control ExtensionControl => _extCtrl;
79 | }
80 | }
--------------------------------------------------------------------------------
/sfx-100-streamdeck-console/sfx-100-streamdeck-console.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {4BB0FB0E-85CB-464C-AB2E-1AACC42F9554}
8 | Exe
9 | sfx_100_streamdeck_console
10 | sfx-100-streamdeck-console
11 | v4.7.2
12 | 512
13 | true
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | {0dd43943-2b44-489d-8478-75c5b2f87e8c}
57 | sfx-100-streamdeck-pipecontract
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29424.173
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3FF1A651-C548-423A-92ED-BE9C637A7C63}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sfx-100-streamdeck-extension", "sfx-100-streamdeck-sfb-extension\sfx-100-streamdeck-extension.csproj", "{0192378E-D172-4661-A198-A7976AB3D7E0}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sfx-100-streamdeck-plugin", "sfx-100-streamdeck-plugin\sfx-100-streamdeck-plugin.csproj", "{4635D874-69C0-4010-BE46-77EF92EB1553}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sfx-100-streamdeck-pipecontract", "sfx-100-streamdeck-pipecontract\sfx-100-streamdeck-pipecontract.csproj", "{0DD43943-2B44-489D-8478-75C5B2F87E8C}"
13 | EndProject
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sfx-100-streamdeck-console", "sfx-100-streamdeck-console\sfx-100-streamdeck-console.csproj", "{4BB0FB0E-85CB-464C-AB2E-1AACC42F9554}"
15 | EndProject
16 | Global
17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
18 | Debug|Any CPU = Debug|Any CPU
19 | Release|Any CPU = Release|Any CPU
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {0192378E-D172-4661-A198-A7976AB3D7E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {0192378E-D172-4661-A198-A7976AB3D7E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {0192378E-D172-4661-A198-A7976AB3D7E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {0192378E-D172-4661-A198-A7976AB3D7E0}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {4635D874-69C0-4010-BE46-77EF92EB1553}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {4635D874-69C0-4010-BE46-77EF92EB1553}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {4635D874-69C0-4010-BE46-77EF92EB1553}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {4635D874-69C0-4010-BE46-77EF92EB1553}.Release|Any CPU.Build.0 = Release|Any CPU
30 | {0DD43943-2B44-489D-8478-75C5B2F87E8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31 | {0DD43943-2B44-489D-8478-75C5B2F87E8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
32 | {0DD43943-2B44-489D-8478-75C5B2F87E8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 | {0DD43943-2B44-489D-8478-75C5B2F87E8C}.Release|Any CPU.Build.0 = Release|Any CPU
34 | {4BB0FB0E-85CB-464C-AB2E-1AACC42F9554}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35 | {4BB0FB0E-85CB-464C-AB2E-1AACC42F9554}.Debug|Any CPU.Build.0 = Debug|Any CPU
36 | {4BB0FB0E-85CB-464C-AB2E-1AACC42F9554}.Release|Any CPU.ActiveCfg = Release|Any CPU
37 | {4BB0FB0E-85CB-464C-AB2E-1AACC42F9554}.Release|Any CPU.Build.0 = Release|Any CPU
38 | EndGlobalSection
39 | GlobalSection(SolutionProperties) = preSolution
40 | HideSolutionNode = FALSE
41 | EndGlobalSection
42 | GlobalSection(ExtensibilityGlobals) = postSolution
43 | SolutionGuid = {8106D27D-2EFE-43A0-8DD3-71E04F7AD7AC}
44 | EndGlobalSection
45 | EndGlobal
46 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/OverallIntensity/ShowOverallIntensityValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using BarRaider.SdTools;
4 | using Newtonsoft.Json;
5 | using Newtonsoft.Json.Linq;
6 | using System.ServiceModel;
7 |
8 |
9 | namespace sfx_100_streamdeck_plugin.PluginActions
10 | {
11 | [PluginActionId("sfx-100-streamdeck-plugin.showoverallintensityvalue")]
12 | public class ShowOverallIntensityValue : PluginBase
13 | {
14 | private class PluginSettings
15 | {
16 | public static PluginSettings CreateDefaultSettings()
17 | {
18 | PluginSettings instance = new PluginSettings();
19 | instance.RefreshRate = 1000;
20 | return instance;
21 | }
22 |
23 | [JsonProperty(PropertyName = "RefreshRate")]
24 | public int RefreshRate { get; set; }
25 |
26 | }
27 |
28 | #region Private Members
29 |
30 | private PluginSettings settings;
31 | private DateTime lastRefresh;
32 |
33 | #endregion
34 | public ShowOverallIntensityValue(SDConnection connection, InitialPayload payload) : base(connection, payload)
35 | {
36 | if (payload.Settings == null || payload.Settings.Count == 0)
37 | {
38 | settings = PluginSettings.CreateDefaultSettings();
39 | SaveSettings();
40 | }
41 | else
42 | {
43 | settings = payload.Settings.ToObject();
44 | }
45 | }
46 |
47 | public override void Dispose() { }
48 |
49 | public override void KeyPressed(KeyPayload payload) { }
50 |
51 | public override void KeyReleased(KeyPayload payload)
52 | { }
53 |
54 | public override async void OnTick()
55 | {
56 | try
57 | {
58 | if ((DateTime.Now - lastRefresh).TotalMilliseconds >= settings.RefreshRate)
59 | {
60 | PipeServerConnection.Instance.RestartChannel();
61 |
62 | int currentValue = Int32.MaxValue;
63 | currentValue = PipeServerConnection.Instance.Channel.GetOverallIntensity();
64 | await setDisplayData(currentValue);
65 | lastRefresh = DateTime.Now;
66 | }
67 | }
68 | catch (Exception ex)
69 | {
70 | // Empty because of spamming if pipe not accessible :)
71 | }
72 | }
73 |
74 | private async Task setDisplayData(int currentValue)
75 | {
76 | await Connection.SetTitleAsync(currentValue.ToString());
77 | }
78 |
79 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
80 | {
81 | Tools.AutoPopulateSettings(settings, payload.Settings);
82 | SaveSettings();
83 | }
84 |
85 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
86 |
87 | #region Private Methods
88 |
89 | private Task SaveSettings()
90 | {
91 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
92 | }
93 |
94 | #endregion
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/Controllers/EnableControllerProperty.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using BarRaider.SdTools;
4 | using Newtonsoft.Json;
5 | using Newtonsoft.Json.Linq;
6 | using System.ServiceModel;
7 |
8 |
9 | namespace sfx_100_streamdeck_plugin.PluginActions
10 | {
11 | [PluginActionId("sfx-100-streamdeck-plugin.enablecontrollerproperty")]
12 | public class EnableControllerProperty : PluginBase
13 | {
14 | private class PluginSettings
15 | {
16 | public static PluginSettings CreateDefaultSettings()
17 | {
18 | PluginSettings instance = new PluginSettings();
19 | instance.ControllerName = "SFX";
20 | instance.ValueToChange = "Smoothness";
21 | return instance;
22 | }
23 |
24 | [JsonProperty(PropertyName = "ControllerName")]
25 | public string ControllerName { get; set; }
26 |
27 | [JsonProperty(PropertyName = "ValueToChange")]
28 | public string ValueToChange { get; set; }
29 |
30 | }
31 |
32 | #region Private Members
33 |
34 | private PluginSettings settings;
35 |
36 | #endregion
37 | public EnableControllerProperty(SDConnection connection, InitialPayload payload) : base(connection, payload)
38 | {
39 | if (payload.Settings == null || payload.Settings.Count == 0)
40 | {
41 | settings = PluginSettings.CreateDefaultSettings();
42 | SaveSettings();
43 | }
44 | else
45 | {
46 | settings = payload.Settings.ToObject();
47 | }
48 | }
49 |
50 | public override void Dispose() { }
51 |
52 | public override void KeyPressed(KeyPayload payload) { }
53 |
54 | public override void KeyReleased(KeyPayload payload)
55 | {
56 | try
57 | {
58 | PipeServerConnection.Instance.RestartChannel();
59 | switch (settings.ValueToChange)
60 | {
61 | case "Smoothness":
62 | PipeServerConnection.Instance.Channel.ControllerSmoothnessEnable(settings.ControllerName);
63 | break;
64 | default:
65 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: ValueToChange not set correctly: " + settings.ValueToChange);
66 | break;
67 | }
68 | }
69 | catch (EndpointNotFoundException endpointNotFoundException)
70 | {
71 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: Endpoint not found - Is SimFeedback available and is the Plugin enabled? " + endpointNotFoundException.Message);
72 | }
73 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
74 | {
75 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: communicationObjectFaultedException: " + communicationObjectFaultedException.Message);
76 | }
77 | catch (Exception ex)
78 | {
79 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error during Key processing: " + ex.Message);
80 | }
81 | }
82 |
83 | public override void OnTick() { }
84 |
85 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
86 | {
87 | Tools.AutoPopulateSettings(settings, payload.Settings);
88 | SaveSettings();
89 | }
90 |
91 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
92 |
93 | #region Private Methods
94 |
95 | private Task SaveSettings()
96 | {
97 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
98 | }
99 |
100 | #endregion
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/Controllers/DisableControllerProperty.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using BarRaider.SdTools;
4 | using Newtonsoft.Json;
5 | using Newtonsoft.Json.Linq;
6 | using System.ServiceModel;
7 |
8 |
9 | namespace sfx_100_streamdeck_plugin.PluginActions
10 | {
11 | [PluginActionId("sfx-100-streamdeck-plugin.disablecontrollerproperty")]
12 | public class DisableControllerProperty : PluginBase
13 | {
14 | private class PluginSettings
15 | {
16 | public static PluginSettings CreateDefaultSettings()
17 | {
18 | PluginSettings instance = new PluginSettings();
19 | instance.ControllerName = "SFX";
20 | instance.ValueToChange = "Smoothness";
21 | return instance;
22 | }
23 |
24 | [JsonProperty(PropertyName = "ControllerName")]
25 | public string ControllerName { get; set; }
26 |
27 | [JsonProperty(PropertyName = "ValueToChange")]
28 | public string ValueToChange { get; set; }
29 |
30 | }
31 |
32 | #region Private Members
33 |
34 | private PluginSettings settings;
35 |
36 | #endregion
37 | public DisableControllerProperty(SDConnection connection, InitialPayload payload) : base(connection, payload)
38 | {
39 | if (payload.Settings == null || payload.Settings.Count == 0)
40 | {
41 | settings = PluginSettings.CreateDefaultSettings();
42 | SaveSettings();
43 | }
44 | else
45 | {
46 | settings = payload.Settings.ToObject();
47 | }
48 | }
49 |
50 | public override void Dispose() { }
51 |
52 | public override void KeyPressed(KeyPayload payload) { }
53 |
54 | public override void KeyReleased(KeyPayload payload)
55 | {
56 | try
57 | {
58 | PipeServerConnection.Instance.RestartChannel();
59 | switch (settings.ValueToChange)
60 | {
61 | case "Smoothness":
62 | PipeServerConnection.Instance.Channel.ControllerSmoothnessDisable(settings.ControllerName);
63 | break;
64 | default:
65 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: ValueToChange not set correctly: " + settings.ValueToChange);
66 | break;
67 | }
68 | }
69 | catch (EndpointNotFoundException endpointNotFoundException)
70 | {
71 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: Endpoint not found - Is SimFeedback available and is the Plugin enabled? " + endpointNotFoundException.Message);
72 | }
73 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
74 | {
75 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: communicationObjectFaultedException: " + communicationObjectFaultedException.Message);
76 | }
77 | catch (Exception ex)
78 | {
79 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error during Key processing: " + ex.Message);
80 | }
81 | }
82 |
83 | public override void OnTick() { }
84 |
85 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
86 | {
87 | Tools.AutoPopulateSettings(settings, payload.Settings);
88 | SaveSettings();
89 | }
90 |
91 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
92 |
93 | #region Private Methods
94 |
95 | private Task SaveSettings()
96 | {
97 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
98 | }
99 |
100 | #endregion
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/Effects/EnableEffectProperty.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using BarRaider.SdTools;
4 | using Newtonsoft.Json;
5 | using Newtonsoft.Json.Linq;
6 | using System.ServiceModel;
7 |
8 |
9 | namespace sfx_100_streamdeck_plugin.PluginActions
10 | {
11 | [PluginActionId("sfx-100-streamdeck-plugin.enableeffectproperty")]
12 | public class EnableEffectProperty : PluginBase
13 | {
14 | private class PluginSettings
15 | {
16 | public static PluginSettings CreateDefaultSettings()
17 | {
18 | PluginSettings instance = new PluginSettings();
19 | instance.EffectName = "Heave";
20 | instance.ValueToChange = "Enable";
21 | return instance;
22 | }
23 |
24 | [JsonProperty(PropertyName = "EffectName")]
25 | public string EffectName { get; set; }
26 |
27 | [JsonProperty(PropertyName = "ValueToChange")]
28 | public string ValueToChange { get; set; }
29 |
30 | }
31 |
32 | #region Private Members
33 |
34 | private PluginSettings settings;
35 |
36 | #endregion
37 | public EnableEffectProperty(SDConnection connection, InitialPayload payload) : base(connection, payload)
38 | {
39 | if (payload.Settings == null || payload.Settings.Count == 0)
40 | {
41 | settings = PluginSettings.CreateDefaultSettings();
42 | SaveSettings();
43 | }
44 | else
45 | {
46 | settings = payload.Settings.ToObject();
47 | }
48 | }
49 |
50 | public override void Dispose() { }
51 |
52 | public override void KeyPressed(KeyPayload payload) { }
53 |
54 | public override void KeyReleased(KeyPayload payload)
55 | {
56 | try
57 | {
58 | PipeServerConnection.Instance.RestartChannel();
59 | switch (settings.ValueToChange)
60 | {
61 | case "Linear":
62 | PipeServerConnection.Instance.Channel.EffectLinearEnable(settings.EffectName);
63 | break;
64 | case "Enable":
65 | PipeServerConnection.Instance.Channel.EffectEnable(settings.EffectName);
66 | break;
67 | case "Mute":
68 | PipeServerConnection.Instance.Channel.EffectMuteEnable(settings.EffectName);
69 | break;
70 | default:
71 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: ValueToChange not set correctly: " + settings.ValueToChange);
72 | break;
73 | }
74 | }
75 | catch (EndpointNotFoundException endpointNotFoundException)
76 | {
77 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: Endpoint not found - Is SimFeedback available and is the Plugin enabled? " + endpointNotFoundException.Message);
78 | }
79 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
80 | {
81 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: communicationObjectFaultedException: " + communicationObjectFaultedException.Message);
82 | }
83 | catch (Exception ex)
84 | {
85 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error during Key processing: " + ex.Message);
86 | }
87 | }
88 |
89 | public override void OnTick() { }
90 |
91 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
92 | {
93 | Tools.AutoPopulateSettings(settings, payload.Settings);
94 | SaveSettings();
95 | }
96 |
97 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
98 |
99 | #region Private Methods
100 |
101 | private Task SaveSettings()
102 | {
103 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
104 | }
105 |
106 | #endregion
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/Effects/ShowEffectValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using BarRaider.SdTools;
4 | using Newtonsoft.Json;
5 | using Newtonsoft.Json.Linq;
6 | using System.ServiceModel;
7 |
8 |
9 | namespace sfx_100_streamdeck_plugin.PluginActions
10 | {
11 | [PluginActionId("sfx-100-streamdeck-plugin.showeffectvalue")]
12 | public class ShowEffectValue : PluginBase
13 | {
14 | private class PluginSettings
15 | {
16 | public static PluginSettings CreateDefaultSettings()
17 | {
18 | PluginSettings instance = new PluginSettings();
19 | instance.EffectName = "Heave";
20 | instance.RefreshRate = 1000;
21 | instance.ValueToDisplay = "Intensity";
22 | return instance;
23 | }
24 |
25 | [JsonProperty(PropertyName = "EffectName")]
26 | public string EffectName { get; set; }
27 |
28 | [JsonProperty(PropertyName = "RefreshRate")]
29 | public int RefreshRate { get; set; }
30 |
31 | [JsonProperty(PropertyName = "ValueToDisplay")]
32 | public string ValueToDisplay { get; set; }
33 | }
34 |
35 | #region Private Members
36 |
37 | private PluginSettings settings;
38 | private DateTime lastRefresh;
39 |
40 | #endregion
41 | public ShowEffectValue(SDConnection connection, InitialPayload payload) : base(connection, payload)
42 | {
43 | if (payload.Settings == null || payload.Settings.Count == 0)
44 | {
45 | settings = PluginSettings.CreateDefaultSettings();
46 | SaveSettings();
47 | }
48 | else
49 | {
50 | settings = payload.Settings.ToObject();
51 | }
52 | }
53 |
54 | public override void Dispose() { }
55 |
56 | public override void KeyPressed(KeyPayload payload) { }
57 |
58 | public override void KeyReleased(KeyPayload payload)
59 | { }
60 |
61 | public override async void OnTick()
62 | {
63 | try
64 | {
65 | if ((DateTime.Now - lastRefresh).TotalMilliseconds >= settings.RefreshRate)
66 | {
67 | PipeServerConnection.Instance.RestartChannel();
68 |
69 | int currentValue = Int32.MaxValue;
70 |
71 | switch (settings.ValueToDisplay)
72 | {
73 | case "Intensity":
74 | currentValue = PipeServerConnection.Instance.Channel.EffectIntensityGet(settings.EffectName);
75 | break;
76 | case "Smoothness":
77 | currentValue = PipeServerConnection.Instance.Channel.EffectSmoothingGet(settings.EffectName);
78 | break;
79 | default:
80 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: ValueToDisplay not set correctly: " + settings.ValueToDisplay);
81 | break;
82 | }
83 | await setDisplayData(currentValue);
84 | lastRefresh = DateTime.Now;
85 | }
86 | }
87 | catch (Exception ex)
88 | {
89 | // Empty because of spamming if pipe not accessible :)
90 | }
91 | }
92 |
93 | private async Task setDisplayData(int currentValue)
94 | {
95 | await Connection.SetTitleAsync(currentValue.ToString());
96 | }
97 |
98 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
99 | {
100 | Tools.AutoPopulateSettings(settings, payload.Settings);
101 | SaveSettings();
102 | }
103 |
104 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
105 |
106 | #region Private Methods
107 |
108 | private Task SaveSettings()
109 | {
110 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
111 | }
112 |
113 | #endregion
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/Effects/DisableEffectProperty.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using BarRaider.SdTools;
4 | using Newtonsoft.Json;
5 | using Newtonsoft.Json.Linq;
6 | using System.ServiceModel;
7 |
8 |
9 | namespace sfx_100_streamdeck_plugin.PluginActions
10 | {
11 | [PluginActionId("sfx-100-streamdeck-plugin.disableeffectproperty")]
12 | public class DisableEffectProperty : PluginBase
13 | {
14 | private class PluginSettings
15 | {
16 | public static PluginSettings CreateDefaultSettings()
17 | {
18 | PluginSettings instance = new PluginSettings();
19 | instance.EffectName = "Heave";
20 | instance.ValueToChange = "Enable";
21 | return instance;
22 | }
23 |
24 | [JsonProperty(PropertyName = "EffectName")]
25 | public string EffectName { get; set; }
26 |
27 | [JsonProperty(PropertyName = "ValueToChange")]
28 | public string ValueToChange { get; set; }
29 |
30 | }
31 |
32 | #region Private Members
33 |
34 | private PluginSettings settings;
35 |
36 | #endregion
37 | public DisableEffectProperty(SDConnection connection, InitialPayload payload) : base(connection, payload)
38 | {
39 | if (payload.Settings == null || payload.Settings.Count == 0)
40 | {
41 | settings = PluginSettings.CreateDefaultSettings();
42 | SaveSettings();
43 | }
44 | else
45 | {
46 | settings = payload.Settings.ToObject();
47 | }
48 | }
49 |
50 | public override void Dispose() { }
51 |
52 | public override void KeyPressed(KeyPayload payload) { }
53 |
54 | public override void KeyReleased(KeyPayload payload)
55 | {
56 | try
57 | {
58 | PipeServerConnection.Instance.RestartChannel();
59 | switch (settings.ValueToChange)
60 | {
61 | case "Linear":
62 | PipeServerConnection.Instance.Channel.EffectLinearDisable(settings.EffectName);
63 | break;
64 | case "Enable":
65 | PipeServerConnection.Instance.Channel.EffectDisable(settings.EffectName);
66 | break;
67 | case "Mute":
68 | PipeServerConnection.Instance.Channel.EffectMuteDisable(settings.EffectName);
69 | break;
70 | default:
71 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: ValueToChange not set correctly: " + settings.ValueToChange);
72 | break;
73 | }
74 | }
75 | catch (EndpointNotFoundException endpointNotFoundException)
76 | {
77 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: Endpoint not found - Is SimFeedback available and is the Plugin enabled? " + endpointNotFoundException.Message);
78 | }
79 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
80 | {
81 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: communicationObjectFaultedException: " + communicationObjectFaultedException.Message);
82 | }
83 | catch (Exception ex)
84 | {
85 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error during Key processing: " + ex.Message);
86 | }
87 | }
88 |
89 | public override void OnTick() { }
90 |
91 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
92 | {
93 | Tools.AutoPopulateSettings(settings, payload.Settings);
94 | SaveSettings();
95 | }
96 |
97 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
98 |
99 | #region Private Methods
100 |
101 | private Task SaveSettings()
102 | {
103 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
104 | }
105 |
106 | #endregion
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/StreamdeckExtensionControl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using SimFeedback.extension;
4 |
5 | namespace sfx_100_streamdeck_sfb_extension
6 | {
7 | public partial class StreamdeckExtensionControl : UserControl
8 | {
9 | private bool isStarted = false;
10 |
11 | private StreamdeckExtension _streamdeckExtension;
12 | private SimFeedbackExtensionFacade _simFeedbackFacade;
13 |
14 |
15 | public StreamdeckExtensionControl(StreamdeckExtension ext, SimFeedbackExtensionFacade simFeedbackFacade)
16 | {
17 | _streamdeckExtension = ext;
18 | _simFeedbackFacade = simFeedbackFacade;
19 | SimFeedbackFacadeProvider.Instance.SimFeedbackFacade = simFeedbackFacade;
20 |
21 |
22 | InitializeComponent();
23 | GuiLoggerProvider.Instance.LogBox = _streamdeckExtensionControlGui1.debugBox;
24 | }
25 |
26 |
27 |
28 | public void Start()
29 | {
30 | isStarted = true;
31 | _streamdeckExtension.SetIsRunning(true);
32 | //throw new NotImplementedException();
33 | }
34 |
35 | public void Stop()
36 | {
37 | if (!isStarted) return;
38 | isStarted = false;
39 | _streamdeckExtension.SetIsRunning(false);
40 | //throw new NotImplementedException();
41 | }
42 |
43 | public async void LogQchanged(object sender, EventArgs e)
44 | {
45 |
46 | //if (InvokeRequired)
47 | //{
48 | // Invoke((MethodInvoker) async delegate
49 | // {
50 |
51 | // try
52 | // {
53 | // //await SimFeedbackInvoker.Instance.LoadWithDelay();
54 | // await SimFeedbackFacadeProvider.Instance.DispatcherHelper.BeginInvoke((Action) (() =>
55 | // {
56 | // GuiLoggerProvider.Instance.Log("Log vom LogQchanged als Invoked");
57 | // SimFeedbackInvoker.Instance.LoadElements();
58 | // GuiLoggerProvider.Instance.Log("Loaded als Invoked");
59 | // }));
60 | // }
61 | // catch (Exception exception)
62 | // {
63 | // SentrySdk.CaptureException(exception);
64 | // GuiLoggerProvider.Instance.Log("Error in Invoked: " + exception);
65 | // }
66 | // });
67 | // return;
68 | //}
69 | //await SimFeedbackFacadeProvider.Instance.DispatcherHelper.BeginInvoke((Action)(() =>
70 | //{
71 | // SimFeedbackInvoker.Instance.LoadElements();
72 | // GuiLoggerProvider.Instance.Log("Log vom LogQchanged mit direct access");
73 | //}));
74 | }
75 |
76 | private void ParentForm_KeyDown(object sender, KeyEventArgs e)
77 | {
78 | if (e.KeyCode == Keys.F5)
79 | {
80 | StartStopToggle();
81 | }
82 | }
83 |
84 | public void StartStopToggle()
85 | {
86 | if (isStarted)
87 | {
88 | isStarted = false;
89 | Stop();
90 | }
91 | else
92 | {
93 | isStarted = true;
94 | Start();
95 | }
96 | }
97 |
98 | private void ModBusExtensionControl_Load(object sender, EventArgs e)
99 | {
100 | if (ParentForm != null)
101 | {
102 | ParentForm.FormClosing += ParentForm_FormClosing;
103 | this.ParentForm.KeyDown += ParentForm_KeyDown;
104 | ParentForm.KeyPreview = true;
105 | }
106 |
107 |
108 |
109 | /*GuiLoggerProvider.Instance.Log("4 Loading Elements for UI Automation");
110 |
111 | var mainWindowHandle = SimFeedbackInvoker.Instance.GetHandleWindow("SimFeedback - 00.09.08");
112 |
113 | GuiLoggerProvider.Instance.Log("4 Aktuelles Window handle: " + mainWindowHandle);
114 | */
115 |
116 | //SimFeedbackInvoker.Instance.LoadElements();
117 |
118 | }
119 |
120 |
121 |
122 | private void ParentForm_FormClosing(object sender, FormClosingEventArgs e)
123 | {
124 | Stop();
125 | }
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SFX-100-Streamdeck
2 |
3 | Simfeedback extension and Streamdeck plugin to Start/Stop and control your Sim-Rig
4 | ## Please read the [installation instructions](#installation) below BEFORE download
5 | **See it in action here** (Thx @hoihman for the video!)
6 | [](http://www.youtube.com/watch?v=9pzWQWNlzzM)
7 |
8 |
9 |
10 | 
11 |
12 | ## Version 0.0.2.6 New Features: Live Tuning and show values
13 | - It is now possible to change the values of every effect and controller
14 | - Optionally show the new value on button after changing it
15 | - Added display-only buttons to display current values
16 |
17 | 
18 |
19 | ## Version 0.0.1.8 New Feature: StartProfile / StartSimFeedback
20 | It is now possible to start SimFeedback with a desired profile and enable Motion by clicking a single Button.
21 | - If SimFeedback is not startet it will start it for you.
22 | - If SimFeedback is already running it will be restarted with the (new) desired profile automatically.
23 |
24 | :warning: **The selected profile MUST be located in SimFeedback profiles folder**
25 |
26 | 
27 |
28 | ## Requirements
29 |
30 | - Stream Deck for Windows
31 | https://www.elgato.com/de/gaming/downloads
32 |
33 | - SimFeedback Software with Expert mode enabled
34 | https://github.com/SimFeedback/SimFeedback-AC-Servo
35 |
36 |
37 | # Installation
38 | - Do not click on Download on this page. Download the files from the release tab or use the following links:
39 | (Please note you get the latest stable versions through these links. Pre-Release/Beta versions must be loaded from release tab.)
40 | - [latest StreamDeckExtension.zip](https://github.com/ashupp/SFX-100-Streamdeck/releases/latest/download/StreamdeckExtension.zip)
41 | - [latest StreamDeckPlugin](https://github.com/ashupp/SFX-100-Streamdeck/releases/latest/download/sfx-100-streamdeck-plugin.streamDeckPlugin)
42 | - Unzip the extension into the SimFeedback extension dir.
43 | - Start SimFeedback and enable Expert mode if not enabled.
44 | - Enable the plugin and enable autorun of the extension in SimFeedback
45 | - Install the Streamdeck extension by double-click
46 | - If it does not work close Simfeedback, run remove_blocking.bat in Simfeedback folder with admin privileges and restart
47 | - You probably have to restart Stream Deck after configuring the buttons.
48 |
49 | 
50 |
51 | # Updating
52 | Prepare by downloading the new versions (see above)
53 | When updating, you have to update **Always** both components!
54 |
55 | **Update SimFeedback extension**
56 | - Close SimFeedback if it is running
57 | - Locate Extensions folder. Delete Folder "StreamdeckExtension"
58 | - Unzip the new version of the extension into the Simfeedback extension dir
59 | - Start SimFeedback, re-enable the extension and autostart and check if the version is the new one
60 | - Click on the extensions tab to see if the extension is running
61 |
62 | **Update StreamDeck plugin**
63 | - Open the windows StreamDeck application and click the lower right button "More actions"
64 | - Locate sfx-100-streamdeck-plugin and click Uninstall
65 | - Install the new version of the StreamDeck plugin by double-click
66 | - Your buttons should be still be there after installing the new version
67 |
68 | ## Known issues
69 | - "Is telemetry provider connected?" is set to true as soon as any telemetry provider is connected but it will never be false again. Even if the telemetry provider changes or is disconnected. This seems to be a problem of the SimFeedback API.
70 | - Works only correct if Expert mode of SimFeedback is enabled
71 | - Does not work when SimFeedback is started minimized
72 |
73 | ## Ideas / Future implementation
74 |
75 | - ✓ Change / activate Profile with click on button (Available since 0.0.1.5)
76 | - ✓ Display of current intensity value on button face (thx @Flag Ghost) (Available since 0.0.2.6)
77 | - Backup current profile to chosen backup directory with timestamp (thx @HoiHman)
78 | - Display current enabled/disabled state on (toggle) buttons (thx @J.R.)
79 | - Show values on incement/decrement buttons constantly (thx @HoiHman)
80 | - Show Controller / Effect Values constantly and allow button text and/or background image (thx @HoiHman)
81 | - Change / Activate profile without restart of SimFeedback
82 |
83 | ## Third party Libraries
84 | **This tool makes use of the following great projects:**
85 |
86 | BarRaider's Stream Deck Tools
87 | https://github.com/BarRaider/streamdeck-tools
88 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/Controllers/ShowControllerValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using BarRaider.SdTools;
4 | using Newtonsoft.Json;
5 | using Newtonsoft.Json.Linq;
6 | using System.ServiceModel;
7 |
8 |
9 | namespace sfx_100_streamdeck_plugin.PluginActions
10 | {
11 | [PluginActionId("sfx-100-streamdeck-plugin.showcontrollervalue")]
12 | public class ShowControllerValue : PluginBase
13 | {
14 | private class PluginSettings
15 | {
16 | public static PluginSettings CreateDefaultSettings()
17 | {
18 | PluginSettings instance = new PluginSettings();
19 | instance.ControllerName = "SFX";
20 | instance.RefreshRate = 1000;
21 | instance.ValueToDisplay = "Intensity";
22 | return instance;
23 | }
24 |
25 | [JsonProperty(PropertyName = "ControllerName")]
26 | public string ControllerName { get; set; }
27 |
28 | [JsonProperty(PropertyName = "RefreshRate")]
29 | public int RefreshRate { get; set; }
30 |
31 | [JsonProperty(PropertyName = "ValueToDisplay")]
32 | public string ValueToDisplay { get; set; }
33 | }
34 |
35 | #region Private Members
36 |
37 | private PluginSettings settings;
38 | private DateTime lastRefresh;
39 |
40 | #endregion
41 | public ShowControllerValue(SDConnection connection, InitialPayload payload) : base(connection, payload)
42 | {
43 | if (payload.Settings == null || payload.Settings.Count == 0)
44 | {
45 | settings = PluginSettings.CreateDefaultSettings();
46 | SaveSettings();
47 | }
48 | else
49 | {
50 | settings = payload.Settings.ToObject();
51 | }
52 | }
53 |
54 | public override void Dispose() { }
55 |
56 | public override void KeyPressed(KeyPayload payload) { }
57 |
58 | public override void KeyReleased(KeyPayload payload)
59 | { }
60 |
61 | public override async void OnTick()
62 | {
63 | try
64 | {
65 | if ((DateTime.Now - lastRefresh).TotalMilliseconds >= settings.RefreshRate)
66 | {
67 | PipeServerConnection.Instance.RestartChannel();
68 |
69 | int currentValue = Int32.MaxValue;
70 |
71 | switch (settings.ValueToDisplay)
72 | {
73 | case "Intensity":
74 | currentValue = PipeServerConnection.Instance.Channel.ControllerIntensityGet(settings.ControllerName);
75 | break;
76 |
77 | case "Smoothness":
78 | currentValue = PipeServerConnection.Instance.Channel.ControllerSmoothnessGet(settings.ControllerName);
79 | break;
80 |
81 | case "Acceleration":
82 | currentValue = PipeServerConnection.Instance.Channel.ControllerAccelerationGet(settings.ControllerName);
83 | break;
84 |
85 | case "MinSpeed":
86 | currentValue = PipeServerConnection.Instance.Channel.ControllerMinSpeedGet(settings.ControllerName);
87 | break;
88 |
89 | case "MaxSpeed":
90 | currentValue = PipeServerConnection.Instance.Channel.ControllerMaxSpeedGet(settings.ControllerName);
91 | break;
92 | default:
93 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: ValueToDisplay not set correctly: " + settings.ValueToDisplay);
94 | break;
95 | }
96 | await setDisplayData(currentValue);
97 | lastRefresh = DateTime.Now;
98 | }
99 | }
100 | catch (Exception ex)
101 | {
102 | // Empty because of spamming if pipe not accessible :)
103 | }
104 | }
105 |
106 | private async Task setDisplayData(int currentValue)
107 | {
108 | await Connection.SetTitleAsync(currentValue.ToString());
109 | }
110 |
111 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
112 | {
113 | Tools.AutoPopulateSettings(settings, payload.Settings);
114 | SaveSettings();
115 | }
116 |
117 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
118 |
119 | #region Private Methods
120 |
121 | private Task SaveSettings()
122 | {
123 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
124 | }
125 |
126 | #endregion
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/StreamdeckExtensionControlGui.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Configuration;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Text;
6 | using System.Windows;
7 | using System.Windows.Navigation;
8 | using sfx_100_streamdeck_sfb_extension.Properties;
9 | using System.Threading.Tasks;
10 | using System.Windows.Forms;
11 | using Application = System.Windows.Application;
12 |
13 | namespace sfx_100_streamdeck_sfb_extension
14 | {
15 | ///
16 | /// Interaktionslogik für ModBusExtensionControlGUI.xaml
17 | ///
18 | public partial class StreamdeckExtensionControlGui
19 | {
20 |
21 | #region Main Entry
22 |
23 | public StreamdeckExtensionControlGui()
24 | {
25 |
26 | InitializeComponent();
27 | debugBox.Visibility = Visibility.Collapsed;
28 | streamdeckExtensionTitle.Content = streamdeckExtensionTitle.Content + " - " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
29 | DataContext = this;
30 |
31 | GuiLoggerProvider.Instance.Log("Init Extension GUI");
32 | SimFeedbackFacadeProvider.Instance.DispatcherHelper = this.Dispatcher;
33 | SimFeedbackInvoker.Instance.LoadWithDelay();
34 | }
35 |
36 |
37 |
38 | #endregion
39 |
40 | #region Members
41 |
42 |
43 | public SimFeedback.extension.SimFeedbackExtensionFacade SimFeedbackFacade;
44 |
45 | #endregion
46 |
47 |
48 | #region Eventhandlers
49 |
50 | ///
51 | /// Eventhandler called when control is loaded.
52 | /// ///
53 | ///
54 | ///
55 | private void StreamdeckExtensionControlGUI_OnLoaded(object sender, RoutedEventArgs e)
56 | {
57 | try
58 | {
59 | GuiLoggerProvider.Instance.Log("Loaded Extension GUI");
60 | }
61 | catch (Exception ex)
62 | {
63 | GuiLoggerProvider.Instance.Log("Warning: Could not start server " + ex.Message);
64 | }
65 | }
66 |
67 |
68 |
69 | ///
70 | /// Disconnect when UI is unloaded
71 | ///
72 | ///
73 | ///
74 | private void StreamdeckExtensionControlGUI_OnUnloaded(object sender, RoutedEventArgs e)
75 | {
76 | GuiLoggerProvider.Instance.Log("Shutdown Extension GUI");
77 | Settings.Default.Save();
78 | }
79 |
80 | ///
81 | /// Eventhandler launched when Project URI is clicked
82 | ///
83 | ///
84 | ///
85 | private void Hyperlink_OnRequestNavigate(object sender, RequestNavigateEventArgs e)
86 | {
87 | Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
88 | e.Handled = true;
89 | }
90 |
91 | #endregion
92 |
93 | private void Button_Click(object sender, RoutedEventArgs e)
94 | {
95 | FileStream myStream;
96 | SaveFileDialog saveFileDialog1 = new SaveFileDialog();
97 |
98 | saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
99 | saveFileDialog1.FilterIndex = 2;
100 | saveFileDialog1.RestoreDirectory = true;
101 | saveFileDialog1.FileName = "streamDeckExtensionLog.txt";
102 |
103 | if (saveFileDialog1.ShowDialog() == DialogResult.OK)
104 | {
105 | if ((myStream = saveFileDialog1.OpenFile() as FileStream) != null)
106 | {
107 | // Code to write the stream goes here.
108 | int offset = 0;
109 | foreach (var item in GuiLoggerProvider.Instance.LogBox.Items)
110 | {
111 | byte[] bytes = Encoding.ASCII.GetBytes(item.ToString()+"\r\n");
112 | myStream.Write(bytes, 0, bytes.Length);
113 | offset += bytes.Length;
114 | }
115 |
116 | myStream.Close();
117 | }
118 | }
119 | }
120 |
121 | private async void Button_Click_1(object sender, RoutedEventArgs e)
122 | {
123 | GuiLoggerProvider.Instance.Log("Change Tab and load UI Automation");
124 | await SimFeedbackInvoker.Instance.LoadWithDelay();
125 | GuiLoggerProvider.Instance.Log("End Change Tab and load UI Automation ");
126 | }
127 |
128 | private void chkLogging_Checked(object sender, RoutedEventArgs e)
129 | {
130 | GuiLoggerProvider.Instance.LoggingEnabled = true;
131 | GuiLoggerProvider.Instance.LogBox.Visibility = Visibility.Visible;
132 | GuiLoggerProvider.Instance.Log("Logging enabled");
133 | }
134 |
135 | private void chkLogging_Unchecked(object sender, RoutedEventArgs e)
136 | {
137 | GuiLoggerProvider.Instance.LoggingEnabled = false;
138 | GuiLoggerProvider.Instance.LogBox.Items.Clear();
139 | GuiLoggerProvider.Instance.LogBox.Visibility = Visibility.Hidden;
140 | }
141 | }
142 | }
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/General/IsRunning.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ServiceModel;
3 | using System.Threading.Tasks;
4 | using BarRaider.SdTools;
5 | using Newtonsoft.Json;
6 | using Newtonsoft.Json.Linq;
7 |
8 |
9 | namespace sfx_100_streamdeck_plugin.PluginActions
10 | {
11 | [PluginActionId("sfx-100-streamdeck-plugin.isrunning")]
12 | public class IsRunning : PluginBase
13 | {
14 | private class PluginSettings
15 | {
16 | public static PluginSettings CreateDefaultSettings()
17 | {
18 | PluginSettings instance = new PluginSettings();
19 | instance.PrimaryImageFilename = string.Empty;
20 | instance.SecondaryImageFilename = string.Empty;
21 | instance.CheckInterval = "10";
22 | return instance;
23 | }
24 |
25 | [FilenameProperty]
26 | [JsonProperty(PropertyName = "primaryImage")]
27 | public string PrimaryImageFilename { get; set; }
28 |
29 | [FilenameProperty]
30 | [JsonProperty(PropertyName = "secondaryImage")]
31 | public string SecondaryImageFilename { get; set; }
32 |
33 | [JsonProperty(PropertyName = "checkInterval")]
34 | public string CheckInterval { get; set; }
35 | }
36 |
37 | private PluginSettings settings;
38 | string primaryFile = null;
39 | string secondaryFile = null;
40 | DateTime lastRefresh;
41 |
42 | public IsRunning(SDConnection connection, InitialPayload payload) : base(connection, payload)
43 | {
44 | if (payload.Settings == null || payload.Settings.Count == 0)
45 | {
46 | settings = PluginSettings.CreateDefaultSettings();
47 | Connection.SetSettingsAsync(JObject.FromObject(settings));
48 | SaveSettings();
49 | }
50 | else
51 | {
52 | settings = payload.Settings.ToObject();
53 | HandleFilenames();
54 | }
55 | }
56 |
57 | public override void Dispose() { }
58 |
59 | public override void KeyPressed(KeyPayload payload) { }
60 |
61 | public override void KeyReleased(KeyPayload payload) { }
62 |
63 | public override async void OnTick()
64 | {
65 | try
66 | {
67 | if ((DateTime.Now - lastRefresh).TotalSeconds >= Convert.ToInt32(settings.CheckInterval))
68 | {
69 | try
70 | {
71 | PipeServerConnection.Instance.RestartChannel();
72 | var isRunning = PipeServerConnection.Instance.Channel.IsRunning();
73 | if (isRunning)
74 | {
75 | await SetRunning();
76 | }
77 | else
78 | {
79 | await SetNotRunning();
80 | }
81 | }
82 | catch (EndpointNotFoundException endpointNotFoundException)
83 | {
84 | await SetError();
85 | }
86 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
87 | {
88 | await SetError();
89 | }
90 | catch (Exception ex)
91 | {
92 | await SetError();
93 | }
94 |
95 | lastRefresh = DateTime.Now;
96 | }
97 | }
98 | catch (Exception ex)
99 | {
100 | Logger.Instance.LogMessage(TracingLevel.ERROR, $"OnTick error: {ex}");
101 | }
102 | }
103 |
104 | private async Task SetError()
105 | {
106 | await SetNotRunning();
107 |
108 | }
109 |
110 | private async Task SetNotRunning()
111 | {
112 | if (!String.IsNullOrWhiteSpace(primaryFile))
113 | {
114 | await Connection.SetImageAsync(primaryFile);
115 | await Connection.SetTitleAsync("");
116 | }
117 | else
118 | {
119 | await Connection.SetTitleAsync("Not running");
120 | }
121 | }
122 |
123 | private async Task SetRunning()
124 | {
125 | if (!String.IsNullOrWhiteSpace(secondaryFile))
126 | {
127 | await Connection.SetImageAsync(secondaryFile);
128 | await Connection.SetTitleAsync("");
129 | }
130 | else
131 | {
132 | await Connection.SetTitleAsync("Running");
133 | }
134 | }
135 |
136 |
137 | private void CheckStatus()
138 | {
139 |
140 | }
141 |
142 | private void HandleFilenames()
143 | {
144 | primaryFile = Tools.FileToBase64(settings.PrimaryImageFilename, true);
145 | secondaryFile = Tools.FileToBase64(settings.SecondaryImageFilename, true);
146 | Connection.SetSettingsAsync(JObject.FromObject(settings));
147 | }
148 |
149 |
150 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
151 | {
152 | Tools.AutoPopulateSettings(settings, payload.Settings);
153 | HandleFilenames();
154 | SaveSettings();
155 | }
156 |
157 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
158 |
159 |
160 | #region Private Methods
161 |
162 | private Task SaveSettings()
163 | {
164 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
165 | }
166 |
167 | #endregion
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/sfx-100-streamdeck-extension.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {0192378E-D172-4661-A198-A7976AB3D7E0}
8 | Library
9 | Properties
10 | sfx_100_streamdeck_sfb_extension
11 | sfx-100-streamdeck-sfb-extension
12 | v4.7.2
13 | 512
14 | true
15 |
16 |
17 |
18 | true
19 | full
20 | true
21 | ..\..\..\Downloads\SimFeedbackx\extensions\StreamdeckExtension\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 | x86
26 |
27 |
28 | none
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 | false
35 | false
36 | x86
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | lib\SimFeedbackExtension.dll
45 | False
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | False
65 | False
66 |
67 |
68 | False
69 | False
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | UserControl
84 |
85 |
86 | StreamdeckExtensionControl.cs
87 |
88 |
89 | StreamdeckExtensionControlGui.xaml
90 |
91 |
92 |
93 | True
94 | True
95 | Settings.settings
96 |
97 |
98 |
99 |
100 | StreamdeckExtensionControl.cs
101 |
102 |
103 |
104 |
105 | Designer
106 | MSBuild:Compile
107 |
108 |
109 |
110 |
111 |
112 | SettingsSingleFileGenerator
113 | Settings.Designer.cs
114 |
115 |
116 |
117 |
118 | {0dd43943-2b44-489d-8478-75c5b2f87e8c}
119 | sfx-100-streamdeck-pipecontract
120 | False
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/General/IsTelemetryProviderConnected.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ServiceModel;
3 | using System.Threading.Tasks;
4 | using BarRaider.SdTools;
5 | using Newtonsoft.Json;
6 | using Newtonsoft.Json.Linq;
7 |
8 |
9 | namespace sfx_100_streamdeck_plugin.PluginActions
10 | {
11 | [PluginActionId("sfx-100-streamdeck-plugin.istelemetryproviderconnected")]
12 | public class IsTelemetryProviderConnected : PluginBase
13 | {
14 | private class PluginSettings
15 | {
16 | public static PluginSettings CreateDefaultSettings()
17 | {
18 | PluginSettings instance = new PluginSettings();
19 | instance.PrimaryImageFilename = string.Empty;
20 | instance.SecondaryImageFilename = string.Empty;
21 | instance.CheckInterval = "10";
22 | return instance;
23 | }
24 |
25 | [FilenameProperty]
26 | [JsonProperty(PropertyName = "primaryImage")]
27 | public string PrimaryImageFilename { get; set; }
28 |
29 | [FilenameProperty]
30 | [JsonProperty(PropertyName = "secondaryImage")]
31 | public string SecondaryImageFilename { get; set; }
32 |
33 | [JsonProperty(PropertyName = "checkInterval")]
34 | public string CheckInterval { get; set; }
35 | }
36 |
37 | private PluginSettings settings;
38 | string primaryFile = null;
39 | string secondaryFile = null;
40 | DateTime lastRefresh;
41 |
42 | public IsTelemetryProviderConnected(SDConnection connection, InitialPayload payload) : base(connection, payload)
43 | {
44 | if (payload.Settings == null || payload.Settings.Count == 0)
45 | {
46 | settings = PluginSettings.CreateDefaultSettings();
47 | Connection.SetSettingsAsync(JObject.FromObject(settings));
48 | SaveSettings();
49 | }
50 | else
51 | {
52 | settings = payload.Settings.ToObject();
53 | HandleFilenames();
54 | }
55 | }
56 |
57 | public override void Dispose() { }
58 |
59 | public override void KeyPressed(KeyPayload payload) { }
60 |
61 | public override void KeyReleased(KeyPayload payload) { }
62 |
63 | public override async void OnTick()
64 | {
65 | try
66 | {
67 | if ((DateTime.Now - lastRefresh).TotalSeconds >= Convert.ToInt32(settings.CheckInterval))
68 | {
69 | try
70 | {
71 | PipeServerConnection.Instance.RestartChannel();
72 | var telemetryProviderConnected =
73 | PipeServerConnection.Instance.Channel.IsTelemetryProviderConnected();
74 | if (telemetryProviderConnected)
75 | {
76 | await SetConnected();
77 | }
78 | else
79 | {
80 | await SetDisconnected();
81 | }
82 | }
83 | catch (EndpointNotFoundException endpointNotFoundException)
84 | {
85 | await SetError();
86 | }
87 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
88 | {
89 | await SetError();
90 | }
91 | catch (Exception ex)
92 | {
93 | await SetError();
94 | }
95 |
96 | lastRefresh = DateTime.Now;
97 | }
98 | }
99 | catch (Exception ex)
100 | {
101 | Logger.Instance.LogMessage(TracingLevel.ERROR, $"OnTick error: {ex}");
102 | }
103 | }
104 |
105 | private async Task SetError()
106 | {
107 | await SetDisconnected();
108 | }
109 |
110 | private async Task SetDisconnected()
111 | {
112 | if (!String.IsNullOrWhiteSpace(primaryFile))
113 | {
114 | await Connection.SetImageAsync(primaryFile);
115 | await Connection.SetTitleAsync("");
116 | }
117 | else
118 | {
119 | await Connection.SetTitleAsync("Disconnected");
120 | }
121 | }
122 |
123 | private async Task SetConnected()
124 | {
125 | if (!String.IsNullOrWhiteSpace(secondaryFile))
126 | {
127 | await Connection.SetImageAsync(secondaryFile);
128 | await Connection.SetTitleAsync("");
129 | }
130 | else
131 | {
132 | await Connection.SetTitleAsync("Connected");
133 | }
134 | }
135 |
136 |
137 | private void CheckStatus()
138 | {
139 |
140 | }
141 |
142 | private void HandleFilenames()
143 | {
144 | primaryFile = Tools.FileToBase64(settings.PrimaryImageFilename, true);
145 | secondaryFile = Tools.FileToBase64(settings.SecondaryImageFilename, true);
146 | Connection.SetSettingsAsync(JObject.FromObject(settings));
147 | }
148 |
149 |
150 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
151 | {
152 | Tools.AutoPopulateSettings(settings, payload.Settings);
153 | HandleFilenames();
154 | SaveSettings();
155 | }
156 |
157 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
158 |
159 |
160 | #region Private Methods
161 |
162 | private Task SaveSettings()
163 | {
164 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
165 | }
166 |
167 | #endregion
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-sfb-extension/StreamdeckExtensionControl.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 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/OverallIntensity/SetOverallIntensityValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Threading.Tasks;
4 | using BarRaider.SdTools;
5 | using Newtonsoft.Json;
6 | using Newtonsoft.Json.Linq;
7 | using System.ServiceModel;
8 |
9 |
10 | namespace sfx_100_streamdeck_plugin.PluginActions
11 | {
12 | [PluginActionId("sfx-100-streamdeck-plugin.setoverallintensityvalue")]
13 | public class SetOverallIntensityValue : PluginBase
14 | {
15 | private class PluginSettings
16 | {
17 | public static PluginSettings CreateDefaultSettings()
18 | {
19 | PluginSettings instance = new PluginSettings();
20 | instance.Value = 50;
21 | instance.showValueAfterChange = false;
22 | return instance;
23 | }
24 |
25 | [JsonProperty(PropertyName = "Value")]
26 | public int Value { get; set; }
27 |
28 | [JsonProperty(PropertyName = "showValueAfterChange")]
29 | public bool showValueAfterChange { get; set; }
30 |
31 | }
32 |
33 | #region Private Members
34 |
35 | private PluginSettings settings;
36 | private bool _valueShown;
37 | private int _valueShownTimeout = 1;
38 | private DateTime _valueShownDateTime = DateTime.Now;
39 |
40 | #endregion
41 | public SetOverallIntensityValue(SDConnection connection, InitialPayload payload) : base(connection, payload)
42 | {
43 | if (payload.Settings == null || payload.Settings.Count == 0)
44 | {
45 | settings = PluginSettings.CreateDefaultSettings();
46 | SaveSettings();
47 | }
48 | else
49 | {
50 | settings = payload.Settings.ToObject();
51 | }
52 | }
53 |
54 | public override void Dispose() { }
55 |
56 | public override void KeyPressed(KeyPayload payload) { }
57 |
58 | public override void KeyReleased(KeyPayload payload)
59 | {
60 | var returnVal = -1;
61 | try
62 | {
63 | PipeServerConnection.Instance.RestartChannel();
64 | returnVal = PipeServerConnection.Instance.Channel.SetOverallIntensity(settings.Value);
65 | }
66 | catch (EndpointNotFoundException endpointNotFoundException)
67 | {
68 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: Endpoint not found - Is SimFeedback available and is the Plugin enabled? " + endpointNotFoundException.Message);
69 | }
70 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
71 | {
72 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: communicationObjectFaultedException: " + communicationObjectFaultedException.Message);
73 | }
74 | catch (Exception ex)
75 | {
76 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error during Key processing: " + ex.Message);
77 | }
78 |
79 | if (settings.showValueAfterChange)
80 | {
81 | DrawValueData(returnVal);
82 | }
83 | }
84 |
85 | public override void OnTick()
86 | {
87 | if (_valueShown && DateTime.Now - _valueShownDateTime > TimeSpan.FromSeconds(_valueShownTimeout))
88 | {
89 | RestoreImage();
90 | }
91 | }
92 |
93 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
94 | {
95 | Tools.AutoPopulateSettings(settings, payload.Settings);
96 | SaveSettings();
97 | }
98 |
99 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
100 |
101 | #region Private Methods
102 | private async Task DrawValueData(int value)
103 | {
104 |
105 | try
106 | {
107 | var ForegroundColor = "#ffffff";
108 | var BackgroundColor = "#000000";
109 |
110 | Bitmap bmp = Tools.GenerateGenericKeyImage(out Graphics graphics);
111 | int height = bmp.Height;
112 | int width = bmp.Width;
113 |
114 | SizeF stringSize;
115 | float stringPos;
116 | var fontDefault = new Font("Verdana", 30, FontStyle.Bold);
117 |
118 | // Background
119 | var bgBrush = new SolidBrush(ColorTranslator.FromHtml(BackgroundColor));
120 | var fgBrush = new SolidBrush(ColorTranslator.FromHtml(ForegroundColor));
121 | graphics.FillRectangle(bgBrush, 0, 0, width, height);
122 |
123 | // Top title
124 | string title = "";
125 | stringSize = graphics.MeasureString(title, fontDefault);
126 | stringPos = Math.Abs((width - stringSize.Width)) / 2;
127 | graphics.DrawString(title, fontDefault, fgBrush, new PointF(stringPos, 5));
128 |
129 | string currStr = value.ToString();
130 | int buffer = 0;
131 |
132 | stringSize = graphics.MeasureString(currStr, fontDefault);
133 | stringPos = Math.Abs((width - stringSize.Width)) / 2;
134 | graphics.DrawString(currStr, fontDefault, fgBrush, new PointF(stringPos, 50));
135 | Connection.SetImageAsync(bmp);
136 | graphics.Dispose();
137 | _valueShown = true;
138 | _valueShownDateTime = DateTime.Now;
139 | }
140 | catch (Exception ex)
141 | {
142 | Logger.Instance.LogMessage(TracingLevel.ERROR, $"Error drawing image data {ex}");
143 | }
144 | }
145 | private async Task RestoreImage()
146 | {
147 | await Connection.SetDefaultImageAsync();
148 | }
149 | private Task SaveSettings()
150 | {
151 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
152 | }
153 |
154 | #endregion
155 | }
156 | }
157 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/OverallIntensity/IncrementOverallIntensity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Threading.Tasks;
4 | using BarRaider.SdTools;
5 | using Newtonsoft.Json;
6 | using Newtonsoft.Json.Linq;
7 | using System.ServiceModel;
8 |
9 |
10 | namespace sfx_100_streamdeck_plugin.PluginActions
11 | {
12 | [PluginActionId("sfx-100-streamdeck-plugin.incrementoverallintensity")]
13 | public class IncrementOverallIntensity : PluginBase
14 | {
15 | private class PluginSettings
16 | {
17 | public static PluginSettings CreateDefaultSettings()
18 | {
19 | PluginSettings instance = new PluginSettings();
20 | instance.Steps = "1";
21 | instance.showValueAfterChange = false;
22 | return instance;
23 | }
24 |
25 | [JsonProperty(PropertyName = "Steps")]
26 | public string Steps { get; set; }
27 |
28 | [JsonProperty(PropertyName = "showValueAfterChange")]
29 | public bool showValueAfterChange { get; set; }
30 | }
31 |
32 | #region Private Members
33 |
34 | private PluginSettings settings;
35 | private bool _valueShown;
36 | private int _valueShownTimeout = 1;
37 | private DateTime _valueShownDateTime = DateTime.Now;
38 |
39 | #endregion
40 | public IncrementOverallIntensity(SDConnection connection, InitialPayload payload) : base(connection, payload)
41 | {
42 | if (payload.Settings == null || payload.Settings.Count == 0)
43 | {
44 | settings = PluginSettings.CreateDefaultSettings();
45 | SaveSettings();
46 | }
47 | else
48 | {
49 | settings = payload.Settings.ToObject();
50 | }
51 | }
52 |
53 | public override void Dispose() { }
54 |
55 | public override void KeyPressed(KeyPayload payload) { }
56 |
57 | public override void KeyReleased(KeyPayload payload)
58 | {
59 | var returnVal = -1;
60 | try
61 | {
62 | PipeServerConnection.Instance.RestartChannel();
63 | returnVal = PipeServerConnection.Instance.Channel.IncrementOverallIntensity(Convert.ToInt32(settings.Steps));
64 | }
65 | catch (EndpointNotFoundException endpointNotFoundException)
66 | {
67 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: Endpoint not found - Is SimFeedback available and is the Plugin enabled? " + endpointNotFoundException.Message);
68 | }
69 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
70 | {
71 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: communicationObjectFaultedException: " + communicationObjectFaultedException.Message);
72 | }
73 | catch (Exception ex)
74 | {
75 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error during Key processing: " + ex.Message);
76 | }
77 |
78 | if (settings.showValueAfterChange)
79 | {
80 | DrawValueData(returnVal);
81 | }
82 | }
83 |
84 | public override void OnTick()
85 | {
86 | if (_valueShown && DateTime.Now - _valueShownDateTime > TimeSpan.FromSeconds(_valueShownTimeout))
87 | {
88 | RestoreImage();
89 | }
90 | }
91 |
92 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
93 | {
94 | Tools.AutoPopulateSettings(settings, payload.Settings);
95 | SaveSettings();
96 | }
97 |
98 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
99 |
100 | #region Private Methods
101 | private async Task DrawValueData(int value)
102 | {
103 |
104 | try
105 | {
106 | var ForegroundColor = "#ffffff";
107 | var BackgroundColor = "#000000";
108 |
109 | Bitmap bmp = Tools.GenerateGenericKeyImage(out Graphics graphics);
110 | int height = bmp.Height;
111 | int width = bmp.Width;
112 |
113 | SizeF stringSize;
114 | float stringPos;
115 | var fontDefault = new Font("Verdana", 30, FontStyle.Bold);
116 |
117 | // Background
118 | var bgBrush = new SolidBrush(ColorTranslator.FromHtml(BackgroundColor));
119 | var fgBrush = new SolidBrush(ColorTranslator.FromHtml(ForegroundColor));
120 | graphics.FillRectangle(bgBrush, 0, 0, width, height);
121 |
122 | // Top title
123 | string title = "";
124 | stringSize = graphics.MeasureString(title, fontDefault);
125 | stringPos = Math.Abs((width - stringSize.Width)) / 2;
126 | graphics.DrawString(title, fontDefault, fgBrush, new PointF(stringPos, 5));
127 |
128 | string currStr = value.ToString();
129 | int buffer = 0;
130 |
131 | stringSize = graphics.MeasureString(currStr, fontDefault);
132 | stringPos = Math.Abs((width - stringSize.Width)) / 2;
133 | graphics.DrawString(currStr, fontDefault, fgBrush, new PointF(stringPos, 50));
134 | Connection.SetImageAsync(bmp);
135 | graphics.Dispose();
136 | _valueShown = true;
137 | _valueShownDateTime = DateTime.Now;
138 | }
139 | catch (Exception ex)
140 | {
141 | Logger.Instance.LogMessage(TracingLevel.ERROR, $"Error drawing image data {ex}");
142 | }
143 | }
144 | private async Task RestoreImage()
145 | {
146 | await Connection.SetDefaultImageAsync();
147 | }
148 | private Task SaveSettings()
149 | {
150 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
151 | }
152 |
153 | #endregion
154 | }
155 | }
156 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/OverallIntensity/DecrementOverallIntensity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.ServiceModel;
4 | using System.Threading.Tasks;
5 | using BarRaider.SdTools;
6 | using Newtonsoft.Json;
7 | using Newtonsoft.Json.Linq;
8 |
9 |
10 | namespace sfx_100_streamdeck_plugin.PluginActions
11 | {
12 | [PluginActionId("sfx-100-streamdeck-plugin.decrementoverallintensity")]
13 | public class DecrementOverallIntensity : PluginBase
14 | {
15 | private class PluginSettings
16 | {
17 | public static PluginSettings CreateDefaultSettings()
18 | {
19 | PluginSettings instance = new PluginSettings();
20 | instance.Steps = "1";
21 | instance.showValueAfterChange = false;
22 | return instance;
23 | }
24 |
25 | [JsonProperty(PropertyName = "Steps")]
26 | public string Steps { get; set; }
27 |
28 | [JsonProperty(PropertyName = "showValueAfterChange")]
29 | public bool showValueAfterChange { get; set; }
30 | }
31 |
32 | #region Private Members
33 |
34 | private PluginSettings settings;
35 | private bool _valueShown;
36 | private int _valueShownTimeout = 1;
37 | private DateTime _valueShownDateTime = DateTime.Now;
38 |
39 | #endregion
40 | public DecrementOverallIntensity(SDConnection connection, InitialPayload payload) : base(connection, payload)
41 | {
42 | if (payload.Settings == null || payload.Settings.Count == 0)
43 | {
44 | settings = PluginSettings.CreateDefaultSettings();
45 | SaveSettings();
46 | }
47 | else
48 | {
49 | settings = payload.Settings.ToObject();
50 | }
51 | }
52 |
53 | public override void Dispose() { }
54 |
55 | public override void KeyPressed(KeyPayload payload)
56 | { }
57 |
58 | public override void KeyReleased(KeyPayload payload)
59 | {
60 | var returnVal = -1;
61 | try
62 | {
63 | PipeServerConnection.Instance.RestartChannel();
64 | returnVal = PipeServerConnection.Instance.Channel.DecrementOverallIntensity(Convert.ToInt32(settings.Steps));
65 | }
66 | catch (EndpointNotFoundException endpointNotFoundException)
67 | {
68 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: Endpoint not found - Is SimFeedback available and is the Plugin enabled? " + endpointNotFoundException.Message);
69 | }
70 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
71 | {
72 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: communicationObjectFaultedException: " + communicationObjectFaultedException.Message);
73 | }
74 | catch (Exception ex)
75 | {
76 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error during Key processing: " + ex.Message);
77 | }
78 |
79 | if (settings.showValueAfterChange)
80 | {
81 | DrawValueData(returnVal);
82 | }
83 | }
84 |
85 | public override void OnTick()
86 | {
87 | if (_valueShown && DateTime.Now - _valueShownDateTime > TimeSpan.FromSeconds(_valueShownTimeout))
88 | {
89 | RestoreImage();
90 | }
91 | }
92 |
93 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
94 | {
95 | Tools.AutoPopulateSettings(settings, payload.Settings);
96 | SaveSettings();
97 | }
98 |
99 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
100 |
101 | #region Private Methods
102 | private async Task DrawValueData(int value)
103 | {
104 |
105 | try
106 | {
107 | var ForegroundColor = "#ffffff";
108 | var BackgroundColor = "#000000";
109 |
110 | Bitmap bmp = Tools.GenerateGenericKeyImage(out Graphics graphics);
111 | int height = bmp.Height;
112 | int width = bmp.Width;
113 |
114 | SizeF stringSize;
115 | float stringPos;
116 | var fontDefault = new Font("Verdana", 30, FontStyle.Bold);
117 |
118 | // Background
119 | var bgBrush = new SolidBrush(ColorTranslator.FromHtml(BackgroundColor));
120 | var fgBrush = new SolidBrush(ColorTranslator.FromHtml(ForegroundColor));
121 | graphics.FillRectangle(bgBrush, 0, 0, width, height);
122 |
123 | // Top title
124 | string title = "";
125 | stringSize = graphics.MeasureString(title, fontDefault);
126 | stringPos = Math.Abs((width - stringSize.Width)) / 2;
127 | graphics.DrawString(title, fontDefault, fgBrush, new PointF(stringPos, 5));
128 |
129 | string currStr = value.ToString();
130 | int buffer = 0;
131 |
132 | stringSize = graphics.MeasureString(currStr, fontDefault);
133 | stringPos = Math.Abs((width - stringSize.Width)) / 2;
134 | graphics.DrawString(currStr, fontDefault, fgBrush, new PointF(stringPos, 50));
135 | Connection.SetImageAsync(bmp);
136 | graphics.Dispose();
137 | _valueShown = true;
138 | _valueShownDateTime = DateTime.Now;
139 | }
140 | catch (Exception ex)
141 | {
142 | Logger.Instance.LogMessage(TracingLevel.ERROR, $"Error drawing image data {ex}");
143 | }
144 | }
145 | private async Task RestoreImage()
146 | {
147 | await Connection.SetDefaultImageAsync();
148 | }
149 | private Task SaveSettings()
150 | {
151 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
152 | }
153 |
154 | #endregion
155 | }
156 | }
157 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-console/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 | using sfx_100_streamdeck_plugin;
5 |
6 | namespace sfx_100_streamdeck_console
7 | {
8 | class Program
9 | {
10 | static void Main(string[] args)
11 | {
12 | var contractMethods = typeof(sfx_100_streamdeck_pipecontract.ISfxStreamDeckPipeContract).GetMethods();
13 | PipeServerConnection.Instance.RestartChannel();
14 | object result = Int32.MinValue;
15 | List paramElems = new List();
16 |
17 | if (args.Length == 0 || (args.Length == 1 && args[0] == "?"))
18 | {
19 | Console.WriteLine("Command and params missing - Usage:");
20 | Console.WriteLine("sfx-100-streamdeck-console.exe (CommandName) [arg1] [arg2] ...");
21 | Console.WriteLine("When using Effect names and Controller names (SFX, Heave, Pitch ...), these MUST EXACTLY match the ones defined in SimFeedback");
22 | Console.WriteLine("Responses are also provided as Exit Code (Converted to integer))");
23 | Console.WriteLine("");
24 | Console.WriteLine("List of possible Commands:");
25 | Console.WriteLine("");
26 |
27 | foreach (var contractMethod in contractMethods)
28 | {
29 | Console.WriteLine(contractMethod);
30 | }
31 | Console.WriteLine("");
32 | Console.WriteLine("Examples:");
33 | Console.WriteLine("sfx-100-streamdeck-console.exe EnableAllEffects ");
34 | Console.WriteLine("sfx-100-streamdeck-console.exe SetOverallIntensity 50");
35 | Console.WriteLine("sfx-100-streamdeck-console.exe EffectIntensitySet Heave 20");
36 | Console.WriteLine("sfx-100-streamdeck-console.exe EffectIntensityIncrement Heave 1 (The 1 is steps to increment by)");
37 | Console.WriteLine("sfx-100-streamdeck-console.exe ControllerIntensityIncrement SFX 1 (The 1 is steps to increment by)");
38 | Console.WriteLine("");
39 | }
40 | else
41 | {
42 | // Prüfen ob das Kommando enthalten ist
43 |
44 | foreach (var contractMethod in contractMethods)
45 | {
46 | if (args[0] != contractMethod.Name) continue;
47 | MethodInfo mi = PipeServerConnection.Instance.Channel.GetType().GetMethod(contractMethod.Name);
48 |
49 | if (mi != null)
50 | {
51 | Console.WriteLine("Method found: " + mi.Name);
52 |
53 | var miParams = mi.GetParameters();
54 |
55 | foreach (var paramx in miParams)
56 | {
57 | Console.WriteLine("Param found: " + paramx.Name);
58 | }
59 |
60 | Console.WriteLine("Command line arguments: " + (args.Length - 1));
61 | Console.WriteLine("Method arguments: " + miParams.Length);
62 |
63 | if (miParams.Length > 0 || (args.Length -1) == miParams.Length)
64 | {
65 | // Prüfen ob die Anzahl der Parameter mit der Anzahl der Argumente übereinstimmt
66 | if (args.Length - 1 == miParams.Length)
67 | {
68 | Console.WriteLine("Args count correct");
69 |
70 | // Argumente aufbauen
71 |
72 | for (int i = 1; i < args.Length; i++)
73 | {
74 | Type paramType = miParams[i - 1].ParameterType;
75 | Console.WriteLine("Using arg: " + args[i] + " - converting to type: " +
76 | miParams[i - 1].ParameterType);
77 | paramElems.Add(Convert.ChangeType(args[i], paramType));
78 | }
79 | }
80 | }
81 | else
82 | {
83 | Console.WriteLine("Wrong Parameter count. Check Examples by calling \"sfx-100-streamdeck-console.exe ?\"");
84 | Environment.Exit(Convert.ToInt32(result));
85 | }
86 |
87 | try
88 | {
89 | result = mi.Invoke(PipeServerConnection.Instance.Channel, paramElems.ToArray());
90 | if (result != null && result.GetType() == typeof(List))
91 | {
92 | Console.WriteLine("Got List - Exitcode will be list length.");
93 | var newList = result as List;
94 | if (newList != null)
95 | {
96 | foreach (var listElem in newList)
97 | {
98 | Console.WriteLine(listElem);
99 | }
100 | Environment.Exit(newList.Count);
101 | }
102 | else
103 | {
104 | Environment.Exit(Int32.MinValue);
105 | }
106 | }
107 | Console.WriteLine("Result: " + result);
108 | }
109 | catch (Exception e)
110 | {
111 | Console.WriteLine("Error: PipeServer not found, is SimFeedback running and Streamdeck Extension active? ");
112 | Console.WriteLine(e.Message);
113 | }
114 | Environment.Exit(Convert.ToInt32(result));
115 | }
116 | else
117 | {
118 | Console.WriteLine("Error getting Method.");
119 | }
120 |
121 | Console.WriteLine(result);
122 | Environment.Exit(Convert.ToInt32(result));
123 | }
124 | Console.WriteLine("Method not found. Check Spelling, available Methods and Examples by calling \"sfx-100-streamdeck-console.exe ?\"");
125 | }
126 | }
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/General/StartSimFeedback.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Threading.Tasks;
5 | using BarRaider.SdTools;
6 | using Newtonsoft.Json;
7 | using Newtonsoft.Json.Linq;
8 | using System.ServiceModel;
9 | using System.Threading;
10 |
11 |
12 | namespace sfx_100_streamdeck_plugin.PluginActions
13 | {
14 | [PluginActionId("sfx-100-streamdeck-plugin.startsimfeedback")]
15 | public class StartSimFeedback : PluginBase
16 | {
17 | private class PluginSettings
18 | {
19 | public static PluginSettings CreateDefaultSettings()
20 | {
21 | PluginSettings instance = new PluginSettings();
22 | instance.ProfileToLoad = string.Empty;
23 | instance.SfbExe = string.Empty;
24 | instance.SfbWindowStyle = "Normal";
25 | instance.StartMotionAfterProfileLoaded = false;
26 | return instance;
27 | }
28 |
29 | [FilenameProperty]
30 | [JsonProperty(PropertyName = "profileToLoad")]
31 | public string ProfileToLoad { get; set; }
32 |
33 | [FilenameProperty]
34 | [JsonProperty(PropertyName = "sfbExe")]
35 | public string SfbExe { get; set; }
36 |
37 | [JsonProperty(PropertyName = "startMotionAfterProfileLoaded")]
38 | public bool StartMotionAfterProfileLoaded { get; set; }
39 |
40 | [JsonProperty(PropertyName = "sfbWindowStyle")]
41 | public string SfbWindowStyle { get; set; }
42 |
43 | }
44 |
45 | #region Private Members
46 |
47 | private PluginSettings settings;
48 | private bool actionInProgress = false;
49 |
50 | #endregion
51 | public StartSimFeedback(SDConnection connection, InitialPayload payload) : base(connection, payload)
52 | {
53 | if (payload.Settings == null || payload.Settings.Count == 0)
54 | {
55 | settings = PluginSettings.CreateDefaultSettings();
56 | Connection.SetSettingsAsync(JObject.FromObject(settings));
57 | SaveSettings();
58 | }
59 | else
60 | {
61 | settings = payload.Settings.ToObject();
62 | }
63 | }
64 |
65 | public override void Dispose() { }
66 |
67 | public override void KeyPressed(KeyPayload payload) { }
68 |
69 | public override void KeyReleased(KeyPayload payload)
70 | {
71 | if (actionInProgress)
72 | {
73 | Logger.Instance.LogMessage(TracingLevel.INFO, "Error: action already in Progress");
74 | return;
75 | }
76 | actionInProgress = true;
77 |
78 | Logger.Instance.LogMessage(TracingLevel.INFO, "Begin StartProfile action");
79 |
80 | // Stop if Motion is Running
81 |
82 | Logger.Instance.LogMessage(TracingLevel.INFO, "Motion currently running - will stopped during exit");
83 | //PipeServerConnection.Instance.Channel.StopMotion();
84 | // TODO: Warten bis Motion beendet ist
85 |
86 |
87 | bool processFound = false;
88 |
89 | // Shutdown SimFeedback
90 | foreach (var process in Process.GetProcessesByName("SimFeedbackStart"))
91 | {
92 | processFound = true;
93 | }
94 |
95 | if (!processFound)
96 | {
97 | StartSFB();
98 | actionInProgress = false;
99 | }
100 | else
101 | {
102 | actionInProgress = false;
103 | }
104 | }
105 |
106 | private void WaitStartMotion()
107 | {
108 | Logger.Instance.LogMessage(TracingLevel.INFO, "WaitStartMotion");
109 | bool connectionAvailable = false;
110 | DateTime start = DateTime.Now;
111 | while (!connectionAvailable && DateTime.Now - start <= TimeSpan.FromSeconds(15))
112 | {
113 | try
114 | {
115 | // Wait for Pipe - no logging here
116 | try
117 | {
118 | PipeServerConnection.Instance.RestartChannel();
119 | connectionAvailable = PipeServerConnection.Instance.Channel.CheckConnection();
120 | if (connectionAvailable)
121 | {
122 | PipeServerConnection.Instance.Channel.StartMotion();
123 | break;
124 | }
125 | }
126 | catch (EndpointNotFoundException endpointNotFoundException)
127 | { }
128 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
129 | { }
130 | catch (Exception ex)
131 | { }
132 | }
133 | catch
134 | {
135 | Logger.Instance.LogMessage(TracingLevel.ERROR, "In loop, trying to Start motion");
136 | }
137 | Thread.Sleep(500);
138 | }
139 | }
140 |
141 | private void StartSFB()
142 | {
143 | // Start SFB
144 | ProcessStartInfo psi = new ProcessStartInfo(settings.SfbExe);
145 | psi.UseShellExecute = true;
146 | if (!String.IsNullOrEmpty(settings.SfbWindowStyle))
147 | {
148 | var windowStyle = (ProcessWindowStyle)Enum.Parse(typeof(ProcessWindowStyle), settings.SfbWindowStyle);
149 | psi.WindowStyle = windowStyle;
150 | }
151 | psi.WorkingDirectory = Path.GetDirectoryName(settings.SfbExe);
152 | var newProc = Process.Start(psi);
153 | newProc.WaitForInputIdle();
154 | actionInProgress = false;
155 | if (settings.StartMotionAfterProfileLoaded)
156 | WaitStartMotion();
157 | }
158 |
159 |
160 | public override void OnTick() { }
161 |
162 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
163 | {
164 | Tools.AutoPopulateSettings(settings, payload.Settings);
165 | SaveSettings();
166 | }
167 |
168 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
169 |
170 | #region Private Methods
171 |
172 |
173 | private Task SaveSettings()
174 | {
175 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
176 | }
177 |
178 | #endregion
179 | }
180 | }
181 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-pipecontract/ISfxStreamDeckPipeContract.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.ServiceModel;
3 |
4 | namespace sfx_100_streamdeck_pipecontract
5 | {
6 | [ServiceContract]
7 | public interface ISfxStreamDeckPipeContract
8 | {
9 | [OperationContract]
10 | bool CheckConnection();
11 |
12 | [OperationContract]
13 | List GetControllerNames();
14 |
15 | [OperationContract]
16 | List GetEffectNames();
17 |
18 | [OperationContract]
19 | bool IsRunning();
20 |
21 | [OperationContract]
22 | bool IsTelemetryProviderConnected();
23 |
24 | [OperationContract]
25 | bool StartMotion();
26 |
27 | [OperationContract]
28 | bool StopMotion();
29 |
30 | [OperationContract]
31 | bool EnableAllEffects();
32 |
33 | [OperationContract]
34 | bool DisableAllEffects();
35 |
36 | [OperationContract]
37 | int IncrementOverallIntensity(int steps);
38 |
39 | [OperationContract]
40 | int DecrementOverallIntensity(int steps);
41 |
42 | [OperationContract]
43 | int SetOverallIntensity(int value);
44 |
45 | [OperationContract]
46 | int GetOverallIntensity();
47 |
48 | [OperationContract]
49 | int ResetOverallIntensity();
50 |
51 | #region Controller Intensity
52 |
53 | [OperationContract]
54 | int ControllerIntensityIncrement(string controllerName, int steps);
55 |
56 | [OperationContract]
57 | int ControllerIntensityDecrement(string controllerName, int steps);
58 |
59 | [OperationContract]
60 | int ControllerIntensitySet(string controllerName, int value);
61 |
62 | [OperationContract]
63 | int ControllerIntensityGet(string controllerName);
64 |
65 | [OperationContract]
66 | int ControllerIntensityReset(string controllerName);
67 | #endregion
68 |
69 | #region Controller Smoothness
70 |
71 | [OperationContract]
72 | int ControllerSmoothnessIncrement(string controllerName, int steps);
73 |
74 | [OperationContract]
75 | int ControllerSmoothnessDecrement(string controllerName, int steps);
76 |
77 | [OperationContract]
78 | int ControllerSmoothnessSet(string controllerName, int value);
79 |
80 | [OperationContract]
81 | int ControllerSmoothnessGet(string controllerName);
82 |
83 | [OperationContract]
84 | bool ControllerSmoothnessIsEnabled(string controllerName);
85 |
86 | [OperationContract]
87 | bool ControllerSmoothnessEnable(string controllerName);
88 |
89 | [OperationContract]
90 | bool ControllerSmoothnessDisable(string controllerName);
91 |
92 | [OperationContract]
93 | bool ControllerSmoothnessToggle(string controllerName);
94 |
95 | #endregion
96 |
97 | #region Controller Acceleration
98 |
99 | [OperationContract]
100 | int ControllerAccelerationIncrement(string controllerName, int steps);
101 |
102 | [OperationContract]
103 | int ControllerAccelerationDecrement(string controllerName, int steps);
104 |
105 | [OperationContract]
106 | int ControllerAccelerationSet(string controllerName, int value);
107 |
108 | [OperationContract]
109 | int ControllerAccelerationGet(string controllerName);
110 |
111 | #endregion
112 |
113 | #region Controller Min Speed
114 |
115 | [OperationContract]
116 | int ControllerMinSpeedIncrement(string controllerName, int steps);
117 |
118 | [OperationContract]
119 | int ControllerMinSpeedDecrement(string controllerName, int steps);
120 |
121 | [OperationContract]
122 | int ControllerMinSpeedSet(string controllerName, int value);
123 |
124 | [OperationContract]
125 | int ControllerMinSpeedGet(string controllerName);
126 |
127 | #endregion
128 |
129 | #region Controller Max Speed
130 |
131 | [OperationContract]
132 | int ControllerMaxSpeedIncrement(string controllerName, int steps);
133 |
134 | [OperationContract]
135 | int ControllerMaxSpeedDecrement(string controllerName, int steps);
136 |
137 | [OperationContract]
138 | int ControllerMaxSpeedSet(string controllerName, int value);
139 |
140 | [OperationContract]
141 | int ControllerMaxSpeedGet(string controllerName);
142 |
143 | #endregion
144 |
145 | #region Effect Smoothing
146 |
147 | [OperationContract]
148 | int EffectSmoothingIncrement(string effectName, int steps);
149 |
150 | [OperationContract]
151 | int EffectSmoothingDecrement(string effectName, int steps);
152 |
153 | [OperationContract]
154 | int EffectSmoothingSet(string effectName, int value);
155 |
156 | [OperationContract]
157 | int EffectSmoothingGet(string effectName);
158 |
159 | #endregion
160 |
161 | #region Effect Intensity
162 |
163 | [OperationContract]
164 | int EffectIntensityIncrement(string effectName, int steps);
165 |
166 | [OperationContract]
167 | int EffectIntensityDecrement(string effectName, int steps);
168 |
169 | [OperationContract]
170 | int EffectIntensitySet(string effectName, int value);
171 |
172 | [OperationContract]
173 | int EffectIntensityGet(string effectName);
174 |
175 | #endregion
176 |
177 | #region Effect Linear
178 | [OperationContract]
179 | bool EffectLinearIsEnabled(string effectName);
180 |
181 | [OperationContract]
182 | bool EffectLinearEnable(string effectName);
183 |
184 | [OperationContract]
185 | bool EffectLinearDisable(string effectName);
186 |
187 | [OperationContract]
188 | bool EffectLinearToggle(string effectName);
189 | #endregion
190 |
191 | #region Effect Enabled
192 | [OperationContract]
193 | bool EffectIsEnabled(string effectName);
194 |
195 | [OperationContract]
196 | bool EffectEnable(string effectName);
197 |
198 | [OperationContract]
199 | bool EffectDisable(string effectName);
200 |
201 | [OperationContract]
202 | bool EffectToggle(string effectName);
203 | #endregion
204 |
205 | #region Effect Muted
206 | [OperationContract]
207 | bool EffectIsMuted(string effectName);
208 |
209 | [OperationContract]
210 | bool EffectMuteEnable(string effectName);
211 |
212 | [OperationContract]
213 | bool EffectMuteDisable(string effectName);
214 |
215 | [OperationContract]
216 | bool EffectMuteToggle(string effectName);
217 |
218 | #endregion
219 | }
220 | }
221 |
--------------------------------------------------------------------------------
/sfx-100-streamdeck-plugin/PluginActions/Effects/SetEffectValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Threading.Tasks;
4 | using BarRaider.SdTools;
5 | using Newtonsoft.Json;
6 | using Newtonsoft.Json.Linq;
7 | using System.ServiceModel;
8 |
9 |
10 | namespace sfx_100_streamdeck_plugin.PluginActions
11 | {
12 | [PluginActionId("sfx-100-streamdeck-plugin.seteffectvalue")]
13 | public class SetEffectValue : PluginBase
14 | {
15 | private class PluginSettings
16 | {
17 | public static PluginSettings CreateDefaultSettings()
18 | {
19 | PluginSettings instance = new PluginSettings();
20 | instance.EffectName = "Heave";
21 | instance.ValueToChange = "Intensity";
22 | instance.Value = 1;
23 | instance.showValueAfterChange = false;
24 | return instance;
25 | }
26 |
27 | [JsonProperty(PropertyName = "EffectName")]
28 | public string EffectName { get; set; }
29 |
30 | [JsonProperty(PropertyName = "Value")]
31 | public int Value { get; set; }
32 |
33 | [JsonProperty(PropertyName = "ValueToChange")]
34 | public string ValueToChange { get; set; }
35 |
36 | [JsonProperty(PropertyName = "showValueAfterChange")]
37 | public bool showValueAfterChange { get; set; }
38 | }
39 |
40 | #region Private Members
41 |
42 | private PluginSettings settings;
43 | private bool _valueShown;
44 | private int _valueShownTimeout = 1;
45 | private DateTime _valueShownDateTime = DateTime.Now;
46 |
47 | #endregion
48 | public SetEffectValue(SDConnection connection, InitialPayload payload) : base(connection, payload)
49 | {
50 | if (payload.Settings == null || payload.Settings.Count == 0)
51 | {
52 | settings = PluginSettings.CreateDefaultSettings();
53 | SaveSettings();
54 | }
55 | else
56 | {
57 | settings = payload.Settings.ToObject();
58 | }
59 | }
60 |
61 | public override void Dispose() { }
62 |
63 | public override void KeyPressed(KeyPayload payload) { }
64 |
65 | public override void KeyReleased(KeyPayload payload)
66 | {
67 | try
68 | {
69 | var returnVal = -1;
70 | PipeServerConnection.Instance.RestartChannel();
71 | switch (settings.ValueToChange)
72 | {
73 | case "Intensity":
74 | returnVal = PipeServerConnection.Instance.Channel.EffectIntensitySet(settings.EffectName, settings.Value);
75 | break;
76 | case "Smoothness":
77 | returnVal = PipeServerConnection.Instance.Channel.EffectSmoothingSet(settings.EffectName, settings.Value);
78 | break;
79 | default:
80 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: ValueToChange not set correctly: " + settings.ValueToChange);
81 | break;
82 | }
83 |
84 | if (settings.showValueAfterChange)
85 | {
86 | DrawValueData(returnVal);
87 | }
88 | }
89 | catch (EndpointNotFoundException endpointNotFoundException)
90 | {
91 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: Endpoint not found - Is SimFeedback available and is the Plugin enabled? " + endpointNotFoundException.Message);
92 | }
93 | catch (CommunicationObjectFaultedException communicationObjectFaultedException)
94 | {
95 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error: communicationObjectFaultedException: " + communicationObjectFaultedException.Message);
96 | }
97 | catch (Exception ex)
98 | {
99 | Logger.Instance.LogMessage(TracingLevel.ERROR, "Error during Key processing: " + ex.Message);
100 | }
101 | }
102 |
103 | public override void OnTick()
104 | {
105 | if (_valueShown && DateTime.Now - _valueShownDateTime > TimeSpan.FromSeconds(_valueShownTimeout))
106 | {
107 | RestoreImage();
108 | }
109 | }
110 |
111 | public override void ReceivedSettings(ReceivedSettingsPayload payload)
112 | {
113 | Tools.AutoPopulateSettings(settings, payload.Settings);
114 | SaveSettings();
115 | }
116 |
117 | public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) { }
118 |
119 | #region Private Methods
120 | private async Task DrawValueData(int value)
121 | {
122 |
123 | try
124 | {
125 | var ForegroundColor = "#ffffff";
126 | var BackgroundColor = "#000000";
127 |
128 | Bitmap bmp = Tools.GenerateGenericKeyImage(out Graphics graphics);
129 | int height = bmp.Height;
130 | int width = bmp.Width;
131 |
132 | SizeF stringSize;
133 | float stringPos;
134 | var fontDefault = new Font("Verdana", 30, FontStyle.Bold);
135 |
136 | // Background
137 | var bgBrush = new SolidBrush(ColorTranslator.FromHtml(BackgroundColor));
138 | var fgBrush = new SolidBrush(ColorTranslator.FromHtml(ForegroundColor));
139 | graphics.FillRectangle(bgBrush, 0, 0, width, height);
140 |
141 | // Top title
142 | string title = "";
143 | stringSize = graphics.MeasureString(title, fontDefault);
144 | stringPos = Math.Abs((width - stringSize.Width)) / 2;
145 | graphics.DrawString(title, fontDefault, fgBrush, new PointF(stringPos, 5));
146 |
147 | string currStr = value.ToString();
148 | int buffer = 0;
149 |
150 | stringSize = graphics.MeasureString(currStr, fontDefault);
151 | stringPos = Math.Abs((width - stringSize.Width)) / 2;
152 | graphics.DrawString(currStr, fontDefault, fgBrush, new PointF(stringPos, 50));
153 | Connection.SetImageAsync(bmp);
154 | graphics.Dispose();
155 | _valueShown = true;
156 | _valueShownDateTime = DateTime.Now;
157 | }
158 | catch (Exception ex)
159 | {
160 | Logger.Instance.LogMessage(TracingLevel.ERROR, $"Error drawing image data {ex}");
161 | }
162 | }
163 | private async Task RestoreImage()
164 | {
165 | await Connection.SetDefaultImageAsync();
166 | }
167 | private Task SaveSettings()
168 | {
169 | return Connection.SetSettingsAsync(JObject.FromObject(settings));
170 | }
171 |
172 | #endregion
173 | }
174 | }
175 |
--------------------------------------------------------------------------------