mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
commit
de22da363d
@ -17,8 +17,7 @@
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
|
||||
<!-- Accent and AppTheme setting -->
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Teal.xaml" />
|
||||
<ResourceDictionary
|
||||
Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
|
||||
<ResourceDictionary Source="/Resources/Icons.xaml" />
|
||||
<ResourceDictionary Source="Styles/ColorBox.xaml" />
|
||||
<ResourceDictionary Source="Styles/MarkdownStyles.xaml" />
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using Artemis.Utilities;
|
||||
using NLog;
|
||||
using WpfExceptionViewer;
|
||||
|
||||
@ -26,6 +27,9 @@ namespace Artemis
|
||||
|
||||
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
// Get rid of the keyboard hook in case of a crash, otherwise input freezes up system wide until Artemis is gone
|
||||
InputHook.Stop();
|
||||
|
||||
if (DoHandle)
|
||||
{
|
||||
GetArtemisExceptionViewer(e.Exception).ShowDialog();
|
||||
|
||||
@ -131,6 +131,10 @@
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AssettoCorsaSharedMemory, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>lib\AssettoCorsaSharedMemory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Betwixt, Version=1.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Betwixt.1.4.1\lib\net35\Betwixt.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -147,20 +151,20 @@
|
||||
<HintPath>..\packages\Caliburn.Micro.3.0.3\lib\net45\Caliburn.Micro.Platform.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
|
||||
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Castle.Core.4.0.0\lib\net45\Castle.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Corale.Colore, Version=5.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Colore.5.1.0\lib\net35\Corale.Colore.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="CSCore, Version=1.1.5992.18249, Culture=neutral, PublicKeyToken=5a08f2b6f4415dea, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CSCore.1.1.0\lib\net35-client\CSCore.dll</HintPath>
|
||||
<Reference Include="CSCore, Version=1.1.6245.30570, Culture=neutral, PublicKeyToken=5a08f2b6f4415dea, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CSCore.1.2.0\lib\net35-client\CSCore.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="CUE.NET, Version=1.1.2.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CUE.NET.1.1.2.1\lib\net45\CUE.NET.dll</HintPath>
|
||||
<Reference Include="CUE.NET, Version=1.1.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CUE.NET.1.1.3.0\lib\net45\CUE.NET.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="DeltaCompressionDotNet, Version=1.1.0.0, Culture=neutral, PublicKeyToken=1d14d6e5194e7f4a, processorArchitecture=MSIL">
|
||||
@ -179,6 +183,10 @@
|
||||
<HintPath>..\packages\DynamicExpresso.Core.1.3.3.5\lib\net40\DynamicExpresso.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Gma.System.MouseKeyHook, Version=5.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MouseKeyHook.5.4.0\lib\net40\Gma.System.MouseKeyHook.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="GongSolutions.Wpf.DragDrop, Version=0.1.4.3, Culture=neutral, PublicKeyToken=d19974ea350ccea1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\gong-wpf-dragdrop.0.1.4.3\lib\net40\GongSolutions.Wpf.DragDrop.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -191,12 +199,12 @@
|
||||
<HintPath>..\packages\squirrel.windows.1.4.4\lib\Net45\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=2.0.7.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.7\lib\net45-full\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MahApps.Metro, Version=1.4.1.0, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MahApps.Metro.1.4.1\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
<Reference Include="MahApps.Metro, Version=1.4.3.0, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MahApps.Metro.1.4.3\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||
@ -240,17 +248,13 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.4.1\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.4.4\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NuGet.Squirrel, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\squirrel.windows.1.4.4\lib\Net45\NuGet.Squirrel.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Open.WinKeyboardHook, Version=1.0.11.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Open.WinKeyboardHook.1.0.11\lib\net45\Open.WinKeyboardHook.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Process.NET, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Process.NET.1.0.8\lib\Process.NET.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -268,7 +272,7 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SpotifyAPI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SpotifyAPI-NET.2.12.0\lib\SpotifyAPI.dll</HintPath>
|
||||
<HintPath>..\packages\SpotifyAPI-NET.2.13.1\lib\SpotifyAPI.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Squirrel, Version=1.4.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
@ -286,7 +290,7 @@
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MahApps.Metro.1.4.1\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||
<HintPath>..\packages\MahApps.Metro.1.4.3\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
@ -325,6 +329,8 @@
|
||||
<Compile Include="DeviceProviders\Artemis\NoneKeyboard.cs" />
|
||||
<Compile Include="DeviceProviders\CoolerMaster\MasterkeysProL.cs" />
|
||||
<Compile Include="DeviceProviders\CoolerMaster\MasterkeysProS.cs" />
|
||||
<Compile Include="DeviceProviders\CoolerMaster\MastermouseProL.cs" />
|
||||
<Compile Include="DeviceProviders\CoolerMaster\MastermouseProS.cs" />
|
||||
<Compile Include="DeviceProviders\CoolerMaster\Utilities\CmSdk.cs" />
|
||||
<Compile Include="DeviceProviders\Corsair\CorsairMouse.cs" />
|
||||
<Compile Include="DeviceProviders\Corsair\CorsairHeadset.cs" />
|
||||
@ -354,6 +360,7 @@
|
||||
<Compile Include="DeviceProviders\Logitech\Utilities\OrionUtilities.cs" />
|
||||
<Compile Include="DeviceProviders\Razer\BlackWidow.cs" />
|
||||
<Compile Include="DeviceProviders\Razer\Utilities\RazerUtilities.cs" />
|
||||
<Compile Include="Managers\KeybindManager.cs" />
|
||||
<Compile Include="Models\DeviceVisualModel.cs" />
|
||||
<Compile Include="Models\FrameModel.cs" />
|
||||
<Compile Include="Managers\MigrationManager.cs" />
|
||||
@ -363,12 +370,20 @@
|
||||
<Compile Include="Managers\LuaManager.cs" />
|
||||
<Compile Include="Managers\MainManager.cs" />
|
||||
<Compile Include="Managers\PreviewManager.cs" />
|
||||
<Compile Include="Models\KeybindModel.cs" />
|
||||
<Compile Include="Models\LayerEditorModel.cs" />
|
||||
<Compile Include="Models\ProfileEditorModel.cs" />
|
||||
<Compile Include="Modules\Abstract\ModuleDataModel.cs" />
|
||||
<Compile Include="Modules\Abstract\ModuleModel.cs" />
|
||||
<Compile Include="Modules\Abstract\ModuleSettings.cs" />
|
||||
<Compile Include="Modules\Abstract\ModuleViewModel.cs" />
|
||||
<Compile Include="Modules\Games\AssettoCorsa\AssettoCorsaDataModel.cs" />
|
||||
<Compile Include="Modules\Games\AssettoCorsa\AssettoCorsaModel.cs" />
|
||||
<Compile Include="Modules\Games\AssettoCorsa\AssettoCorsaSettings.cs" />
|
||||
<Compile Include="Modules\Games\AssettoCorsa\AssettoCorsaView.xaml.cs">
|
||||
<DependentUpon>AssettoCorsaView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Games\AssettoCorsa\AssettoCorsaViewModel.cs" />
|
||||
<Compile Include="Modules\General\GeneralProfile\PerformanceInfo.cs" />
|
||||
<Compile Include="Modules\Games\EurotruckSimulator2\Data\Ets2TelemetryData.cs" />
|
||||
<Compile Include="Modules\Games\EurotruckSimulator2\Data\Ets2TelemetryDataReader.cs" />
|
||||
@ -472,9 +487,13 @@
|
||||
<DependentUpon>OverlayProfileView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Overlays\OverlayProfile\OverlayProfileViewModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Animations\RotateCounterclockwiseAnimation.cs" />
|
||||
<Compile Include="Profiles\Layers\Animations\RotateClockwiseAnimation.cs" />
|
||||
<Compile Include="Profiles\Layers\Animations\ShrinkAnimation.cs" />
|
||||
<Compile Include="Profiles\Layers\Animations\NoneAnimation.cs" />
|
||||
<Compile Include="Profiles\Layers\Models\EventPropertiesModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Models\KeyboardEventPropertiesModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Models\LayerKeybindModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Models\TweenModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\AmbientLight\AmbienceCreator\AmbienceCreatorExtend.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\AmbientLight\AmbienceCreator\AmbienceCreatorMirror.cs" />
|
||||
@ -486,7 +505,7 @@
|
||||
</Compile>
|
||||
<Compile Include="Profiles\Layers\Types\AmbientLight\AmbientLightPropertiesViewModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\AmbientLight\AmbientLightType.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\AmbientLight\Helper\CheckboxEnumFlagHelper.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\AmbientLight\Helper\ToggleSwitchButtonEnumFlagHelper.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\AmbientLight\Model\AmbienceCreatorType.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\AmbientLight\Model\BlackBarDetectionMode.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\AmbientLight\Model\Extensions\AvgColorExtension.cs" />
|
||||
@ -546,6 +565,7 @@
|
||||
<Compile Include="Profiles\Lua\Modules\LuaBrushesModule.cs" />
|
||||
<Compile Include="Profiles\Lua\LuaModule.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Brushes\LuaSolidColorBrush.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\LuaKeybindModule.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\LuaKeyboardModule.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\LuaLayerModule.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\LuaMouseModule.cs" />
|
||||
@ -608,7 +628,7 @@
|
||||
<Compile Include="Profiles\Layers\Conditions\DataModelCondition.cs" />
|
||||
<Compile Include="Profiles\Layers\Conditions\EventCondition.cs" />
|
||||
<Compile Include="Profiles\Layers\Interfaces\ILayerAnimation.cs" />
|
||||
<Compile Include="Profiles\Layers\Interfaces\ILayerCondition.cs" />
|
||||
<Compile Include="Profiles\Layers\Abstract\LayerCondition.cs" />
|
||||
<Compile Include="Profiles\Layers\Interfaces\ILayerType.cs" />
|
||||
<Compile Include="Profiles\Layers\Models\DynamicPropertiesModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Models\LayerConditionModel.cs" />
|
||||
@ -639,14 +659,13 @@
|
||||
<Compile Include="Utilities\Converters\NinjectCustomConverter.cs" />
|
||||
<Compile Include="Utilities\Converters\ValueConverters.cs" />
|
||||
<Compile Include="Utilities\DataReaders\DllManager.cs" />
|
||||
<Compile Include="Utilities\EditorHelper.cs" />
|
||||
<Compile Include="Utilities\ExtensionMethods.cs" />
|
||||
<Compile Include="Utilities\GameState\GameDataReceivedEventArgs.cs" />
|
||||
<Compile Include="Utilities\GameState\GameStateWebServer.cs" />
|
||||
<Compile Include="Utilities\GeneralHelpers.cs" />
|
||||
<Compile Include="Utilities\GifImage.cs" />
|
||||
<Compile Include="Utilities\ImageUtilities.cs" />
|
||||
<Compile Include="Utilities\Keyboard\KeyboardHook.cs" />
|
||||
<Compile Include="Utilities\InputHook.cs" />
|
||||
<Compile Include="Utilities\Logging.cs" />
|
||||
<Compile Include="Utilities\DataReaders\PipeServer.cs" />
|
||||
<Compile Include="Utilities\Markdown\Markdown.cs" />
|
||||
@ -669,6 +688,7 @@
|
||||
<Compile Include="Modules\Games\Dota2\Dota2ViewModel.cs" />
|
||||
<Compile Include="Modules\Games\RocketLeague\RocketLeagueViewModel.cs" />
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3ViewModel.cs" />
|
||||
<Compile Include="ViewModels\Profiles\LayerKeybindViewModel.cs" />
|
||||
<Compile Include="ViewModels\Profiles\LayerTweenViewModel.cs" />
|
||||
<Compile Include="ViewModels\Profiles\Events\EventPropertiesViewModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\Keyboard\KeyboardPropertiesViewModel.cs" />
|
||||
@ -719,6 +739,9 @@
|
||||
<Compile Include="Profiles\Layers\Types\Keyboard\KeyboardPropertiesView.xaml.cs">
|
||||
<DependentUpon>KeyboardPropertiesView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\Profiles\LayerKeybindView.xaml.cs">
|
||||
<DependentUpon>LayerKeybindView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\Profiles\LayerConditionView.xaml.cs">
|
||||
<DependentUpon>LayerConditionView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -757,6 +780,7 @@
|
||||
<None Include="NLog.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Resources\Keyboards\k95-platinum.png" />
|
||||
<None Include="Resources\Keyboards\masterkeys-pro-s.png" />
|
||||
<None Include="Resources\Keyboards\masterkeys-pro-l.png" />
|
||||
<Resource Include="Resources\Kottke Silkscreen License.txt" />
|
||||
@ -781,7 +805,7 @@
|
||||
<AppDesigner Include="Properties\" />
|
||||
<Resource Include="Resources\slkscr.ttf" />
|
||||
<Resource Include="Resources\bow.png" />
|
||||
<Content Include="lib\CUE.NET.dll" />
|
||||
<Content Include="lib\AssettoCorsaSharedMemory.dll" />
|
||||
<Content Include="lib\Ets2SdkClient.dll" />
|
||||
<Content Include="lib\SDKDLL.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
@ -828,6 +852,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Modules\Games\AssettoCorsa\AssettoCorsaView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Modules\General\Bubbles\BubblesView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@ -964,6 +992,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\Profiles\LayerKeybindView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\Profiles\LayerConditionView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@ -1035,12 +1067,12 @@
|
||||
<Folder Include="Resources\Lua\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\CUE.NET.1.1.2.1\build\net45\CUE.NET.targets" Condition="Exists('..\packages\CUE.NET.1.1.2.1\build\net45\CUE.NET.targets')" />
|
||||
<Import Project="..\packages\CUE.NET.1.1.3.0\build\net45\CUE.NET.targets" Condition="Exists('..\packages\CUE.NET.1.1.3.0\build\net45\CUE.NET.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\CUE.NET.1.1.2.1\build\net45\CUE.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CUE.NET.1.1.2.1\build\net45\CUE.NET.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\CUE.NET.1.1.3.0\build\net45\CUE.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CUE.NET.1.1.3.0\build\net45\CUE.NET.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@ -12,7 +12,6 @@ using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.Converters;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
using Artemis.ViewModels;
|
||||
using Caliburn.Micro;
|
||||
using Newtonsoft.Json;
|
||||
@ -35,7 +34,15 @@ namespace Artemis
|
||||
|
||||
Initialize();
|
||||
BindSpecialValues();
|
||||
KeyboardHook.SetupKeyboardHook();
|
||||
InputHook.Start();
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
|
||||
}
|
||||
|
||||
private void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs)
|
||||
{
|
||||
// Get rid of the keyboard hook in case of a crash, otherwise input freezes up system wide until Artemis is gone
|
||||
InputHook.Stop();
|
||||
}
|
||||
|
||||
private void BindSpecialValues()
|
||||
|
||||
@ -21,8 +21,7 @@ namespace Artemis.DAL
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public static readonly string ProfileFolder =
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis\profiles";
|
||||
public static readonly string ProfileFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis\profiles";
|
||||
|
||||
private static bool _installedDefaults;
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ namespace Artemis.DeviceProviders.Artemis
|
||||
CantEnableText = "Waaaaah, this should not be happening!";
|
||||
Height = 1;
|
||||
Width = 1;
|
||||
PreviewSettings = new PreviewSettings(984, 375, new Thickness(0, 0, 0, 0), Resources.none);
|
||||
PreviewSettings = new PreviewSettings(new Rect(), Resources.none);
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
|
||||
@ -1,92 +1,93 @@
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.DAL;
|
||||
using Artemis.DeviceProviders.CoolerMaster.Utilities;
|
||||
using Artemis.DeviceProviders.Logitech.Utilities;
|
||||
using Artemis.Properties;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
|
||||
namespace Artemis.DeviceProviders.CoolerMaster
|
||||
{
|
||||
public class MasterkeysProL : KeyboardProvider
|
||||
{
|
||||
private GeneralSettings _generalSettings;
|
||||
|
||||
public MasterkeysProL()
|
||||
{
|
||||
Name = "CM Masterkeys Pro L";
|
||||
Slug = "cm-masterkeys-pro-l";
|
||||
|
||||
CantEnableText = "Couldn't connect to your CM Masterkeys Pro L.\n" +
|
||||
"Please check your cables and try updating your CM software.\n\n" +
|
||||
"If needed, you can select a different keyboard in Artemis under settings.";
|
||||
|
||||
Height = 6;
|
||||
Width = 22;
|
||||
|
||||
PreviewSettings = new PreviewSettings(670, 189, new Thickness(-2, -5, 0, 0), Resources.masterkeys_pro_l);
|
||||
_generalSettings = SettingsProvider.Load<GeneralSettings>();
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.DAL;
|
||||
using Artemis.DeviceProviders.CoolerMaster.Utilities;
|
||||
using Artemis.DeviceProviders.Logitech.Utilities;
|
||||
using Artemis.Properties;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
|
||||
namespace Artemis.DeviceProviders.CoolerMaster
|
||||
{
|
||||
public class MasterkeysProL : KeyboardProvider
|
||||
{
|
||||
private GeneralSettings _generalSettings;
|
||||
|
||||
public MasterkeysProL()
|
||||
{
|
||||
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
|
||||
CmSdk.EnableLedControl(false);
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
public override bool CanEnable()
|
||||
{
|
||||
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
|
||||
|
||||
// Doesn't seem reliable but better than nothing I suppose
|
||||
return CmSdk.IsDevicePlug();
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
|
||||
CmSdk.EnableLedControl(true);
|
||||
}
|
||||
|
||||
public override void DrawBitmap(Bitmap bitmap)
|
||||
{
|
||||
// Resize the bitmap
|
||||
using (var b = ImageUtilities.ResizeImage(bitmap, Width, Height))
|
||||
{
|
||||
// Create an empty matrix
|
||||
var matrix = new COLOR_MATRIX {KeyColor = new KEY_COLOR[6, 22]};
|
||||
|
||||
// Map the bytes to the matix
|
||||
for (var x = 0; x < Width; x++)
|
||||
{
|
||||
for (var y = 0; y < Height; y++)
|
||||
{
|
||||
var c = b.GetPixel(x, y);
|
||||
matrix.KeyColor[y, x] = new KEY_COLOR(c.R, c.G, c.B);
|
||||
}
|
||||
}
|
||||
|
||||
// Send the matrix to the keyboard
|
||||
CmSdk.SetAllLedColor(matrix);
|
||||
}
|
||||
}
|
||||
|
||||
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
||||
{
|
||||
switch (_generalSettings.Layout)
|
||||
{
|
||||
case "Qwerty":
|
||||
return KeyMap.QwertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||
case "Qwertz":
|
||||
return KeyMap.QwertzLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||
default:
|
||||
return KeyMap.AzertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Name = "CM Masterkeys Pro L";
|
||||
Slug = "cm-masterkeys-pro-l";
|
||||
|
||||
CantEnableText = "Couldn't connect to your CM Masterkeys Pro L.\n" +
|
||||
"Please check your cables and try updating your CM software.\n\n" +
|
||||
"If needed, you can select a different keyboard in Artemis under settings.";
|
||||
|
||||
Height = 6;
|
||||
Width = 22;
|
||||
|
||||
PreviewSettings = new PreviewSettings(new Rect(17, 13, 812, 219), Resources.masterkeys_pro_l);
|
||||
_generalSettings = SettingsProvider.Load<GeneralSettings>();
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
|
||||
CmSdk.EnableLedControl(false);
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
public override bool CanEnable()
|
||||
{
|
||||
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
|
||||
|
||||
// Doesn't seem reliable but better than nothing I suppose
|
||||
return CmSdk.IsDevicePlug();
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
|
||||
CmSdk.EnableLedControl(true);
|
||||
}
|
||||
|
||||
public override void DrawBitmap(Bitmap bitmap)
|
||||
{
|
||||
// Resize the bitmap
|
||||
using (var b = ImageUtilities.ResizeImage(bitmap, Width, Height))
|
||||
{
|
||||
// Create an empty matrix
|
||||
var matrix = new COLOR_MATRIX {KeyColor = new KEY_COLOR[6, 22]};
|
||||
|
||||
// Map the bytes to the matix
|
||||
for (var x = 0; x < Width; x++)
|
||||
{
|
||||
for (var y = 0; y < Height; y++)
|
||||
{
|
||||
var c = b.GetPixel(x, y);
|
||||
matrix.KeyColor[y, x] = new KEY_COLOR(c.R, c.G, c.B);
|
||||
}
|
||||
}
|
||||
|
||||
// Send the matrix to the keyboard
|
||||
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
|
||||
CmSdk.SetAllLedColor(matrix);
|
||||
}
|
||||
}
|
||||
|
||||
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
||||
{
|
||||
switch (_generalSettings.Layout)
|
||||
{
|
||||
case "Qwerty":
|
||||
return KeyMap.QwertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||
case "Qwertz":
|
||||
return KeyMap.QwertzLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||
default:
|
||||
return KeyMap.AzertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ namespace Artemis.DeviceProviders.CoolerMaster
|
||||
Height = 6;
|
||||
Width = 18;
|
||||
|
||||
PreviewSettings = new PreviewSettings(683, 242, new Thickness(0, 0, 0, 0), Resources.masterkeys_pro_s);
|
||||
PreviewSettings = new PreviewSettings(new Rect(13, 12, 657, 219), Resources.masterkeys_pro_s);
|
||||
_generalSettings = SettingsProvider.Load<GeneralSettings>();
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ namespace Artemis.DeviceProviders.CoolerMaster
|
||||
using (var b = ImageUtilities.ResizeImage(bitmap, Width, Height))
|
||||
{
|
||||
// Create an empty matrix
|
||||
var matrix = new COLOR_MATRIX { KeyColor = new KEY_COLOR[6, 22] };
|
||||
var matrix = new COLOR_MATRIX {KeyColor = new KEY_COLOR[6, 22]};
|
||||
|
||||
// Map the bytes to the matix
|
||||
for (var x = 0; x < Width; x++)
|
||||
@ -72,6 +72,7 @@ namespace Artemis.DeviceProviders.CoolerMaster
|
||||
}
|
||||
|
||||
// Send the matrix to the keyboard
|
||||
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_S);
|
||||
CmSdk.SetAllLedColor(matrix);
|
||||
}
|
||||
}
|
||||
@ -89,4 +90,4 @@ namespace Artemis.DeviceProviders.CoolerMaster
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using Artemis.DeviceProviders.CoolerMaster.Utilities;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.DeviceProviders.CoolerMaster
|
||||
{
|
||||
public class MastermouseProL : DeviceProvider
|
||||
{
|
||||
public MastermouseProL(ILogger logger)
|
||||
{
|
||||
Logger = logger;
|
||||
Type = DeviceType.Mouse;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; }
|
||||
|
||||
public override void UpdateDevice(Bitmap bitmap)
|
||||
{
|
||||
// Create an empty matrix
|
||||
var matrix = new COLOR_MATRIX { KeyColor = new KEY_COLOR[6, 22] };
|
||||
|
||||
// Get colors from the bitmap's center X and on 2/5th, 3/5th and 4/5th Y
|
||||
var x = bitmap.Width / 2;
|
||||
var y = bitmap.Width / 5;
|
||||
var led1Color = bitmap.GetPixel(x, y);
|
||||
var led2Color = bitmap.GetPixel(x, y * 2);
|
||||
var led3Color = bitmap.GetPixel(x, y * 3);
|
||||
var led4Color = bitmap.GetPixel(x, y * 4);
|
||||
matrix.KeyColor[0, 0] = new KEY_COLOR(led1Color.R, led1Color.G, led1Color.B);
|
||||
matrix.KeyColor[0, 1] = new KEY_COLOR(led2Color.R, led2Color.G, led2Color.B);
|
||||
matrix.KeyColor[0, 2] = new KEY_COLOR(led3Color.R, led3Color.G, led3Color.B);
|
||||
matrix.KeyColor[0, 3] = new KEY_COLOR(led4Color.R, led4Color.G, led4Color.B);
|
||||
|
||||
// Send the matrix to the mouse
|
||||
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MMouse_L);
|
||||
CmSdk.SetAllLedColor(matrix);
|
||||
}
|
||||
|
||||
public override bool TryEnable()
|
||||
{
|
||||
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MMouse_L);
|
||||
|
||||
// Doesn't seem reliable but better than nothing I suppose
|
||||
CanUse = CmSdk.IsDevicePlug();
|
||||
if (CanUse)
|
||||
CmSdk.EnableLedControl(true);
|
||||
|
||||
Logger.Debug("Attempted to enable Mastermouse Pro L. CanUse: {0}", CanUse);
|
||||
return CanUse;
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
throw new NotSupportedException("Can only disable a keyboard");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using Artemis.DeviceProviders.CoolerMaster.Utilities;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.DeviceProviders.CoolerMaster
|
||||
{
|
||||
public class MastermouseProS : DeviceProvider
|
||||
{
|
||||
public MastermouseProS(ILogger logger)
|
||||
{
|
||||
Logger = logger;
|
||||
Type = DeviceType.Mouse;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; }
|
||||
|
||||
public override void UpdateDevice(Bitmap bitmap)
|
||||
{
|
||||
// Create an empty matrix
|
||||
var matrix = new COLOR_MATRIX {KeyColor = new KEY_COLOR[6, 22]};
|
||||
|
||||
// Get colors from the bitmap's center X and on 1/3rd and 2/3rd Y
|
||||
var x = bitmap.Width / 2;
|
||||
var y = bitmap.Width / 3;
|
||||
var led1Color = bitmap.GetPixel(x, y);
|
||||
var led2Color = bitmap.GetPixel(x, y * 2);
|
||||
matrix.KeyColor[0, 0] = new KEY_COLOR(led1Color.R, led1Color.G, led1Color.B);
|
||||
matrix.KeyColor[0, 1] = new KEY_COLOR(led2Color.R, led2Color.G, led2Color.B);
|
||||
|
||||
// Send the matrix to the mouse
|
||||
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MMouse_S);
|
||||
CmSdk.SetAllLedColor(matrix);
|
||||
}
|
||||
|
||||
public override bool TryEnable()
|
||||
{
|
||||
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MMouse_S);
|
||||
|
||||
// Doesn't seem reliable but better than nothing I suppose
|
||||
CanUse = CmSdk.IsDevicePlug();
|
||||
if (CanUse)
|
||||
CmSdk.EnableLedControl(true);
|
||||
|
||||
Logger.Debug("Attempted to enable Mastermouse Pro S. CanUse: {0}", CanUse);
|
||||
return CanUse;
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
throw new NotSupportedException("Can only disable a keyboard");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,10 @@ namespace Artemis.DeviceProviders.CoolerMaster.Utilities
|
||||
DEV_MKeys_S = 1,
|
||||
DEV_MKeys_L_White = 2,
|
||||
DEV_MKeys_M_White = 3,
|
||||
DEV_MMouse_L = 4
|
||||
DEV_MMouse_L = 4,
|
||||
DEV_MMouse_S = 5,
|
||||
DEV_MKeys_M = 6,
|
||||
DEV_MKeys_S_White = 7
|
||||
}
|
||||
|
||||
//Enumeration of device layout
|
||||
@ -53,6 +56,7 @@ namespace Artemis.DeviceProviders.CoolerMaster.Utilities
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern LAYOUT_KEYBOARD GetDeviceLayout();
|
||||
|
||||
/// <summary>
|
||||
@ -60,6 +64,7 @@ namespace Artemis.DeviceProviders.CoolerMaster.Utilities
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool IsDevicePlug();
|
||||
|
||||
/// <summary>
|
||||
@ -68,6 +73,7 @@ namespace Artemis.DeviceProviders.CoolerMaster.Utilities
|
||||
/// <param name="bEnable"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool EnableLedControl(bool bEnable);
|
||||
|
||||
/// <summary>
|
||||
@ -80,6 +86,7 @@ namespace Artemis.DeviceProviders.CoolerMaster.Utilities
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool SetLedColor(int iRow, int iColumn, byte r, byte g, byte b);
|
||||
|
||||
/// <summary>
|
||||
@ -88,6 +95,7 @@ namespace Artemis.DeviceProviders.CoolerMaster.Utilities
|
||||
/// <param name="colorMatrix"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool SetAllLedColor(COLOR_MATRIX colorMatrix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,13 @@ namespace Artemis.DeviceProviders.Corsair
|
||||
Height = 7;
|
||||
Width = 25;
|
||||
Slug = "corsair-k95-rgb";
|
||||
PreviewSettings = new PreviewSettings(676, 190, new Thickness(0, -15, 0, 0), Resources.k95);
|
||||
PreviewSettings = new PreviewSettings(new Rect(20, 26, 1066, 282), Resources.k95);
|
||||
break;
|
||||
case "K95 RGB PLATINUM":
|
||||
Height = 9;
|
||||
Width = 22;
|
||||
Slug = "corsair-k95-rgb-platinum";
|
||||
PreviewSettings = new PreviewSettings(new Rect(12, 1, 1075, 346), Resources.k95_platinum);
|
||||
break;
|
||||
case "K70 RGB":
|
||||
case "K70 RGB RAPIDFIRE":
|
||||
@ -63,7 +69,7 @@ namespace Artemis.DeviceProviders.Corsair
|
||||
Height = 7;
|
||||
Width = 21;
|
||||
Slug = "corsair-k70-rgb";
|
||||
PreviewSettings = new PreviewSettings(676, 210, new Thickness(0, -25, 0, 0), Resources.k70);
|
||||
PreviewSettings = new PreviewSettings(new Rect(15, 26, 929, 282), Resources.k70);
|
||||
break;
|
||||
case "K65 RGB":
|
||||
case "CGK65 RGB":
|
||||
@ -72,13 +78,13 @@ namespace Artemis.DeviceProviders.Corsair
|
||||
Height = 7;
|
||||
Width = 18;
|
||||
Slug = "corsair-k65-rgb";
|
||||
PreviewSettings = new PreviewSettings(610, 240, new Thickness(0, -30, 0, 0), Resources.k65);
|
||||
PreviewSettings = new PreviewSettings(new Rect(15, 30, 751, 284), Resources.k65);
|
||||
break;
|
||||
case "STRAFE RGB":
|
||||
Height = 7;
|
||||
Width = 22;
|
||||
Slug = "corsair-strafe-rgb";
|
||||
PreviewSettings = new PreviewSettings(665, 215, new Thickness(0, -5, 0, 0), Resources.strafe);
|
||||
PreviewSettings = new PreviewSettings(new Rect(23, 30, 940, 303), Resources.strafe);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -108,8 +114,7 @@ namespace Artemis.DeviceProviders.Corsair
|
||||
/// <param name="bitmap"></param>
|
||||
public override void DrawBitmap(Bitmap bitmap)
|
||||
{
|
||||
using (var image = ImageUtilities.ResizeImage(bitmap, Width, Height))
|
||||
{
|
||||
|
||||
// For STRAFE, stretch the image on row 2.
|
||||
if (_keyboard.DeviceInfo.Model == "STRAFE RGB")
|
||||
{
|
||||
@ -117,8 +122,8 @@ namespace Artemis.DeviceProviders.Corsair
|
||||
{
|
||||
using (var g = Graphics.FromImage(strafeBitmap))
|
||||
{
|
||||
g.DrawImage(image, new Point(0, 0));
|
||||
g.DrawImage(image, new Rectangle(0, 3, 22, 7), new Rectangle(0, 2, 22, 7),
|
||||
g.DrawImage(bitmap, new Point(0, 0));
|
||||
g.DrawImage(bitmap, new Rectangle(0, 3, 22, 7), new Rectangle(0, 2, 22, 7),
|
||||
GraphicsUnit.Pixel);
|
||||
|
||||
_keyboardBrush.Image = strafeBitmap;
|
||||
@ -128,10 +133,10 @@ namespace Artemis.DeviceProviders.Corsair
|
||||
}
|
||||
else
|
||||
{
|
||||
_keyboardBrush.Image = image;
|
||||
_keyboardBrush.Image = bitmap;
|
||||
_keyboard.Update();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
||||
@ -154,7 +159,7 @@ namespace Artemis.DeviceProviders.Corsair
|
||||
return null;
|
||||
|
||||
var center = cueLed.LedRectangle.GetCenter();
|
||||
return new KeyMatch(keyCode, (int)(center.X * widthMultiplier), (int)(center.Y * heightMultiplier));
|
||||
return new KeyMatch(keyCode, (int) (center.X * widthMultiplier), (int) (center.Y * heightMultiplier));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,8 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Artemis.Utilities;
|
||||
using MahApps.Metro.Controls.Dialogs;
|
||||
using Size = System.Windows.Size;
|
||||
|
||||
@ -31,9 +33,9 @@ namespace Artemis.DeviceProviders
|
||||
/// Returns a bitmap matching the keyboard's dimensions using the provided scale
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Bitmap KeyboardBitmap(int scale = 4) => new Bitmap(Width*scale, Height*scale);
|
||||
public Bitmap KeyboardBitmap(int scale = 4) => new Bitmap(Width * scale, Height * scale);
|
||||
|
||||
public Rect KeyboardRectangle(int scale = 4) => new Rect(new Size(Width*scale, Height*scale));
|
||||
public Rect KeyboardRectangle(int scale = 4) => new Rect(new Size(Width * scale, Height * scale));
|
||||
|
||||
/// <summary>
|
||||
/// Runs CanEnable asynchronously multiple times until successful, cancelled or max tries reached
|
||||
@ -56,7 +58,7 @@ namespace Artemis.DeviceProviders
|
||||
return false;
|
||||
}
|
||||
// Updated progress to indicate how much tries are left
|
||||
dialog.SetProgress(0.1*tries);
|
||||
dialog.SetProgress(0.1 * tries);
|
||||
}
|
||||
|
||||
if (CanEnable())
|
||||
@ -115,17 +117,16 @@ namespace Artemis.DeviceProviders
|
||||
|
||||
public struct PreviewSettings
|
||||
{
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public Thickness Margin { get; set; }
|
||||
public Bitmap Image { get; set; }
|
||||
public Rect OverlayRectangle { get; set; }
|
||||
public Rect BackgroundRectangle { get; set; }
|
||||
public BitmapImage Image { get; set; }
|
||||
|
||||
public PreviewSettings(int width, int height, Thickness margin, Bitmap image)
|
||||
public PreviewSettings(Rect overlayRectangle, Bitmap bitmap)
|
||||
{
|
||||
Width = width;
|
||||
Height = height;
|
||||
Margin = margin;
|
||||
Image = image;
|
||||
OverlayRectangle = overlayRectangle;
|
||||
BackgroundRectangle = new Rect(0, 0, bitmap.Width, bitmap.Height);
|
||||
Image = ImageUtilities.BitmapToBitmapImage(bitmap);
|
||||
Image.Freeze();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ namespace Artemis.DeviceProviders.Logitech
|
||||
"If needed, you can select a different keyboard in Artemis under settings.";
|
||||
Height = 6;
|
||||
Width = 21;
|
||||
PreviewSettings = new PreviewSettings(675, 185, new Thickness(0, 35, 0, 0), Resources.g810);
|
||||
PreviewSettings = new PreviewSettings(new Rect(19, 70, 1010, 269), Resources.g810);
|
||||
_generalSettings = SettingsProvider.Load<GeneralSettings>();
|
||||
}
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ namespace Artemis.DeviceProviders.Logitech
|
||||
"If needed, you can select a different keyboard in Artemis under settings.";
|
||||
Height = 7;
|
||||
Width = 22;
|
||||
PreviewSettings = new PreviewSettings(570, 175, new Thickness(-10, -105, 0, 0), Resources.g910);
|
||||
PreviewSettings = new PreviewSettings(new Rect(34, 18, 916, 272), Resources.g910);
|
||||
_generalSettings = SettingsProvider.Load<GeneralSettings>();
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ namespace Artemis.DeviceProviders.Logitech
|
||||
/// <param name="bitmap"></param>
|
||||
public override void DrawBitmap(Bitmap bitmap)
|
||||
{
|
||||
using (var croppedBitmap = new Bitmap(21*4, 6*4))
|
||||
using (var croppedBitmap = new Bitmap(21 * 4, 6 * 4))
|
||||
{
|
||||
// Deal with non-standard DPI
|
||||
croppedBitmap.SetResolution(96, 96);
|
||||
@ -91,11 +91,11 @@ namespace Artemis.DeviceProviders.Logitech
|
||||
private void SetLogitechColorFromCoordinates(Bitmap bitmap, KeyboardNames key, int x, int y)
|
||||
{
|
||||
var color = bitmap.GetPixel(x, y);
|
||||
var rPer = (int) Math.Round(color.R/2.55);
|
||||
var gPer = (int) Math.Round(color.G/2.55);
|
||||
var bPer = (int) Math.Round(color.B/2.55);
|
||||
var rPer = (int) Math.Round(color.R / 2.55);
|
||||
var gPer = (int) Math.Round(color.G / 2.55);
|
||||
var bPer = (int) Math.Round(color.B / 2.55);
|
||||
|
||||
LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(key, rPer, gPer, bPer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,9 @@ namespace Artemis.DeviceProviders.Logitech
|
||||
{
|
||||
public override bool CanEnable()
|
||||
{
|
||||
// Just to be sure, restore the Logitech DLL registry key
|
||||
DllManager.RestoreLogitechDll();
|
||||
|
||||
// Check to see if VC++ 2012 x64 is installed.
|
||||
if (Registry.LocalMachine.OpenSubKey(
|
||||
@"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}") == null)
|
||||
@ -22,17 +25,6 @@ namespace Artemis.DeviceProviders.Logitech
|
||||
return false;
|
||||
}
|
||||
|
||||
if (DllManager.DllPlaced())
|
||||
{
|
||||
CantEnableText =
|
||||
"Artemis couldn't enable your Logitech keyboard, because the required files are not in place.\n\n" +
|
||||
"This happens when you run The Division or GTA and shut down Artemis before shutting down The Division\n" +
|
||||
"Artemis tries to fix this automatically on startup but because the files may have been in use it failed.\n\n" +
|
||||
"To try again, restart Artemis or check out the FAQ.";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int majorNum = 0, minorNum = 0, buildNum = 0;
|
||||
|
||||
LogitechGSDK.LogiLedInit();
|
||||
@ -73,4 +65,4 @@ namespace Artemis.DeviceProviders.Logitech
|
||||
LogitechGSDK.LogiLedSetLightingFromBitmap(OrionUtilities.BitmapToByteArray(bitmap));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ namespace Artemis.DeviceProviders.Razer
|
||||
|
||||
Height = Constants.MaxRows;
|
||||
Width = Constants.MaxColumns;
|
||||
PreviewSettings = new PreviewSettings(665, 175, new Thickness(0, -15, 0, 0), Resources.blackwidow);
|
||||
PreviewSettings = new PreviewSettings(new Rect(26, 56, 906, 234), Resources.blackwidow);
|
||||
_generalSettings = SettingsProvider.Load<GeneralSettings>();
|
||||
}
|
||||
|
||||
@ -72,4 +72,4 @@ namespace Artemis.DeviceProviders.Razer
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Profiles.Layers.Abstract;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Types.Audio.AudioCapturing;
|
||||
using Artemis.Profiles.Lua;
|
||||
|
||||
98
Artemis/Artemis/Managers/KeybindManager.cs
Normal file
98
Artemis/Artemis/Managers/KeybindManager.cs
Normal file
@ -0,0 +1,98 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using Artemis.Models;
|
||||
using Artemis.Utilities;
|
||||
using MahApps.Metro.Controls;
|
||||
using KeyEventArgs = System.Windows.Forms.KeyEventArgs;
|
||||
using MouseEventArgs = System.Windows.Forms.MouseEventArgs;
|
||||
|
||||
namespace Artemis.Managers
|
||||
{
|
||||
public static class KeybindManager
|
||||
{
|
||||
private static readonly List<KeybindModel> KeybindModels = new List<KeybindModel>();
|
||||
|
||||
static KeybindManager()
|
||||
{
|
||||
InputHook.KeyDownCallback += args => ProcessKey(args, PressType.Down);
|
||||
InputHook.KeyUpCallback += args => ProcessKey(args, PressType.Up);
|
||||
InputHook.MouseDownCallback += args => ProcessMouse(args, PressType.Down);
|
||||
InputHook.MouseUpCallback += args => ProcessMouse(args, PressType.Up);
|
||||
}
|
||||
|
||||
private static void ProcessKey(KeyEventArgs keyEventArgs, PressType pressType)
|
||||
{
|
||||
// Don't trigger if the key itself is a modifier
|
||||
if (keyEventArgs.KeyCode == Keys.LShiftKey || keyEventArgs.KeyCode == Keys.RShiftKey ||
|
||||
keyEventArgs.KeyCode == Keys.LControlKey || keyEventArgs.KeyCode == Keys.RControlKey ||
|
||||
keyEventArgs.KeyCode == Keys.LMenu || keyEventArgs.KeyCode == Keys.RMenu)
|
||||
return;
|
||||
|
||||
// Create a WPF ModifierKeys enum
|
||||
var modifiers = ModifierKeysFromBooleans(keyEventArgs.Alt, keyEventArgs.Control, keyEventArgs.Shift);
|
||||
|
||||
// Create a HotKey object for comparison
|
||||
var hotKey = new HotKey(KeyInterop.KeyFromVirtualKey(keyEventArgs.KeyValue), modifiers);
|
||||
|
||||
foreach (var keybindModel in KeybindModels)
|
||||
keybindModel.InvokeIfMatched(hotKey, pressType);
|
||||
}
|
||||
|
||||
private static void ProcessMouse(MouseEventArgs mouseEventArgs, PressType pressType)
|
||||
{
|
||||
foreach (var keybindModel in KeybindModels)
|
||||
keybindModel.InvokeIfMatched(mouseEventArgs.Button, pressType);
|
||||
}
|
||||
|
||||
public static void AddOrUpdate(KeybindModel keybindModel)
|
||||
{
|
||||
if (keybindModel == null)
|
||||
return;
|
||||
|
||||
var existing = KeybindModels.FirstOrDefault(k => k.Name == keybindModel.Name);
|
||||
if (existing != null)
|
||||
KeybindModels.Remove(existing);
|
||||
|
||||
KeybindModels.Add(keybindModel);
|
||||
}
|
||||
|
||||
public static void Remove(KeybindModel keybindModel)
|
||||
{
|
||||
if (KeybindModels.Contains(keybindModel))
|
||||
KeybindModels.Remove(keybindModel);
|
||||
}
|
||||
|
||||
public static void Remove(string name)
|
||||
{
|
||||
var existing = KeybindModels.FirstOrDefault(k => k.Name == name);
|
||||
if (existing != null)
|
||||
KeybindModels.Remove(existing);
|
||||
}
|
||||
|
||||
public static ModifierKeys ModifierKeysFromBooleans(bool alt, bool control, bool shift)
|
||||
{
|
||||
// Create a WPF ModifierKeys enum
|
||||
var modifiers = ModifierKeys.None;
|
||||
if (alt)
|
||||
modifiers = ModifierKeys.Alt;
|
||||
if (control)
|
||||
{
|
||||
if (modifiers == ModifierKeys.None)
|
||||
modifiers = ModifierKeys.Control;
|
||||
else
|
||||
modifiers |= ModifierKeys.Control;
|
||||
}
|
||||
if (shift)
|
||||
{
|
||||
if (modifiers == ModifierKeys.None)
|
||||
modifiers = ModifierKeys.Shift;
|
||||
else
|
||||
modifiers |= ModifierKeys.Shift;
|
||||
}
|
||||
|
||||
return modifiers;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -56,12 +57,15 @@ namespace Artemis.Managers
|
||||
|
||||
Render();
|
||||
|
||||
int sleep = (int)(40f - (DateTime.Now.Ticks - preUpdateTicks) / 10000f);
|
||||
int sleep = (int) (40f - (DateTime.Now.Ticks - preUpdateTicks) / 10000f);
|
||||
if (sleep > 0)
|
||||
Thread.Sleep(sleep);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (Debugger.IsAttached)
|
||||
throw;
|
||||
|
||||
_logger.Warn(e, "Exception in render loop");
|
||||
}
|
||||
}
|
||||
@ -155,11 +159,13 @@ namespace Artemis.Managers
|
||||
var headsets = _deviceManager.HeadsetProviders.Where(m => m.CanUse).ToList();
|
||||
var generics = _deviceManager.GenericProviders.Where(m => m.CanUse).ToList();
|
||||
var mousemats = _deviceManager.MousematProviders.Where(m => m.CanUse).ToList();
|
||||
|
||||
|
||||
var keyboardOnly = !mice.Any() && !headsets.Any() && !generics.Any() && !mousemats.Any();
|
||||
|
||||
// Setup the frame for this tick
|
||||
using (var frame = new FrameModel(_deviceManager.ActiveKeyboard, mice.Any(), headsets.Any(), generics.Any(), mousemats.Any()))
|
||||
using (
|
||||
var frame = new FrameModel(_deviceManager.ActiveKeyboard, mice.Any(), headsets.Any(), generics.Any(),
|
||||
mousemats.Any()))
|
||||
{
|
||||
if (renderModule.IsInitialized)
|
||||
renderModule.Render(frame, keyboardOnly);
|
||||
|
||||
@ -39,7 +39,6 @@ namespace Artemis.Managers
|
||||
_processTimer.Start();
|
||||
|
||||
ProgramEnabled = false;
|
||||
Running = false;
|
||||
|
||||
// Create and start the web server
|
||||
GameStateWebServer = gameStateWebServer;
|
||||
@ -71,7 +70,6 @@ namespace Artemis.Managers
|
||||
public PipeServer PipeServer { get; set; }
|
||||
public GameStateWebServer GameStateWebServer { get; set; }
|
||||
public bool ProgramEnabled { get; private set; }
|
||||
public bool Running { get; private set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
@ -47,10 +47,9 @@ namespace Artemis.Managers
|
||||
if (string.IsNullOrEmpty(_generalSettings.LastKeyboard) || _deviceManager.ChangingKeyboard)
|
||||
return;
|
||||
|
||||
// If Artemis doesn't have focus, don't preview
|
||||
var activePreview = PreviewViewModules.FirstOrDefault(
|
||||
vm => vm.IsActive && vm.UsesProfileEditor && vm.ModuleModel.Settings.IsEnabled);
|
||||
if (activePreview != null && ActiveWindowHelper.MainWindowActive)
|
||||
// If Artemis doesn't have focus, don't preview unless overwritten by KeepActive
|
||||
var activePreview = PreviewViewModules.FirstOrDefault(vm => (vm.IsActive || vm.ProfileEditor.KeepActive) && vm.UsesProfileEditor && vm.ModuleModel.Settings.IsEnabled);
|
||||
if (activePreview != null && (activePreview.ProfileEditor.KeepActive || ActiveWindowHelper.MainWindowActive))
|
||||
EnsurePreviewActive(activePreview);
|
||||
else
|
||||
EnsurePreviewInactive();
|
||||
|
||||
55
Artemis/Artemis/Models/KeybindModel.cs
Normal file
55
Artemis/Artemis/Models/KeybindModel.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using MahApps.Metro.Controls;
|
||||
|
||||
namespace Artemis.Models
|
||||
{
|
||||
public class KeybindModel
|
||||
{
|
||||
public KeybindModel(string name, HotKey hotKey, PressType pressType, Action action)
|
||||
{
|
||||
Name = name;
|
||||
HotKey = hotKey;
|
||||
PressType = pressType;
|
||||
Action = action;
|
||||
}
|
||||
|
||||
public KeybindModel(string name, MouseButtons mouseButtons, PressType pressType, Action action)
|
||||
{
|
||||
Name = name;
|
||||
MouseButtons = mouseButtons;
|
||||
PressType = pressType;
|
||||
Action = action;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public HotKey HotKey { get; set; }
|
||||
public MouseButtons? MouseButtons { get; }
|
||||
public PressType PressType { get; set; }
|
||||
public Action Action { get; set; }
|
||||
|
||||
public void InvokeIfMatched(HotKey hotKey, PressType pressType)
|
||||
{
|
||||
if (HotKey == null || hotKey == null || PressType != pressType)
|
||||
return;
|
||||
|
||||
if (hotKey.Equals(HotKey))
|
||||
Action?.Invoke();
|
||||
}
|
||||
|
||||
public void InvokeIfMatched(MouseButtons mouseButtons, PressType pressType)
|
||||
{
|
||||
if (PressType != pressType)
|
||||
return;
|
||||
|
||||
if (mouseButtons.Equals(MouseButtons))
|
||||
Action?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public enum PressType
|
||||
{
|
||||
Down,
|
||||
Up
|
||||
}
|
||||
}
|
||||
@ -50,7 +50,7 @@ namespace Artemis.Models
|
||||
new ConstructorArgument("dataModel", dataModel),
|
||||
new ConstructorArgument("layer", layer)
|
||||
};
|
||||
_windowService.ShowDialog<LayerEditorViewModel>(args);
|
||||
_windowService.ShowDialog<LayerEditorViewModel>("Artemis | Edit layer", args);
|
||||
|
||||
// If the layer was a folder, but isn't anymore, assign it's children to it's parent.
|
||||
if (layer.LayerType is FolderType || !layer.Children.Any())
|
||||
|
||||
@ -134,7 +134,12 @@ namespace Artemis.Modules.Abstract
|
||||
private void ChangeToLastProfile()
|
||||
{
|
||||
var profileName = !string.IsNullOrEmpty(Settings?.LastProfile) ? Settings.LastProfile : "Default";
|
||||
ChangeProfile(ProfileProvider.GetProfile(DeviceManager.ActiveKeyboard, this, profileName));
|
||||
|
||||
var profile = ProfileProvider.GetProfile(DeviceManager.ActiveKeyboard, this, profileName);
|
||||
if (profile == null)
|
||||
profile = ProfileProvider.GetProfile(DeviceManager.ActiveKeyboard, this, "Default");
|
||||
|
||||
ChangeProfile(profile);
|
||||
}
|
||||
|
||||
protected virtual void RaiseProfileChangedEvent(ProfileChangedEventArgs e)
|
||||
|
||||
@ -13,9 +13,9 @@ namespace Artemis.Modules.Abstract
|
||||
{
|
||||
public abstract class ModuleViewModel : Screen
|
||||
{
|
||||
private readonly GeneralSettings _generalSettings;
|
||||
private readonly MainManager _mainManager;
|
||||
private readonly ModuleManager _moduleManager;
|
||||
private readonly GeneralSettings _generalSettings;
|
||||
private ModuleSettings _settings;
|
||||
|
||||
public ModuleViewModel(MainManager mainManager, ModuleModel moduleModel, IKernel kernel)
|
||||
@ -56,7 +56,8 @@ namespace Artemis.Modules.Abstract
|
||||
get { return _settings; }
|
||||
set
|
||||
{
|
||||
if (Equals(value, _settings)) return;
|
||||
if (Equals(value, _settings))
|
||||
return;
|
||||
_settings = value;
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
}
|
||||
@ -74,6 +75,9 @@ namespace Artemis.Modules.Abstract
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether or not this module uses the profile editor
|
||||
/// </summary>
|
||||
public abstract bool UsesProfileEditor { get; }
|
||||
|
||||
private void MainManagerOnEnabledChanged(object sender, EnabledChangedEventArgs e)
|
||||
@ -91,7 +95,7 @@ namespace Artemis.Modules.Abstract
|
||||
|
||||
private void UpdatedEnabledSetting()
|
||||
{
|
||||
if (!ModuleModel.IsGeneral || (_moduleManager.ActiveModule != null && !_moduleManager.ActiveModule.IsGeneral || Settings.IsEnabled == IsModuleActive))
|
||||
if (!ModuleModel.IsGeneral || _moduleManager.ActiveModule != null && !_moduleManager.ActiveModule.IsGeneral || Settings.IsEnabled == IsModuleActive)
|
||||
return;
|
||||
|
||||
Settings.IsEnabled = IsModuleActive;
|
||||
@ -161,4 +165,4 @@ namespace Artemis.Modules.Abstract
|
||||
ProfileEditor?.OnDeactivate(close);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,164 @@
|
||||
using Artemis.Modules.Abstract;
|
||||
using AssettoCorsaSharedMemory;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.AssettoCorsa
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class AssettoCorsaDataModel : ModuleDataModel
|
||||
{
|
||||
public AssettoCorsaDataModel()
|
||||
{
|
||||
Physics = new Physics();
|
||||
Interface = new Graphics();
|
||||
StaticInfo = new StaticInfo();
|
||||
}
|
||||
|
||||
public Physics Physics { get; set; }
|
||||
public Graphics Interface { get; set; }
|
||||
public StaticInfo StaticInfo { get; set; }
|
||||
}
|
||||
|
||||
[MoonSharpUserData]
|
||||
public class Physics
|
||||
{
|
||||
public float Abs { get; set; }
|
||||
public float Gas { get; set; }
|
||||
public float Brake { get; set; }
|
||||
public float Fuel { get; set; }
|
||||
public int Gear { get; set; }
|
||||
public int Rpms { get; set; }
|
||||
public float SteerAngle { get; set; }
|
||||
public float SpeedKmh { get; set; }
|
||||
public float[] Velocity { get; set; }
|
||||
public float[] AccG { get; set; }
|
||||
public float[] WheelSlip { get; set; }
|
||||
public float[] WheelLoad { get; set; }
|
||||
public float[] WheelsPressure { get; set; }
|
||||
public float[] WheelAngularSpeed { get; set; }
|
||||
public float[] TyreWear { get; set; }
|
||||
public float[] TyreDirtyLevel { get; set; }
|
||||
public float[] TyreCoreTemperature { get; set; }
|
||||
public float[] CamberRad { get; set; }
|
||||
public float[] SuspensionTravel { get; set; }
|
||||
public float Drs { get; set; }
|
||||
public float TC { get; set; }
|
||||
public float Heading { get; set; }
|
||||
public float Pitch { get; set; }
|
||||
public float Roll { get; set; }
|
||||
public float CgHeight { get; set; }
|
||||
public float[] CarDamage { get; set; }
|
||||
public int NumberOfTyresOut { get; set; }
|
||||
public int PitLimiterOn { get; set; }
|
||||
public float KersCharge { get; set; }
|
||||
public float KersInput { get; set; }
|
||||
public int AutoShifterOn { get; set; }
|
||||
public float[] RideHeight { get; set; }
|
||||
public float TurboBoost { get; set; }
|
||||
public float Ballast { get; set; }
|
||||
public float AirDensity { get; set; }
|
||||
public float AirTemp { get; set; }
|
||||
public float RoadTemp { get; set; }
|
||||
public float[] LocalAngularVelocity { get; set; }
|
||||
public float FinalFF { get; set; }
|
||||
public float PerformanceMeter { get; set; }
|
||||
public int EngineBrake { get; set; }
|
||||
public int ErsRecoveryLevel { get; set; }
|
||||
public int ErsPowerLevel { get; set; }
|
||||
public int ErsHeatCharging { get; set; }
|
||||
public int ErsisCharging { get; set; }
|
||||
public float KersCurrentKJ { get; set; }
|
||||
public int DrsAvailable { get; set; }
|
||||
public int DrsEnabled { get; set; }
|
||||
public float[] BrakeTemp { get; set; }
|
||||
public float Clutch { get; set; }
|
||||
public float[] TyreTempI { get; set; }
|
||||
public float[] TyreTempM { get; set; }
|
||||
public float[] TyreTempO { get; set; }
|
||||
public int IsAIControlled { get; set; }
|
||||
public Coordinates[] TyreContactPoint { get; set; }
|
||||
public Coordinates[] TyreContactNormal { get; set; }
|
||||
public Coordinates[] TyreContactHeading { get; set; }
|
||||
public float BrakeBias { get; set; }
|
||||
}
|
||||
|
||||
[MoonSharpUserData]
|
||||
public class Graphics
|
||||
{
|
||||
public AC_STATUS Status { get; set; }
|
||||
public AC_SESSION_TYPE Session { get; set; }
|
||||
public string CurrentTime { get; set; }
|
||||
public string LastTime { get; set; }
|
||||
public string BestTime { get; set; }
|
||||
public string Split { get; set; }
|
||||
public int Position { get; set; }
|
||||
public int iCurrentTime { get; set; }
|
||||
public int iBestTime { get; set; }
|
||||
public int iLastTime { get; set; }
|
||||
public float SessionTimeLeft { get; set; }
|
||||
public float DistanceTraveled { get; set; }
|
||||
public int IsInPit { get; set; }
|
||||
public int CurrentSectorIndex { get; set; }
|
||||
public int LastSectorTime { get; set; }
|
||||
public int NumberOfLaps { get; set; }
|
||||
public string TyreCompound { get; set; }
|
||||
public float ReplayTimeMultiplier { get; set; }
|
||||
public float NormalizedCarPosition { get; set; }
|
||||
}
|
||||
|
||||
[MoonSharpUserData]
|
||||
public class StaticInfo
|
||||
{
|
||||
public StaticInfo()
|
||||
{
|
||||
Session = new Session();
|
||||
Car = new Car();
|
||||
}
|
||||
|
||||
public string SMVersion { get; set; }
|
||||
public string ACVersion { get; set; }
|
||||
public Session Session { get; set; }
|
||||
public Car Car { get; set; }
|
||||
}
|
||||
|
||||
[MoonSharpUserData]
|
||||
public class Session
|
||||
{
|
||||
public int NumberOfSessions { get; set; }
|
||||
public int NumCars { get; set; }
|
||||
public string Track { get; set; }
|
||||
public string TrackConfiguration { get; set; }
|
||||
public float TrackSPlineLength { get; set; }
|
||||
public string PlayerName { get; set; }
|
||||
public string PlayerSurname { get; set; }
|
||||
public string PlayerNick { get; set; }
|
||||
public int SectorCount { get; set; }
|
||||
public int PenaltiesEnabled { get; set; }
|
||||
}
|
||||
|
||||
[MoonSharpUserData]
|
||||
public class Car
|
||||
{
|
||||
public string CarModel { get; set; }
|
||||
public float MaxTorque { get; set; }
|
||||
public float MaxPower { get; set; }
|
||||
public int MaxRpm { get; set; }
|
||||
public float MaxFuel { get; set; }
|
||||
public float[] SuspensionMaxTravel { get; set; }
|
||||
public float[] TyreRadius { get; set; }
|
||||
public float MaxTurboBoost { get; set; }
|
||||
public float AidFuelRate { get; set; }
|
||||
public float AidTireRate { get; set; }
|
||||
public float AidMechanicalDamage { get; set; }
|
||||
public int AidAllowTyreBlankets { get; set; }
|
||||
public float AidStability { get; set; }
|
||||
public int AidAutoClutch { get; set; }
|
||||
public int AidAutoBlip { get; set; }
|
||||
public int HasDRS { get; set; }
|
||||
public int HasERS { get; set; }
|
||||
public int HasKERS { get; set; }
|
||||
public float KersMaxJoules { get; set; }
|
||||
public int EngineBrakeSettingsCount { get; set; }
|
||||
public int ErsPowerControllerCount { get; set; }
|
||||
}
|
||||
}
|
||||
173
Artemis/Artemis/Modules/Games/AssettoCorsa/AssettoCorsaModel.cs
Normal file
173
Artemis/Artemis/Modules/Games/AssettoCorsa/AssettoCorsaModel.cs
Normal file
@ -0,0 +1,173 @@
|
||||
using System;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using AssettoCorsaSharedMemory;
|
||||
|
||||
namespace Artemis.Modules.Games.AssettoCorsa
|
||||
{
|
||||
public class AssettoCorsaModel : ModuleModel
|
||||
{
|
||||
private AssettoCorsaSharedMemory.AssettoCorsa _ac;
|
||||
|
||||
public AssettoCorsaModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
|
||||
{
|
||||
Settings = SettingsProvider.Load<AssettoCorsaSettings>();
|
||||
DataModel = new AssettoCorsaDataModel();
|
||||
ProcessNames.Add("AssettoCorsa");
|
||||
}
|
||||
|
||||
public override string Name => "AssettoCorsa";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
_ac = new AssettoCorsaSharedMemory.AssettoCorsa {PhysicsInterval = 40};
|
||||
// The event handlers map their respecive enums to the datamodel, not pretty but fastest way possible
|
||||
_ac.StaticInfoUpdated += AcOnStaticInfoUpdated;
|
||||
_ac.GraphicsUpdated += AcOnGraphicsUpdated;
|
||||
_ac.PhysicsUpdated += AcOnPhysicsUpdated;
|
||||
_ac.Start();
|
||||
|
||||
base.Enable();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
_ac.Stop();
|
||||
_ac = null;
|
||||
}
|
||||
|
||||
private void AcOnStaticInfoUpdated(object sender, StaticInfoEventArgs e)
|
||||
{
|
||||
var dataModel = (AssettoCorsaDataModel)DataModel;
|
||||
dataModel.StaticInfo.SMVersion = e.StaticInfo.SMVersion;
|
||||
dataModel.StaticInfo.ACVersion = e.StaticInfo.ACVersion;
|
||||
dataModel.StaticInfo.Session.NumberOfSessions = e.StaticInfo.NumberOfSessions;
|
||||
dataModel.StaticInfo.Session.NumCars = e.StaticInfo.NumCars;
|
||||
dataModel.StaticInfo.Session.Track = e.StaticInfo.Track;
|
||||
dataModel.StaticInfo.Session.TrackConfiguration = e.StaticInfo.TrackConfiguration;
|
||||
dataModel.StaticInfo.Session.TrackSPlineLength = e.StaticInfo.TrackSPlineLength;
|
||||
dataModel.StaticInfo.Session.PlayerName = e.StaticInfo.PlayerName;
|
||||
dataModel.StaticInfo.Session.PlayerSurname = e.StaticInfo.PlayerSurname;
|
||||
dataModel.StaticInfo.Session.PlayerNick = e.StaticInfo.PlayerNick;
|
||||
dataModel.StaticInfo.Session.SectorCount = e.StaticInfo.SectorCount;
|
||||
dataModel.StaticInfo.Session.PenaltiesEnabled = e.StaticInfo.PenaltiesEnabled;
|
||||
dataModel.StaticInfo.Car.CarModel = e.StaticInfo.CarModel;
|
||||
dataModel.StaticInfo.Car.MaxTorque = e.StaticInfo.MaxTorque;
|
||||
dataModel.StaticInfo.Car.MaxPower = e.StaticInfo.MaxPower;
|
||||
dataModel.StaticInfo.Car.MaxRpm = e.StaticInfo.MaxRpm;
|
||||
dataModel.StaticInfo.Car.MaxFuel = e.StaticInfo.MaxFuel;
|
||||
dataModel.StaticInfo.Car.SuspensionMaxTravel = e.StaticInfo.SuspensionMaxTravel;
|
||||
dataModel.StaticInfo.Car.TyreRadius = e.StaticInfo.TyreRadius;
|
||||
dataModel.StaticInfo.Car.MaxTurboBoost = e.StaticInfo.MaxTurboBoost;
|
||||
dataModel.StaticInfo.Car.AidFuelRate = e.StaticInfo.AidFuelRate;
|
||||
dataModel.StaticInfo.Car.AidTireRate = e.StaticInfo.AidTireRate;
|
||||
dataModel.StaticInfo.Car.AidMechanicalDamage = e.StaticInfo.AidMechanicalDamage;
|
||||
dataModel.StaticInfo.Car.AidAllowTyreBlankets = e.StaticInfo.AidAllowTyreBlankets;
|
||||
dataModel.StaticInfo.Car.AidStability = e.StaticInfo.AidStability;
|
||||
dataModel.StaticInfo.Car.AidAutoClutch = e.StaticInfo.AidAutoClutch;
|
||||
dataModel.StaticInfo.Car.AidAutoBlip = e.StaticInfo.AidAutoBlip;
|
||||
dataModel.StaticInfo.Car.HasDRS = e.StaticInfo.HasDRS;
|
||||
dataModel.StaticInfo.Car.HasERS = e.StaticInfo.HasERS;
|
||||
dataModel.StaticInfo.Car.HasKERS = e.StaticInfo.HasKERS;
|
||||
dataModel.StaticInfo.Car.KersMaxJoules = e.StaticInfo.KersMaxJoules;
|
||||
dataModel.StaticInfo.Car.EngineBrakeSettingsCount = e.StaticInfo.EngineBrakeSettingsCount;
|
||||
dataModel.StaticInfo.Car.ErsPowerControllerCount = e.StaticInfo.ErsPowerControllerCount;
|
||||
}
|
||||
|
||||
private void AcOnGraphicsUpdated(object sender, GraphicsEventArgs e)
|
||||
{
|
||||
var dataModel = (AssettoCorsaDataModel)DataModel;
|
||||
dataModel.Interface.Status = e.Graphics.Status;
|
||||
dataModel.Interface.Session = e.Graphics.Session;
|
||||
dataModel.Interface.CurrentTime = e.Graphics.CurrentTime;
|
||||
dataModel.Interface.LastTime = e.Graphics.LastTime;
|
||||
dataModel.Interface.BestTime = e.Graphics.BestTime;
|
||||
dataModel.Interface.Split = e.Graphics.Split;
|
||||
dataModel.Interface.Position = e.Graphics.Position;
|
||||
dataModel.Interface.iCurrentTime = e.Graphics.iCurrentTime;
|
||||
dataModel.Interface.iLastTime = e.Graphics.iLastTime;
|
||||
dataModel.Interface.iBestTime = e.Graphics.iBestTime;
|
||||
dataModel.Interface.SessionTimeLeft = e.Graphics.SessionTimeLeft;
|
||||
dataModel.Interface.DistanceTraveled = e.Graphics.DistanceTraveled;
|
||||
dataModel.Interface.IsInPit = e.Graphics.IsInPit;
|
||||
dataModel.Interface.CurrentSectorIndex = e.Graphics.CurrentSectorIndex;
|
||||
dataModel.Interface.LastSectorTime = e.Graphics.LastSectorTime;
|
||||
dataModel.Interface.NumberOfLaps = e.Graphics.NumberOfLaps;
|
||||
dataModel.Interface.TyreCompound = e.Graphics.TyreCompound;
|
||||
dataModel.Interface.ReplayTimeMultiplier = e.Graphics.ReplayTimeMultiplier;
|
||||
dataModel.Interface.NormalizedCarPosition = e.Graphics.NormalizedCarPosition;
|
||||
}
|
||||
|
||||
private void AcOnPhysicsUpdated(object sender, PhysicsEventArgs e)
|
||||
{
|
||||
var dataModel = (AssettoCorsaDataModel)DataModel;
|
||||
dataModel.Physics.Abs = e.Physics.Abs;
|
||||
dataModel.Physics.Gas = e.Physics.Gas;
|
||||
dataModel.Physics.Brake = e.Physics.Brake;
|
||||
dataModel.Physics.Fuel = e.Physics.Fuel;
|
||||
dataModel.Physics.Gear = e.Physics.Gear;
|
||||
dataModel.Physics.Rpms = e.Physics.Rpms;
|
||||
dataModel.Physics.SteerAngle = e.Physics.SteerAngle;
|
||||
dataModel.Physics.SpeedKmh = e.Physics.SpeedKmh;
|
||||
dataModel.Physics.Velocity = e.Physics.Velocity;
|
||||
dataModel.Physics.AccG = e.Physics.AccG;
|
||||
dataModel.Physics.WheelSlip = e.Physics.WheelSlip;
|
||||
dataModel.Physics.WheelLoad = e.Physics.WheelLoad;
|
||||
dataModel.Physics.WheelsPressure = e.Physics.WheelsPressure;
|
||||
dataModel.Physics.WheelAngularSpeed = e.Physics.WheelAngularSpeed;
|
||||
dataModel.Physics.TyreWear = e.Physics.TyreWear;
|
||||
dataModel.Physics.TyreDirtyLevel = e.Physics.TyreDirtyLevel;
|
||||
dataModel.Physics.TyreCoreTemperature = e.Physics.TyreCoreTemperature;
|
||||
dataModel.Physics.CamberRad = e.Physics.CamberRad;
|
||||
dataModel.Physics.SuspensionTravel = e.Physics.SuspensionTravel;
|
||||
dataModel.Physics.Drs = e.Physics.Drs;
|
||||
dataModel.Physics.TC = e.Physics.TC;
|
||||
dataModel.Physics.Heading = e.Physics.Heading;
|
||||
dataModel.Physics.Pitch = e.Physics.Pitch;
|
||||
dataModel.Physics.Roll = e.Physics.Roll;
|
||||
dataModel.Physics.CgHeight = e.Physics.CgHeight;
|
||||
dataModel.Physics.CarDamage = e.Physics.CarDamage;
|
||||
dataModel.Physics.NumberOfTyresOut = e.Physics.NumberOfTyresOut;
|
||||
dataModel.Physics.PitLimiterOn = e.Physics.PitLimiterOn;
|
||||
dataModel.Physics.KersCharge = e.Physics.KersCharge;
|
||||
dataModel.Physics.KersInput = e.Physics.KersInput;
|
||||
dataModel.Physics.AutoShifterOn = e.Physics.AutoShifterOn;
|
||||
dataModel.Physics.RideHeight = e.Physics.RideHeight;
|
||||
dataModel.Physics.TurboBoost = e.Physics.TurboBoost;
|
||||
dataModel.Physics.Ballast = e.Physics.Ballast;
|
||||
dataModel.Physics.AirDensity = e.Physics.AirDensity;
|
||||
dataModel.Physics.AirTemp = e.Physics.AirTemp;
|
||||
dataModel.Physics.RoadTemp = e.Physics.RoadTemp;
|
||||
dataModel.Physics.LocalAngularVelocity = e.Physics.LocalAngularVelocity;
|
||||
dataModel.Physics.FinalFF = e.Physics.FinalFF;
|
||||
dataModel.Physics.PerformanceMeter = e.Physics.PerformanceMeter;
|
||||
dataModel.Physics.EngineBrake = e.Physics.EngineBrake;
|
||||
dataModel.Physics.ErsRecoveryLevel = e.Physics.ErsRecoveryLevel;
|
||||
dataModel.Physics.ErsPowerLevel = e.Physics.ErsPowerLevel;
|
||||
dataModel.Physics.ErsHeatCharging = e.Physics.ErsHeatCharging;
|
||||
dataModel.Physics.ErsisCharging = e.Physics.ErsisCharging;
|
||||
dataModel.Physics.KersCurrentKJ = e.Physics.KersCurrentKJ;
|
||||
dataModel.Physics.DrsAvailable = e.Physics.DrsAvailable;
|
||||
dataModel.Physics.DrsEnabled = e.Physics.DrsEnabled;
|
||||
dataModel.Physics.BrakeTemp = e.Physics.BrakeTemp;
|
||||
dataModel.Physics.Clutch = e.Physics.Clutch;
|
||||
dataModel.Physics.TyreTempI = e.Physics.TyreTempI;
|
||||
dataModel.Physics.TyreTempM = e.Physics.TyreTempM;
|
||||
dataModel.Physics.TyreTempO = e.Physics.TyreTempO;
|
||||
dataModel.Physics.IsAIControlled = e.Physics.IsAIControlled;
|
||||
dataModel.Physics.TyreContactPoint = e.Physics.TyreContactPoint;
|
||||
dataModel.Physics.TyreContactNormal = e.Physics.TyreContactNormal;
|
||||
dataModel.Physics.TyreContactHeading = e.Physics.TyreContactHeading;
|
||||
dataModel.Physics.BrakeBias = e.Physics.BrakeBias;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
// Updating is done by the events
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.AssettoCorsa
|
||||
{
|
||||
public class AssettoCorsaSettings : ModuleSettings
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.AssettoCorsa.AssettoCorsaView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="600" d:DesignWidth="900">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="By default shows RPM on the F-keys, gear on the other keys and track flags on the numpad." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<!-- Sub header -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold" TextAlignment="Justify" Margin="5,0,0,10">
|
||||
The Assetto Corsa module uses the <Hyperlink RequestNavigate="Hyperlink_RequestNavigate" NavigateUri="https://github.com/mdjarv/assettocorsasharedmemory">Assetto Corsa Shared Memory Library</Hyperlink> project by mdjarv.
|
||||
</TextBlock>
|
||||
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -0,0 +1,18 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace Artemis.Modules.Games.AssettoCorsa
|
||||
{
|
||||
public partial class AssettoCorsaView : UserControl
|
||||
{
|
||||
public AssettoCorsaView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
System.Diagnostics.Process.Start(e.Uri.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.AssettoCorsa
|
||||
{
|
||||
public sealed class AssettoCorsaViewModel : ModuleViewModel
|
||||
{
|
||||
public AssettoCorsaViewModel(MainManager mainManager, [Named(nameof(AssettoCorsaModel))] ModuleModel moduleModel,
|
||||
IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "Assetto Corsa";
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
}
|
||||
}
|
||||
@ -8,6 +8,7 @@ using Artemis.Services;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.GameState;
|
||||
using Newtonsoft.Json;
|
||||
using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;
|
||||
|
||||
namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
@ -56,7 +57,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
return;
|
||||
|
||||
var dm = (CounterStrikeDataModel) DataModel;
|
||||
if (dm.player != null)
|
||||
if (dm.player != null && dm.player.weapons != null)
|
||||
{
|
||||
// Detect active weapon
|
||||
if (dm.player.weapons.weapon_0?.state == "active")
|
||||
@ -147,7 +148,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
if (DataModel == null)
|
||||
DataModel = new CounterStrikeDataModel();
|
||||
JsonConvert.PopulateObject(jsonString, DataModel);
|
||||
JsonConvert.PopulateObject(jsonString, DataModel, new JsonSerializerSettings {Error = HandleGameDataError});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -155,5 +156,11 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleGameDataError(object sender, ErrorEventArgs e)
|
||||
{
|
||||
// Ignore errors and leave them null
|
||||
e.ErrorContext.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,68 +1,55 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.CounterStrike.CounterStrikeView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15,5,5,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="By default shows team, HP, ammo and money on the keyboard and shows team colors on mouse and headset" />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="By default shows team, HP, ammo and money on the keyboard and shows team colors on mouse and headset." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<StackPanel Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Counter-Strike Global Offensive directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
||||
Text="{Binding Path=Settings.GameDirectory, Mode=TwoWay}"
|
||||
cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25"
|
||||
Style="{DynamicResource SquareButtonStyle}" Height="26" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<!-- Directory -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Counter-Strike Global Offensive directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="0,0,30,0" Text="{Binding Path=Settings.GameDirectory, Mode=TwoWay}" cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944" HorizontalAlignment="Right" Width="25" Style="{DynamicResource SquareButtonStyle}" Height="26" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-20,0" />
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,4 +1,5 @@
|
||||
using Artemis.Managers;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
@ -6,8 +7,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
public sealed class CounterStrikeViewModel : ModuleViewModel
|
||||
{
|
||||
public CounterStrikeViewModel(MainManager mainManager,
|
||||
[Named(nameof(CounterStrikeModel))] ModuleModel moduleModel, IKernel kernel)
|
||||
public CounterStrikeViewModel(MainManager mainManager, [Named(nameof(CounterStrikeModel))] ModuleModel moduleModel, IKernel kernel)
|
||||
: base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "CS:GO";
|
||||
@ -15,10 +15,23 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
|
||||
public void BrowseDirectory()
|
||||
public void PlaceConfigFile()
|
||||
{
|
||||
((CounterStrikeModel) ModuleModel).PlaceConfigFile();
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
}
|
||||
|
||||
public void BrowseDirectory()
|
||||
{
|
||||
var dialog = new FolderBrowserDialog { SelectedPath = ((CounterStrikeSettings)Settings).GameDirectory };
|
||||
var result = dialog.ShowDialog();
|
||||
if (result != DialogResult.OK)
|
||||
return;
|
||||
|
||||
((CounterStrikeSettings)Settings).GameDirectory = dialog.SelectedPath;
|
||||
((CounterStrikeModel)ModuleModel).PlaceConfigFile();
|
||||
Settings.Save();
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,67 +1,55 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.Dota2.Dota2View"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15,5,5,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="By default shows mana, HP, character state on the keyboard and colors headset and mouse according to HP" />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="By default shows mana, HP, character state on the keyboard and colors headset and mouse according to HP." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<StackPanel Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Dota 2 directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
||||
Text="{Binding Path=Settings.GameDirectory, Mode=TwoWay}"
|
||||
cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25"
|
||||
Style="{DynamicResource SquareButtonStyle}" Height="26" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-20,0" />
|
||||
<!-- Directory -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Dota 2 directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="0,0,30,0" Text="{Binding Path=Settings.GameDirectory, Mode=TwoWay}" cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944" HorizontalAlignment="Right" Width="25" Style="{DynamicResource SquareButtonStyle}" Height="26" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,4 +1,5 @@
|
||||
using Artemis.Managers;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
@ -6,18 +7,31 @@ namespace Artemis.Modules.Games.Dota2
|
||||
{
|
||||
public sealed class Dota2ViewModel : ModuleViewModel
|
||||
{
|
||||
public Dota2ViewModel(MainManager mainManager, [Named(nameof(Dota2Model))] ModuleModel moduleModel,
|
||||
IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
public Dota2ViewModel(MainManager mainManager, [Named(nameof(Dota2Model))] ModuleModel moduleModel, IKernel kernel)
|
||||
: base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "Dota 2";
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
|
||||
public void BrowseDirectory()
|
||||
public void PlaceConfigFile()
|
||||
{
|
||||
((Dota2Model) ModuleModel).PlaceConfigFile();
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
}
|
||||
|
||||
public void BrowseDirectory()
|
||||
{
|
||||
var dialog = new FolderBrowserDialog { SelectedPath = ((Dota2Settings)Settings).GameDirectory };
|
||||
var result = dialog.ShowDialog();
|
||||
if (result != DialogResult.OK)
|
||||
return;
|
||||
|
||||
((Dota2Settings)Settings).GameDirectory = dialog.SelectedPath;
|
||||
((Dota2Model)ModuleModel).PlaceConfigFile();
|
||||
Settings.Save();
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,33 +1,33 @@
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Modules.Games.EurotruckSimulator2.Data;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class EurotruckSimulator2DataModel : ModuleDataModel
|
||||
{
|
||||
public EurotruckSimulator2DataModel()
|
||||
{
|
||||
// Register types for LUA
|
||||
UserData.RegisterType<IEts2Game>();
|
||||
UserData.RegisterType<IEts2Job>();
|
||||
UserData.RegisterType<IEts2Navigation>();
|
||||
UserData.RegisterType<IEts2Trailer>();
|
||||
UserData.RegisterType<IEts2Truck>();
|
||||
}
|
||||
|
||||
public TruckSimulatorGameName GameName { get; set; }
|
||||
public IEts2Game Game { get; set; }
|
||||
public IEts2Job Job { get; set; }
|
||||
public IEts2Navigation Navigation { get; set; }
|
||||
public IEts2Trailer Trailer { get; set; }
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Modules.Games.EurotruckSimulator2.Data;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class EurotruckSimulator2DataModel : ModuleDataModel
|
||||
{
|
||||
public EurotruckSimulator2DataModel()
|
||||
{
|
||||
// Register types for LUA
|
||||
UserData.RegisterType<IEts2Game>();
|
||||
UserData.RegisterType<IEts2Job>();
|
||||
UserData.RegisterType<IEts2Navigation>();
|
||||
UserData.RegisterType<IEts2Trailer>();
|
||||
UserData.RegisterType<IEts2Truck>();
|
||||
}
|
||||
|
||||
public TruckSimulatorGameName GameName { get; set; }
|
||||
public IEts2Game Game { get; set; }
|
||||
public IEts2Job Job { get; set; }
|
||||
public IEts2Navigation Navigation { get; set; }
|
||||
public IEts2Trailer Trailer { get; set; }
|
||||
public IEts2Truck Truck { get; set; }
|
||||
|
||||
public enum TruckSimulatorGameName
|
||||
{
|
||||
EuroTruckSimulator2,
|
||||
AmericanTruckSimulator
|
||||
}
|
||||
}
|
||||
public enum TruckSimulatorGameName
|
||||
{
|
||||
EuroTruckSimulator2,
|
||||
AmericanTruckSimulator
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,103 +1,75 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.EurotruckSimulator2.EurotruckSimulator2View"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="559.725" d:DesignWidth="882.696">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15,5,5,5">
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="559.725" d:DesignWidth="882.696">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="By default shows indicator lights, speed and engine RPM on the keyboard." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<!-- Sub header -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold" TextAlignment="Justify" Margin="5,0,0,10">
|
||||
The Truck Simulator module uses code from the <Hyperlink RequestNavigate="Hyperlink_RequestNavigate" NavigateUri="https://github.com/Funbit/ets2-telemetry-server">ETS2 Telemetry Web Server</Hyperlink> project by Funbit.
|
||||
</TextBlock>
|
||||
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Directories -->
|
||||
<Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
|
||||
<!-- ETS2 dir -->
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="By default shows indicator lights, speed and engine RPM on the keyboard" />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom"
|
||||
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
|
||||
TextAlignment="Justify" Margin="5,0,0,10">
|
||||
The Truck Simulator module uses code from the
|
||||
<Hyperlink RequestNavigate="Hyperlink_RequestNavigate"
|
||||
NavigateUri="https://github.com/Funbit/ets2-telemetry-server">
|
||||
ETS2 Telemetry Web Server
|
||||
</Hyperlink>
|
||||
project by Funbit
|
||||
</TextBlock>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
|
||||
<!-- ETS2 dir -->
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="0,0,1,0" Grid.Column="0">
|
||||
<Label FontSize="16" HorizontalAlignment="Left" Content="Euro Truck Simulator 2 directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="Ets2GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
||||
Text="{Binding Path=Settings.Ets2GameDirectory, Mode=TwoWay}"
|
||||
cal:Message.Attach="[Event LostFocus] = [Action Ets2PlacePlugin]" />
|
||||
<Button x:Name="Ets2BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25"
|
||||
Style="{DynamicResource SquareButtonStyle}" Height="26" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<!-- ATS dir -->
|
||||
<StackPanel Margin="0,0,1,0" Grid.Column="1">
|
||||
<Label FontSize="16" HorizontalAlignment="Left" Content="American Truck Simulator directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="AtsGameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
||||
Text="{Binding Path=Settings.AtsGameDirectory, Mode=TwoWay}"
|
||||
cal:Message.Attach="[Event LostFocus] = [Action AtsPlacePlugin]" />
|
||||
<Button x:Name="AtsBrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25"
|
||||
Style="{DynamicResource SquareButtonStyle}" Height="26" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-20,0" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="5" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<StackPanel Margin="0,0,1,0" Grid.Column="0">
|
||||
<Label FontSize="16" HorizontalAlignment="Left" Content="Euro Truck Simulator 2 directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="Ets2GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0" Text="{Binding Path=Settings.Ets2GameDirectory, Mode=TwoWay}" cal:Message.Attach="[Event LostFocus] = [Action Ets2PlacePlugin]" />
|
||||
<Button x:Name="Ets2BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944" HorizontalAlignment="Right" Width="25" Style="{DynamicResource SquareButtonStyle}" Height="26" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<!-- ATS dir -->
|
||||
<StackPanel Margin="0,0,1,0" Grid.Column="1">
|
||||
<Label FontSize="16" HorizontalAlignment="Left" Content="American Truck Simulator directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="AtsGameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0" Text="{Binding Path=Settings.AtsGameDirectory, Mode=TwoWay}" cal:Message.Attach="[Event LostFocus] = [Action AtsPlacePlugin]" />
|
||||
<Button x:Name="AtsBrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944" HorizontalAlignment="Right" Width="25" Style="{DynamicResource SquareButtonStyle}" Height="26" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Threading;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using Artemis.DAL;
|
||||
@ -13,8 +14,7 @@ namespace Artemis.Modules.Games.GtaV
|
||||
{
|
||||
private readonly PipeServer _pipeServer;
|
||||
|
||||
public GtaVModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer)
|
||||
: base(deviceManager, luaManager)
|
||||
public GtaVModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer) : base(deviceManager, luaManager)
|
||||
{
|
||||
_pipeServer = pipeServer;
|
||||
|
||||
@ -29,6 +29,7 @@ namespace Artemis.Modules.Games.GtaV
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
var process = System.Diagnostics.Process.GetProcessesByName("GTA5").First();
|
||||
DllManager.PlaceLogitechDll();
|
||||
_pipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||
base.Enable();
|
||||
|
||||
@ -1,55 +1,45 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.GtaV.GtaVView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15, 5, 15, 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="By default fills up the keyboard and colors all devices according to the character you're playing/team you're in." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="By default fills up the keyboard and colors all devices according to the character you're playing/team you're in." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,55 +1,55 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.LightFx
|
||||
{
|
||||
public class LightFxModel : ModuleModel
|
||||
{
|
||||
public LightFxModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer)
|
||||
: base(deviceManager, luaManager)
|
||||
{
|
||||
Settings = SettingsProvider.Load<LightFxSettings>();
|
||||
DataModel = new LightFxDataModel();
|
||||
ProcessNames.Add("LoL");
|
||||
|
||||
// This model can enable itself by changing its process name to the currently running Light FX game.
|
||||
pipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||
}
|
||||
|
||||
public override string Name => "LightFX";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
private void PipeServerOnPipeMessage(string msg)
|
||||
{
|
||||
// Ensure it's Light FX JSON
|
||||
if (!msg.Contains("lightFxState"))
|
||||
return;
|
||||
|
||||
// Deserialize and data
|
||||
try
|
||||
{
|
||||
JsonConvert.PopulateObject(msg, DataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger?.Error(ex, "Failed to deserialize LightFX JSON");
|
||||
throw;
|
||||
}
|
||||
|
||||
// Setup process name
|
||||
var processName = Path.GetFileNameWithoutExtension(((LightFxDataModel) DataModel).LightFxState.game);
|
||||
if (!ProcessNames.Contains(processName))
|
||||
ProcessNames.Add(processName);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using Artemis.DAL;
|
||||
//using Artemis.Managers;
|
||||
//using Artemis.Modules.Abstract;
|
||||
//using Artemis.Utilities.DataReaders;
|
||||
//using Newtonsoft.Json;
|
||||
//
|
||||
//namespace Artemis.Modules.Games.LightFx
|
||||
//{
|
||||
// public class LightFxModel : ModuleModel
|
||||
// {
|
||||
// public LightFxModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer)
|
||||
// : base(deviceManager, luaManager)
|
||||
// {
|
||||
// Settings = SettingsProvider.Load<LightFxSettings>();
|
||||
// DataModel = new LightFxDataModel();
|
||||
// ProcessNames.Add("LoL");
|
||||
//
|
||||
// // This model can enable itself by changing its process name to the currently running Light FX game.
|
||||
// pipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||
// }
|
||||
//
|
||||
// public override string Name => "LightFX";
|
||||
// public override bool IsOverlay => false;
|
||||
// public override bool IsBoundToProcess => true;
|
||||
//
|
||||
// private void PipeServerOnPipeMessage(string msg)
|
||||
// {
|
||||
// // Ensure it's Light FX JSON
|
||||
// if (!msg.Contains("lightFxState"))
|
||||
// return;
|
||||
//
|
||||
// // Deserialize and data
|
||||
// try
|
||||
// {
|
||||
// JsonConvert.PopulateObject(msg, DataModel);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Logger?.Error(ex, "Failed to deserialize LightFX JSON");
|
||||
// throw;
|
||||
// }
|
||||
//
|
||||
// // Setup process name
|
||||
// var processName = Path.GetFileNameWithoutExtension(((LightFxDataModel) DataModel).LightFxState.game);
|
||||
// if (!ProcessNames.Contains(processName))
|
||||
// ProcessNames.Add(processName);
|
||||
// }
|
||||
//
|
||||
// public override void Update()
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@ -1,61 +1,45 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.LightFx.LightFxView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="559.725" d:DesignWidth="882.696">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15,5,5,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="559.725" d:DesignWidth="882.696">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="Mirrors Light FX lighting to your RGB devices" />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="Mirrors Light FX lighting to your RGB devices." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-20,0" />
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,17 +1,17 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.LightFx
|
||||
{
|
||||
public sealed class LightFxViewModel : ModuleViewModel
|
||||
{
|
||||
public LightFxViewModel(MainManager mainManager, [Named(nameof(LightFxModel))] ModuleModel moduleModel,
|
||||
IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "Light FX";
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
}
|
||||
}
|
||||
//using Artemis.Managers;
|
||||
//using Artemis.Modules.Abstract;
|
||||
//using Ninject;
|
||||
//
|
||||
//namespace Artemis.Modules.Games.LightFx
|
||||
//{
|
||||
// public sealed class LightFxViewModel : ModuleViewModel
|
||||
// {
|
||||
// public LightFxViewModel(MainManager mainManager, [Named(nameof(LightFxModel))] ModuleModel moduleModel,
|
||||
// IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
// {
|
||||
// DisplayName = "Light FX";
|
||||
// }
|
||||
//
|
||||
// public override bool UsesProfileEditor => true;
|
||||
// }
|
||||
//}
|
||||
@ -1,88 +1,60 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.Overwatch.OverwatchView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="410.933" d:DesignWidth="732.154">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15, 5, 15, 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="410.933" d:DesignWidth="732.154">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="By default colors the keyboard according to the chosen hero and shows ability cooldowns." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="By default colors the keyboard according to the chosen hero and shows ability cooldowns." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom"
|
||||
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
|
||||
TextAlignment="Justify" Margin="5,0,0,10">
|
||||
Note: If you're having trouble getting the profile to work, check out
|
||||
<Hyperlink RequestNavigate="Hyperlink_RequestNavigate"
|
||||
NavigateUri="https://github.com/SpoinkyNL/Artemis/wiki/Overwatch">
|
||||
the wiki
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
<!-- Sub header -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold" TextAlignment="Justify" Margin="5,0,0,10">
|
||||
Note: If you're having trouble getting the profile to work, check out <Hyperlink RequestNavigate="Hyperlink_RequestNavigate" NavigateUri="https://github.com/SpoinkyNL/Artemis/wiki/Overwatch">the wiki</Hyperlink>.
|
||||
</TextBlock>
|
||||
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Game directory -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Overwatch Directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="0,0,30,0" Text="{Binding Path=Settings.GameDirectory, Mode=TwoWay}" cal:Message.Attach="[Event LostFocus] = [Action PlaceDll]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944" HorizontalAlignment="Right" Width="25" Style="{DynamicResource SquareButtonStyle}" Height="26" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Game directory -->
|
||||
<StackPanel Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Overwatch Directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
||||
Text="{Binding Path=GameSettings.GameDirectory, Mode=TwoWay}"
|
||||
cal:Message.Attach="[Event LostFocus] = [Action PlaceDll]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25"
|
||||
Style="{DynamicResource SquareButtonStyle}" Height="26" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor"
|
||||
Margin="0,0,-30,0" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
</ScrollViewer>
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -15,6 +15,11 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
|
||||
public void PlaceDll()
|
||||
{
|
||||
((OverwatchModel)ModuleModel).PlaceDll();
|
||||
}
|
||||
|
||||
public void BrowseDirectory()
|
||||
{
|
||||
var dialog = new FolderBrowserDialog {SelectedPath = ((OverwatchSettings) Settings).GameDirectory};
|
||||
|
||||
@ -9,10 +9,13 @@ namespace Artemis.Modules.Games.ProjectCars.Data
|
||||
{
|
||||
public pCarsDataClass MapStructToClass(pCarsAPIStruct pcarsDataStruct, pCarsDataClass pCarsData)
|
||||
{
|
||||
//pCarsDataClass pCarsData = new pCarsDataClass();
|
||||
pCarsData.mVersion = pcarsDataStruct.mVersion;
|
||||
pCarsData.mBuildVersion = pcarsDataStruct.mBuildVersion;
|
||||
|
||||
// The game isn't running if these are 0
|
||||
if (pcarsDataStruct.mVersion == 0 && pcarsDataStruct.mBuildVersion == 0)
|
||||
return pCarsData;
|
||||
|
||||
// Session type
|
||||
pCarsData.mGameState = (eGameState) pcarsDataStruct.mGameState;
|
||||
pCarsData.mSessionState = (eSessionState) pcarsDataStruct.mSessionState;
|
||||
|
||||
@ -37,6 +37,10 @@ namespace Artemis.Modules.Games.ProjectCars.Data
|
||||
if (memoryMappedFile == null)
|
||||
InitialiseSharedMemory();
|
||||
|
||||
// If it's still null here the game isn't running
|
||||
if (memoryMappedFile == null)
|
||||
return new Tuple<bool, pCarsAPIStruct>(true, _pcarsapistruct);
|
||||
|
||||
using (var sharedMemoryStreamView = memoryMappedFile.CreateViewStream())
|
||||
{
|
||||
var sharedMemoryStream = new BinaryReader(sharedMemoryStreamView);
|
||||
|
||||
@ -1,71 +1,50 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.ProjectCars.ProjectCarsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="559.725" d:DesignWidth="882.696">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15,5,5,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="559.725" d:DesignWidth="882.696">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="By default shows RPM on the F-keys, gear on the other keys and track flags on the numpad." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="By default shows RPM on the F-keys, gear on the other keys and track flags on the numpad." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom"
|
||||
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
|
||||
TextAlignment="Justify" Margin="5,0,0,10">
|
||||
The Project CARS module uses code from the
|
||||
<Hyperlink RequestNavigate="Hyperlink_RequestNavigate"
|
||||
NavigateUri="https://bitbucket.org/MikeyTT/pcars-api-demo">
|
||||
pCars API Demo
|
||||
</Hyperlink>
|
||||
project by MikeyTT
|
||||
</TextBlock>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<!-- Sub header -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold" TextAlignment="Justify" Margin="5,0,0,10">
|
||||
The Project CARS module uses code from the <Hyperlink RequestNavigate="Hyperlink_RequestNavigate" NavigateUri="https://bitbucket.org/MikeyTT/pcars-api-demo">pCars API Demo</Hyperlink> project by MikeyTT.
|
||||
</TextBlock>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-20,0" />
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,10 +1,13 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.Memory;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.RocketLeague
|
||||
{
|
||||
@ -20,21 +23,21 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
ProcessNames.Add("RocketLeague");
|
||||
|
||||
// Generate a new offset when the game is updated
|
||||
//var offset = new GamePointersCollection
|
||||
//{
|
||||
// Game = "RocketLeague",
|
||||
// GameVersion = "1.27",
|
||||
// GameAddresses = new List<GamePointer>
|
||||
// {
|
||||
// new GamePointer
|
||||
// {
|
||||
// Description = "Boost",
|
||||
// BasePointer = new IntPtr(0x016D5084),
|
||||
// Offsets = new[] {0xC4, 0x214, 0x320, 0x73C, 0x224}
|
||||
// }
|
||||
// }
|
||||
//};
|
||||
//var res = JsonConvert.SerializeObject(offset, Formatting.Indented);
|
||||
var offset = new GamePointersCollection
|
||||
{
|
||||
Game = "RocketLeague",
|
||||
GameVersion = "1.30",
|
||||
GameAddresses = new List<GamePointer>
|
||||
{
|
||||
new GamePointer
|
||||
{
|
||||
Description = "Boost",
|
||||
BasePointer = new IntPtr(0x016E00B4),
|
||||
Offsets = new[] {0xC4, 0x18, 0x388, 0x73C, 0x224}
|
||||
}
|
||||
}
|
||||
};
|
||||
var res = JsonConvert.SerializeObject(offset, Formatting.Indented);
|
||||
}
|
||||
|
||||
public override string Name => "RocketLeague";
|
||||
|
||||
@ -1,57 +1,48 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.RocketLeague.RocketLeagueView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15, 5, 15, 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="By default fills up the keyboard and colors all devices according to the amount boost." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="By default fills up the keyboard and colors all devices according to the amount boost." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||
<!-- Sub header -->
|
||||
<TextBlock x:Name="VersionText" Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold" TextAlignment="Justify" Margin="5,0,0,10" />
|
||||
|
||||
<TextBlock x:Name="VersionText" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center"
|
||||
Margin="0,8" TextWrapping="Wrap" HorizontalAlignment="Left"
|
||||
Foreground="{DynamicResource HighlightBrush}" />
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="5" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -36,15 +36,13 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
{
|
||||
if (!SettingsProvider.Load<GeneralSettings>().EnablePointersUpdate)
|
||||
{
|
||||
VersionText = "Note: You disabled pointer updates, this could result in the " +
|
||||
"Rocket League effect not working after a game update.";
|
||||
VersionText = "You disabled pointer updates, this could result in the Rocket League effect not working after a game update.";
|
||||
return;
|
||||
}
|
||||
|
||||
Updater.GetPointers();
|
||||
var version = SettingsProvider.Load<OffsetSettings>().RocketLeague.GameVersion;
|
||||
VersionText = $"Note: Requires patch {version}. When a new patch is released Artemis downloads " +
|
||||
"new pointers for the latest version (unless disabled in settings).";
|
||||
VersionText = $"Requires patch {version}. When a new patch is released Artemis downloads new pointers for the latest version (unless disabled in settings).";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,138 +1,143 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
|
||||
namespace Artemis.Modules.Games.TheDivision
|
||||
{
|
||||
public class TheDivisionModel : ModuleModel
|
||||
{
|
||||
private readonly PipeServer _pipeServer;
|
||||
private StickyValue<bool> _stickyAmmo;
|
||||
private StickyValue<bool> _stickyHp;
|
||||
|
||||
public TheDivisionModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer)
|
||||
: base(deviceManager, luaManager)
|
||||
{
|
||||
_pipeServer = pipeServer;
|
||||
|
||||
Settings = SettingsProvider.Load<TheDivisionSettings>();
|
||||
DataModel = new TheDivisionDataModel();
|
||||
ProcessNames.Add("TheDivision");
|
||||
}
|
||||
|
||||
public override string Name => "TheDivision";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
|
||||
// Delay restoring the DLL to allow The Division to release it
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
Thread.Sleep(2000);
|
||||
DllManager.RestoreLogitechDll();
|
||||
});
|
||||
|
||||
_stickyAmmo?.Dispose();
|
||||
_stickyHp?.Dispose();
|
||||
_pipeServer.PipeMessage -= PipeServerOnPipeMessage;
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
_stickyAmmo = new StickyValue<bool>(200);
|
||||
_stickyHp = new StickyValue<bool>(200);
|
||||
|
||||
DllManager.PlaceLogitechDll();
|
||||
|
||||
_pipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||
|
||||
base.Enable();
|
||||
}
|
||||
|
||||
private void PipeServerOnPipeMessage(string reply)
|
||||
{
|
||||
if (!IsInitialized)
|
||||
return;
|
||||
|
||||
// Convert the given string to a list of ints
|
||||
var stringParts = reply.Split(' ');
|
||||
if (stringParts[0] != "1")
|
||||
return;
|
||||
|
||||
// Parse into a list of ints and interpertrate
|
||||
var parts = new int[stringParts.Length];
|
||||
for (var i = 0; i < stringParts.Length; i++)
|
||||
parts[i] = int.Parse(stringParts[i]);
|
||||
|
||||
InterpertrateDivisionKey(parts);
|
||||
}
|
||||
|
||||
// Parses Division key data to game data
|
||||
private void InterpertrateDivisionKey(IReadOnlyList<int> parts)
|
||||
{
|
||||
var gameDataModel = (TheDivisionDataModel) DataModel;
|
||||
var keyCode = parts[1];
|
||||
var rPer = parts[2];
|
||||
var gPer = parts[3];
|
||||
var bPer = parts[4];
|
||||
|
||||
// F1 to F4 indicate the player and his party. Blinks red on damage taken
|
||||
if (keyCode >= 59 && keyCode <= 62)
|
||||
{
|
||||
var playerId = keyCode - 58;
|
||||
|
||||
PlayerState newState;
|
||||
if (gPer > 10)
|
||||
newState = PlayerState.Online;
|
||||
else if (rPer > 10)
|
||||
newState = PlayerState.Hit;
|
||||
else
|
||||
newState = PlayerState.Offline;
|
||||
|
||||
if (playerId == 1)
|
||||
gameDataModel.LowHp = newState == PlayerState.Hit;
|
||||
else if (playerId == 2)
|
||||
gameDataModel.PartyMember1 = newState;
|
||||
else if (playerId == 3)
|
||||
gameDataModel.PartyMember2 = newState;
|
||||
else if (playerId == 4)
|
||||
gameDataModel.PartyMember3 = newState;
|
||||
}
|
||||
// R blinks white when low on ammo
|
||||
else if (keyCode == 19)
|
||||
{
|
||||
_stickyAmmo.Value = rPer == 100 && gPer > 1 && bPer > 1;
|
||||
gameDataModel.LowAmmo = _stickyAmmo.Value;
|
||||
}
|
||||
// G turns white when holding a grenade, turns off when out of grenades
|
||||
else if (keyCode == 34)
|
||||
{
|
||||
if (rPer == 100 && gPer < 10 && bPer < 10)
|
||||
gameDataModel.GrenadeState = GrenadeState.HasGrenade;
|
||||
else if (rPer == 100 && gPer > 10 && bPer > 10)
|
||||
gameDataModel.GrenadeState = GrenadeState.GrenadeEquipped;
|
||||
else
|
||||
gameDataModel.GrenadeState = GrenadeState.HasNoGrenade;
|
||||
}
|
||||
// V blinks on low HP
|
||||
else if (keyCode == 47)
|
||||
{
|
||||
_stickyHp.Value = rPer == 100 && gPer > 1 && bPer > 1;
|
||||
gameDataModel.LowHp = _stickyHp.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
// DataModel updating is done whenever a pipe message is received
|
||||
}
|
||||
}
|
||||
}
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Threading;
|
||||
//using System.Threading.Tasks;
|
||||
//using Artemis.DAL;
|
||||
//using Artemis.DeviceProviders.Logitech.Utilities;
|
||||
//using Artemis.Managers;
|
||||
//using Artemis.Modules.Abstract;
|
||||
//using Artemis.Utilities;
|
||||
//using Artemis.Utilities.DataReaders;
|
||||
//
|
||||
//namespace Artemis.Modules.Games.TheDivision
|
||||
//{
|
||||
// public class TheDivisionModel : ModuleModel
|
||||
// {
|
||||
// private readonly PipeServer _pipeServer;
|
||||
// private StickyValue<bool> _stickyAmmo;
|
||||
// private StickyValue<bool> _stickyHp;
|
||||
//
|
||||
// public TheDivisionModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer)
|
||||
// : base(deviceManager, luaManager)
|
||||
// {
|
||||
// _pipeServer = pipeServer;
|
||||
//
|
||||
// Settings = SettingsProvider.Load<TheDivisionSettings>();
|
||||
// DataModel = new TheDivisionDataModel();
|
||||
// ProcessNames.Add("TheDivision");
|
||||
// }
|
||||
//
|
||||
// public override string Name => "TheDivision";
|
||||
// public override bool IsOverlay => false;
|
||||
// public override bool IsBoundToProcess => true;
|
||||
//
|
||||
// public override void Dispose()
|
||||
// {
|
||||
// base.Dispose();
|
||||
//
|
||||
// // Delay restoring the DLL to allow The Division to release it
|
||||
// Task.Factory.StartNew(() =>
|
||||
// {
|
||||
// Thread.Sleep(2000);
|
||||
// DllManager.RestoreLogitechDll();
|
||||
// });
|
||||
//
|
||||
// _stickyAmmo?.Dispose();
|
||||
// _stickyHp?.Dispose();
|
||||
// _pipeServer.PipeMessage -= PipeServerOnPipeMessage;
|
||||
// }
|
||||
//
|
||||
// public override void Enable()
|
||||
// {
|
||||
// _stickyAmmo = new StickyValue<bool>(200);
|
||||
// _stickyHp = new StickyValue<bool>(200);
|
||||
//
|
||||
// var process = System.Diagnostics.Process.GetProcessesByName("TheDivision").First();
|
||||
// DllManager.PlaceLogitechDll();
|
||||
//
|
||||
// _pipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||
//
|
||||
// base.Enable();
|
||||
// }
|
||||
//
|
||||
// private void PipeServerOnPipeMessage(string reply)
|
||||
// {
|
||||
// if (!IsInitialized)
|
||||
// return;
|
||||
//
|
||||
// // Convert the given string to a list of ints
|
||||
// var stringParts = reply.Split(' ');
|
||||
// if (stringParts[0] != "1")
|
||||
// return;
|
||||
//
|
||||
// // Parse into a list of ints and interpertrate
|
||||
// var parts = new int[stringParts.Length];
|
||||
// for (var i = 0; i < stringParts.Length; i++)
|
||||
// parts[i] = int.Parse(stringParts[i]);
|
||||
//
|
||||
// InterpertrateDivisionKey(parts);
|
||||
// }
|
||||
//
|
||||
// // Parses Division key data to game data
|
||||
// private void InterpertrateDivisionKey(IReadOnlyList<int> parts)
|
||||
// {
|
||||
// var gameDataModel = (TheDivisionDataModel) DataModel;
|
||||
// var keyCode = parts[1];
|
||||
// var rPer = parts[2];
|
||||
// var gPer = parts[3];
|
||||
// var bPer = parts[4];
|
||||
//
|
||||
// var keyEnum = (KeyboardNames) keyCode;
|
||||
//
|
||||
// // F1 to F4 indicate the player and his party. Blinks red on damage taken
|
||||
// if (keyCode >= 59 && keyCode <= 62)
|
||||
// {
|
||||
// var playerId = keyCode - 58;
|
||||
//
|
||||
// PlayerState newState;
|
||||
// if (gPer > 10)
|
||||
// newState = PlayerState.Online;
|
||||
// else if (rPer > 10)
|
||||
// newState = PlayerState.Hit;
|
||||
// else
|
||||
// newState = PlayerState.Offline;
|
||||
//
|
||||
// if (playerId == 1)
|
||||
// gameDataModel.LowHp = newState == PlayerState.Hit;
|
||||
// else if (playerId == 2)
|
||||
// gameDataModel.PartyMember1 = newState;
|
||||
// else if (playerId == 3)
|
||||
// gameDataModel.PartyMember2 = newState;
|
||||
// else if (playerId == 4)
|
||||
// gameDataModel.PartyMember3 = newState;
|
||||
// }
|
||||
// // R blinks white when low on ammo
|
||||
// else if (keyCode == 19)
|
||||
// {
|
||||
// _stickyAmmo.Value = rPer == 100 && gPer > 1 && bPer > 1;
|
||||
// gameDataModel.LowAmmo = _stickyAmmo.Value;
|
||||
// }
|
||||
// // G turns white when holding a grenade, turns off when out of grenades
|
||||
// else if (keyCode == 34)
|
||||
// {
|
||||
// if (rPer == 100 && gPer < 10 && bPer < 10)
|
||||
// gameDataModel.GrenadeState = GrenadeState.HasGrenade;
|
||||
// else if (rPer == 100 && gPer > 10 && bPer > 10)
|
||||
// gameDataModel.GrenadeState = GrenadeState.GrenadeEquipped;
|
||||
// else
|
||||
// gameDataModel.GrenadeState = GrenadeState.HasNoGrenade;
|
||||
// }
|
||||
// // V blinks on low HP
|
||||
// else if (keyCode == 47)
|
||||
// {
|
||||
// _stickyHp.Value = rPer == 100 && gPer > 1 && bPer > 1;
|
||||
// gameDataModel.LowHp = _stickyHp.Value;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public override void Update()
|
||||
// {
|
||||
// // DataModel updating is done whenever a pipe message is received
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@ -1,61 +1,51 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.TheDivision.TheDivisionView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Artemis.Modules.Games.TheDivision"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="416.495" d:DesignWidth="553.608">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
||||
<Grid Margin="15, 5, 5, 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Artemis.Modules.Games.TheDivision"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="416.495" d:DesignWidth="553.608">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="Shows verious game states and events on the keyboard. (BETA, uses much CPU!)" />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="By default shows RPM on the F-keys, gear on the other keys and track flags on the numpad." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center"
|
||||
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
|
||||
TextAlignment="Justify" Margin="5,0,0,0">
|
||||
For this game to work with Artemis, please open up your Division settings, navigate to 3rd Party
|
||||
and set LED keyboard support to Yes. (This only works if you have Artemis running before starting the game)
|
||||
</TextBlock>
|
||||
<!-- Sub header -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold" TextAlignment="Justify" Margin="5,0,0,10">
|
||||
For this game to work with Artemis, please open up your Division settings, navigate to 3rd Party and set LED keyboard support to Yes. (This only works if you have Artemis running before starting the game)
|
||||
</TextBlock>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-20,0" />
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,17 +1,17 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.TheDivision
|
||||
{
|
||||
public sealed class TheDivisionViewModel : ModuleViewModel
|
||||
{
|
||||
public TheDivisionViewModel(MainManager mainManager, [Named(nameof(TheDivisionModel))] ModuleModel moduleModel,
|
||||
IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "The Division";
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
}
|
||||
}
|
||||
//using Artemis.Managers;
|
||||
//using Artemis.Modules.Abstract;
|
||||
//using Ninject;
|
||||
//
|
||||
//namespace Artemis.Modules.Games.TheDivision
|
||||
//{
|
||||
// public sealed class TheDivisionViewModel : ModuleViewModel
|
||||
// {
|
||||
// public TheDivisionViewModel(MainManager mainManager, [Named(nameof(TheDivisionModel))] ModuleModel moduleModel,
|
||||
// IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
// {
|
||||
// DisplayName = "The Division";
|
||||
// }
|
||||
//
|
||||
// public override bool UsesProfileEditor => true;
|
||||
// }
|
||||
//}
|
||||
@ -1,70 +1,56 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.UnrealTournament.UnrealTournamentView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15, 5, 15, 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="By default shows team, HP armor and ammo on the keyboard and shows team colors on mouse and headset." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="By default shows team, HP armor and ammo on the keyboard and shows team colors on mouse and headset." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<!-- Game directory -->
|
||||
<StackPanel Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Unreal Tournament Directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
||||
Text="{Binding Path=Settings.GameDirectory, Mode=TwoWay}"
|
||||
cal:Message.Attach="[Event LostFocus] = [Action PlaceFiles]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25"
|
||||
Style="{DynamicResource SquareButtonStyle}" Height="26" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<!-- Directory -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Unreal Tournament Directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="0,0,30,0" Text="{Binding Path=Settings.GameDirectory, Mode=TwoWay}" cal:Message.Attach="[Event LostFocus] = [Action PlaceFiles]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944" HorizontalAlignment="Right" Width="25" Style="{DynamicResource SquareButtonStyle}" Height="26" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -32,6 +32,13 @@ namespace Artemis.Modules.Games.UnrealTournament
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
}
|
||||
|
||||
public void PlaceFiles()
|
||||
{
|
||||
((UnrealTournamentModel)ModuleModel).PlaceFiles();
|
||||
Settings.Save();
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
}
|
||||
|
||||
// Installing GIF on editor open to make sure the proper profiles are loaded
|
||||
private void InstallGif()
|
||||
{
|
||||
|
||||
@ -1,60 +1,55 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.Witcher3.Witcher3View"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="386.842" d:DesignWidth="554.887">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
||||
<Grid Margin="15, 5, 5, 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="By default colors the keyboard according to the sign Gerald is using." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center"
|
||||
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
|
||||
TextAlignment="Justify" Margin="5,0,0,10">
|
||||
Artemis requires the latest Witcher 3 version and mod to be installed in order to work. If you don't use any (conflicting) Witcher 3 mods, the mod can automatically be installed.
|
||||
</TextBlock>
|
||||
<Button Grid.Row="2" Grid.Column="0" Margin="5,0,0,0" x:Name="AutoInstall"
|
||||
Content="Try automatic mod install" Width="160" Style="{DynamicResource SquareButtonStyle}"
|
||||
HorizontalAlignment="Left" />
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="386.842" d:DesignWidth="554.887">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="By default shows team, HP, ammo and money on the keyboard and shows team colors on mouse and headset." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<!-- Sub header -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold" TextAlignment="Justify" Margin="5,0,0,10">
|
||||
Artemis requires the latest Witcher 3 version and mod to be installed in order to work. If you don't use any (conflicting) Witcher 3 mods, the mod can automatically be installed.
|
||||
</TextBlock>
|
||||
|
||||
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Mod installation -->
|
||||
<Button Grid.Row="2" Grid.Column="0" Margin="5,0,0,0" x:Name="AutoInstall" Content="Try automatic mod install" Width="160" Style="{DynamicResource SquareButtonStyle}" HorizontalAlignment="Left" />
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,57 +1,51 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.WoW.WoWView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15, 5, 15, 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="Fight The Burning Legion in style with reactive lighting" />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="Fight the Legion in style with reactive lighting." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||
<!-- Sub header -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold" TextAlignment="Justify" Margin="5,0,0,10">
|
||||
This module hasn't been approved by Blizzard and could lead to an account ban. Even though the risk is minimal, it's still your own risk.
|
||||
</TextBlock>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,5 +1,7 @@
|
||||
using System.Drawing;
|
||||
using System.Windows;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Artemis.Utilities;
|
||||
using Color = System.Drawing.Color;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace Artemis.Modules.General.Bubbles
|
||||
@ -20,7 +22,7 @@ namespace Artemis.Modules.General.Bubbles
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
private Brush _brush;
|
||||
private SolidColorBrush _brush;
|
||||
|
||||
private Color _color;
|
||||
|
||||
@ -30,7 +32,7 @@ namespace Artemis.Modules.General.Bubbles
|
||||
set
|
||||
{
|
||||
_color = value;
|
||||
_brush = new SolidBrush(_color);
|
||||
_brush = new SolidColorBrush(ColorHelpers.ToMediaColor(_color));
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,10 +47,10 @@ namespace Artemis.Modules.General.Bubbles
|
||||
public void CheckCollision(Rect border)
|
||||
{
|
||||
if (Position.X - Radius < border.X || Position.X + Radius > border.X + border.Width)
|
||||
Direction = new Vector(Direction.X*-1, Direction.Y);
|
||||
Direction = new Vector(Direction.X * -1, Direction.Y);
|
||||
|
||||
if (Position.Y - Radius < border.Y || Position.Y + Radius > border.Y + border.Height)
|
||||
Direction = new Vector(Direction.X, Direction.Y*-1);
|
||||
Direction = new Vector(Direction.X, Direction.Y * -1);
|
||||
}
|
||||
|
||||
public void Move()
|
||||
@ -56,11 +58,11 @@ namespace Artemis.Modules.General.Bubbles
|
||||
Position += Direction;
|
||||
}
|
||||
|
||||
public void Draw(Graphics g)
|
||||
public void Draw(DrawingContext drawingContext)
|
||||
{
|
||||
g.FillEllipse(_brush, (float) Position.X - Radius, (float) Position.Y - Radius, Radius*2, Radius*2);
|
||||
drawingContext.DrawEllipse(_brush, new Pen(_brush, 1), new Point((float) Position.X - Radius, (float) Position.Y - Radius), Radius * 2, Radius * 2);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,11 +93,9 @@ namespace Artemis.Modules.General.Bubbles
|
||||
|
||||
public override void Render(FrameModel frameModel, bool keyboardOnly)
|
||||
{
|
||||
using (var g = Graphics.FromImage(frameModel.KeyboardBitmap))
|
||||
{
|
||||
foreach (var bubble in _bubbles)
|
||||
bubble.Draw(g);
|
||||
}
|
||||
var c = frameModel.KeyboardModel.GetDrawingContext();
|
||||
foreach (var bubble in _bubbles)
|
||||
bubble.Draw(c);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -1,54 +1,45 @@
|
||||
<UserControl x:Class="Artemis.Modules.General.GeneralProfile.GeneralProfileView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15, 5, 15, 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="Allows you to create layers shown while not gaming" />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="Allows you to create layers outside the supported games." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,-30,0" x:Name="ProfileEditor"/>
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset module" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,54 +1,45 @@
|
||||
<UserControl x:Class="Artemis.Modules.Overlays.OverlayProfile.OverlayProfileView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15, 5, 15, 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="Allows you to create layers on top of any other active module." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!-- Header -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="Allows you to create layers on top of any other active module." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,-30,0" x:Name="ProfileEditor"/>
|
||||
<!-- Enable -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Label Content="Enable module" HorizontalAlignment="Right" Margin="0,0,0,3" />
|
||||
<controls:ToggleSwitchButton IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}" cal:Message.Attach="[Event Click] = [Action ToggleModule]"
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" ToolTip="Note: You can't enable an module when Artemis is disabled" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset module" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100" Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -42,12 +42,32 @@
|
||||
</xs:attribute>
|
||||
<xs:attribute name="throwExceptions" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Pass NLog internal exceptions to the application. Default value is: false.</xs:documentation>
|
||||
<xs:documentation>Throw an exception when there is an internal error. Default value is: false.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="throwConfigExceptions" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Throw an exception when there is a configuration error. If not set, determined by throwExceptions.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="keepVariablesOnReload" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Gets or sets a value indicating whether Variables should be kept on configuration reload. Default value is: false.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="internalLogToTrace" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Write internal NLog messages to the the System.Diagnostics.Trace. Default value is: false</xs:documentation>
|
||||
<xs:documentation>Write internal NLog messages to the System.Diagnostics.Trace. Default value is: false.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="internalLogIncludeTimestamp" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Write timestamps for internal NLog messages. Default value is: true.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="useInvariantCulture" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Use InvariantCulture as default culture instead of CurrentCulture. Default value is: false.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
@ -174,7 +194,7 @@
|
||||
<xs:complexType name="NLogInclude">
|
||||
<xs:attribute name="file" type="SimpleLayoutAttribute" use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Name of the file to be included. The name is relative to the name of the current config file.</xs:documentation>
|
||||
<xs:documentation>Name of the file to be included. You could use * wildcard. The name is relative to the name of the current config file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ignoreErrors" type="xs:boolean" use="optional" default="false">
|
||||
@ -250,9 +270,11 @@
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="batchSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="fullBatchSizeWriteLimit" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="overflowAction" minOccurs="0" maxOccurs="1" type="NLog.Targets.Wrappers.AsyncTargetWrapperOverflowAction" />
|
||||
<xs:element name="queueLimit" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="timeToSleepBetweenBatches" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -264,6 +286,11 @@
|
||||
<xs:documentation>Number of log events that should be processed in a batch by the lazy writer thread.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="fullBatchSizeWriteLimit" type="xs:integer">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Limit of full s to write before yielding into Performance is better when writing many small batches, than writing a single large batch</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="overflowAction" type="NLog.Targets.Wrappers.AsyncTargetWrapperOverflowAction">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Action to be taken when the lazy writer thread request queue count exceeds the set limit.</xs:documentation>
|
||||
@ -279,6 +306,11 @@
|
||||
<xs:documentation>Time in milliseconds to sleep between batches.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -295,6 +327,7 @@
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="condition" minOccurs="0" maxOccurs="1" type="Condition" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -306,6 +339,11 @@
|
||||
<xs:documentation>Condition expression. Log events who meet this condition will cause a flush on the wrapped target.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -317,6 +355,7 @@
|
||||
<xs:element name="bufferSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="flushTimeout" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="slidingTimeout" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -338,6 +377,11 @@
|
||||
<xs:documentation>Indicates whether to use sliding timeout.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -353,19 +397,20 @@
|
||||
<xs:element name="newLine" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="onConnectionOverflow" minOccurs="0" maxOccurs="1" type="NLog.Targets.NetworkTargetConnectionsOverflowAction" />
|
||||
<xs:element name="onOverflow" minOccurs="0" maxOccurs="1" type="NLog.Targets.NetworkTargetOverflowAction" />
|
||||
<xs:element name="maxConnections" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="keepConnection" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="connectionCacheSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="maxConnections" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="address" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="maxQueueSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="includeSourceInfo" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="ndcItemSeparator" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="parameter" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.NLogViewerParameterInfo" />
|
||||
<xs:element name="includeMdc" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="includeSourceInfo" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="includeNLogData" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="includeNdc" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="includeCallSite" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="appInfo" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="includeNLogData" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="includeMdc" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="ndcItemSeparator" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -407,6 +452,11 @@
|
||||
<xs:documentation>Action that should be taken if the message is larger than maxMessageSize.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="maxConnections" type="xs:integer">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Maximum current connections. 0 = no maximum.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="keepConnection" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether to keep connection open whenever possible.</xs:documentation>
|
||||
@ -417,11 +467,6 @@
|
||||
<xs:documentation>Size of the connection cache (number of connections which are kept alive).</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="maxConnections" type="xs:integer">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Maximum current connections. 0 = no maximum.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="address" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Network address.</xs:documentation>
|
||||
@ -432,14 +477,19 @@
|
||||
<xs:documentation>Maximum queue size.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="includeMdc" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether to include dictionary contents.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="includeSourceInfo" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether to include source info (file name and line number) in the information sent over the network.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ndcItemSeparator" type="xs:string">
|
||||
<xs:attribute name="includeNLogData" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>NDC item separator.</xs:documentation>
|
||||
<xs:documentation>Indicates whether to include NLog-specific extensions to log4j schema.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="includeNdc" type="xs:boolean">
|
||||
@ -457,14 +507,14 @@
|
||||
<xs:documentation>AppInfo field. By default it's the friendly name of the current AppDomain.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="includeNLogData" type="xs:boolean">
|
||||
<xs:attribute name="ndcItemSeparator" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether to include NLog-specific extensions to log4j schema.</xs:documentation>
|
||||
<xs:documentation>NDC item separator.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="includeMdc" type="xs:boolean">
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether to include dictionary contents.</xs:documentation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
@ -514,6 +564,7 @@
|
||||
<xs:element name="detectConsoleAvailable" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="encoding" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="errorStream" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -555,6 +606,11 @@
|
||||
<xs:documentation>Indicates whether the error stream (stderr) should be used instead of the output stream (stdout).</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -658,6 +714,7 @@
|
||||
<xs:element name="error" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="detectConsoleAvailable" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="encoding" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -694,6 +751,11 @@
|
||||
<xs:documentation>The encoding for writing messages to the .</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -702,77 +764,83 @@
|
||||
<xs:extension base="Target">
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="connectionString" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="connectionStringName" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="dbDatabase" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="dbHost" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="dbPassword" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="dbProvider" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="dbUserName" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="keepConnection" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="useTransactions" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="dbUserName" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="dbProvider" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="dbPassword" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="keepConnection" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="dbDatabase" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="connectionStringName" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="connectionString" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="dbHost" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="installConnectionString" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="install-command" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.DatabaseCommandInfo" />
|
||||
<xs:element name="uninstall-command" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.DatabaseCommandInfo" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="parameter" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.DatabaseParameterInfo" />
|
||||
<xs:element name="commandText" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="commandType" minOccurs="0" maxOccurs="1" type="System.Data.CommandType" />
|
||||
<xs:element name="parameter" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.DatabaseParameterInfo" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Name of the target.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="connectionString" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Connection string. When provided, it overrides the values specified in DBHost, DBUserName, DBPassword, DBDatabase.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="connectionStringName" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Name of the connection string (as specified in <connectionStrings> configuration section.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="dbDatabase" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Database name. If the ConnectionString is not provided this value will be used to construct the "Database=" part of the connection string.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="dbHost" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Database host name. If the ConnectionString is not provided this value will be used to construct the "Server=" part of the connection string.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="dbPassword" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Database password. If the ConnectionString is not provided this value will be used to construct the "Password=" part of the connection string.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="dbProvider" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Name of the database provider.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="dbUserName" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Database user name. If the ConnectionString is not provided this value will be used to construct the "User ID=" part of the connection string.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="keepConnection" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether to keep the database connection open between the log events.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="useTransactions" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Obsolete - value will be ignored! The logging code always runs outside of transaction. Gets or sets a value indicating whether to use database transactions. Some data providers require this.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="dbUserName" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Database user name. If the ConnectionString is not provided this value will be used to construct the "User ID=" part of the connection string.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="dbProvider" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Name of the database provider.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="dbPassword" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Database password. If the ConnectionString is not provided this value will be used to construct the "Password=" part of the connection string.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="keepConnection" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether to keep the database connection open between the log events.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="dbDatabase" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Database name. If the ConnectionString is not provided this value will be used to construct the "Database=" part of the connection string.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="connectionStringName" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Name of the connection string (as specified in <connectionStrings> configuration section.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="connectionString" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Connection string. When provided, it overrides the values specified in DBHost, DBUserName, DBPassword, DBDatabase.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="dbHost" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Database host name. If the ConnectionString is not provided this value will be used to construct the "Server=" part of the connection string.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="installConnectionString" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Connection string using for installation and uninstallation. If not provided, regular ConnectionString is being used.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="commandText" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Text of the SQL command to be run on each log level.</xs:documentation>
|
||||
@ -864,6 +932,7 @@
|
||||
<xs:element name="layout" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="header" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="footer" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -885,6 +954,11 @@
|
||||
<xs:documentation>Footer.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -894,6 +968,7 @@
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="layout" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -905,6 +980,11 @@
|
||||
<xs:documentation>Layout used to format log messages.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -922,6 +1002,7 @@
|
||||
<xs:element name="onOverflow" minOccurs="0" maxOccurs="1" type="NLog.Targets.EventLogTargetOverflowAction" />
|
||||
<xs:element name="entryType" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="maxMessageLength" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -973,6 +1054,11 @@
|
||||
<xs:documentation>Message length limit to write to the Event Log.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -989,6 +1075,7 @@
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="returnToFirstOnSuccess" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -1000,6 +1087,11 @@
|
||||
<xs:documentation>Indicates whether to return to the first target after any successful write.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -1022,6 +1114,7 @@
|
||||
<xs:element name="forceManaged" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="archiveFileKind" minOccurs="0" maxOccurs="1" type="NLog.Targets.FilePathKind" />
|
||||
<xs:element name="cleanupFileName" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="discardAll" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="fileNameKind" minOccurs="0" maxOccurs="1" type="NLog.Targets.FilePathKind" />
|
||||
<xs:element name="forceMutexConcurrentWrites" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="writeFooterOnArchivingOnly" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
@ -1039,6 +1132,7 @@
|
||||
<xs:element name="networkWrites" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="openFileCacheSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="openFileCacheTimeout" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="bufferSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="autoFlush" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="concurrentWriteAttemptDelay" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
@ -1119,6 +1213,11 @@
|
||||
<xs:documentation>Cleanup invalid values in a filename, e.g. slashes in a filename. If set to true, this can impact the performance of massive writes. If set to false, nothing gets written when the filename is wrong.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="discardAll" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Whether or not this target should just discard all data that its asked to write. Mostly used for when testing NLog Stack except final write</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="fileNameKind" type="NLog.Targets.FilePathKind">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Is the an absolute or relative path?</xs:documentation>
|
||||
@ -1204,6 +1303,11 @@
|
||||
<xs:documentation>Maximum number of seconds that files are kept open. If this number is negative the files are not automatically closed after a period of inactivity.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="bufferSize" type="xs:integer">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Log file buffer size in bytes.</xs:documentation>
|
||||
@ -1243,6 +1347,13 @@
|
||||
<xs:enumeration value="Day" />
|
||||
<xs:enumeration value="Hour" />
|
||||
<xs:enumeration value="Minute" />
|
||||
<xs:enumeration value="Sunday" />
|
||||
<xs:enumeration value="Monday" />
|
||||
<xs:enumeration value="Tuesday" />
|
||||
<xs:enumeration value="Wednesday" />
|
||||
<xs:enumeration value="Thursday" />
|
||||
<xs:enumeration value="Friday" />
|
||||
<xs:enumeration value="Saturday" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="NLog.Targets.FilePathKind">
|
||||
@ -1278,6 +1389,7 @@
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="condition" minOccurs="0" maxOccurs="1" type="Condition" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -1289,6 +1401,11 @@
|
||||
<xs:documentation>Condition expression. Log events who meet this condition will be forwarded to the wrapped target.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -1304,6 +1421,7 @@
|
||||
<xs:element name="password" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="revertToSelf" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="userName" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -1345,6 +1463,11 @@
|
||||
<xs:documentation>Username to change context to.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -1378,6 +1501,7 @@
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="interval" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="messageLimit" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -1394,6 +1518,11 @@
|
||||
<xs:documentation>Maximum allowed number of messages written per .</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -1409,6 +1538,7 @@
|
||||
<xs:element name="includeEventProperties" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="parameter" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.MethodCallParameter" />
|
||||
<xs:element name="useBinaryEncoding" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -1445,6 +1575,11 @@
|
||||
<xs:documentation>Indicates whether to use binary message encoding.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -1487,9 +1622,10 @@
|
||||
<xs:element name="body" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="subject" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="from" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="replaceNewlineWithBrTagInHtml" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="priority" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="timeout" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="priority" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="replaceNewlineWithBrTagInHtml" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="smtpServer" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="smtpAuthentication" minOccurs="0" maxOccurs="1" type="NLog.Targets.SmtpAuthenticationMode" />
|
||||
<xs:element name="smtpUserName" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
@ -1565,9 +1701,9 @@
|
||||
<xs:documentation>Sender's email address (e.g. joe@domain.com).</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="replaceNewlineWithBrTagInHtml" type="xs:boolean">
|
||||
<xs:attribute name="timeout" type="xs:integer">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether NewLine characters in the body should be replaced with tags.</xs:documentation>
|
||||
<xs:documentation>Indicates the SMTP client timeout.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="priority" type="SimpleLayoutAttribute">
|
||||
@ -1575,9 +1711,14 @@
|
||||
<xs:documentation>Priority used for sending mails.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="timeout" type="xs:integer">
|
||||
<xs:attribute name="replaceNewlineWithBrTagInHtml" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates the SMTP client timeout.</xs:documentation>
|
||||
<xs:documentation>Indicates whether NewLine characters in the body should be replaced with tags.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="smtpServer" type="SimpleLayoutAttribute">
|
||||
@ -1648,6 +1789,7 @@
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="layout" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -1659,6 +1801,11 @@
|
||||
<xs:documentation>Layout used to format log messages.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -1671,6 +1818,7 @@
|
||||
<xs:element name="encoding" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="useXmlEncoding" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="checkIfQueueExists" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="createQueueIfNotExists" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="label" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="queue" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
@ -1701,6 +1849,11 @@
|
||||
<xs:documentation>Indicates whether to check if a queue exists before writing to it.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="createQueueIfNotExists" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether to create the queue if it doesn't exists.</xs:documentation>
|
||||
@ -1732,6 +1885,7 @@
|
||||
<xs:element name="className" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="methodName" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="parameter" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.MethodCallParameter" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -1748,6 +1902,11 @@
|
||||
<xs:documentation>Method name. The method must be public and static. Use the AssemblyQualifiedName , https://msdn.microsoft.com/en-us/library/system.type.assemblyqualifiedname(v=vs.110).aspx e.g.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -1768,6 +1927,7 @@
|
||||
<xs:element name="keepConnection" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="maxConnections" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="maxQueueSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -1834,6 +1994,11 @@
|
||||
<xs:documentation>Maximum queue size.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -1849,19 +2014,20 @@
|
||||
<xs:element name="newLine" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="onConnectionOverflow" minOccurs="0" maxOccurs="1" type="NLog.Targets.NetworkTargetConnectionsOverflowAction" />
|
||||
<xs:element name="onOverflow" minOccurs="0" maxOccurs="1" type="NLog.Targets.NetworkTargetOverflowAction" />
|
||||
<xs:element name="maxConnections" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="keepConnection" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="connectionCacheSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="maxConnections" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="address" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="maxQueueSize" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="includeSourceInfo" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="ndcItemSeparator" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="parameter" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.NLogViewerParameterInfo" />
|
||||
<xs:element name="includeMdc" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="includeSourceInfo" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="includeNLogData" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="includeNdc" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="includeCallSite" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="appInfo" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="includeNLogData" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="includeMdc" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="ndcItemSeparator" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -1903,6 +2069,11 @@
|
||||
<xs:documentation>Action that should be taken if the message is larger than maxMessageSize.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="maxConnections" type="xs:integer">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Maximum current connections. 0 = no maximum.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="keepConnection" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether to keep connection open whenever possible.</xs:documentation>
|
||||
@ -1913,11 +2084,6 @@
|
||||
<xs:documentation>Size of the connection cache (number of connections which are kept alive).</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="maxConnections" type="xs:integer">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Maximum current connections. 0 = no maximum.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="address" type="SimpleLayoutAttribute">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Network address.</xs:documentation>
|
||||
@ -1928,14 +2094,19 @@
|
||||
<xs:documentation>Maximum queue size.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="includeMdc" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether to include dictionary contents.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="includeSourceInfo" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether to include source info (file name and line number) in the information sent over the network.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ndcItemSeparator" type="xs:string">
|
||||
<xs:attribute name="includeNLogData" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>NDC item separator.</xs:documentation>
|
||||
<xs:documentation>Indicates whether to include NLog-specific extensions to log4j schema.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="includeNdc" type="xs:boolean">
|
||||
@ -1953,14 +2124,14 @@
|
||||
<xs:documentation>AppInfo field. By default it's the friendly name of the current AppDomain.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="includeNLogData" type="xs:boolean">
|
||||
<xs:attribute name="ndcItemSeparator" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether to include NLog-specific extensions to log4j schema.</xs:documentation>
|
||||
<xs:documentation>NDC item separator.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="includeMdc" type="xs:boolean">
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Indicates whether to include dictionary contents.</xs:documentation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
@ -1973,6 +2144,7 @@
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="layout" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="formatMessage" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -1989,6 +2161,11 @@
|
||||
<xs:documentation>Indicates whether to perform layout calculation.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -1998,6 +2175,7 @@
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="layout" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -2009,6 +2187,11 @@
|
||||
<xs:documentation>Layout used to format log messages.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -2024,6 +2207,7 @@
|
||||
<xs:element name="counterType" minOccurs="0" maxOccurs="1" type="System.Diagnostics.PerformanceCounterType" />
|
||||
<xs:element name="incrementValue" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="instanceName" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -2065,6 +2249,11 @@
|
||||
<xs:documentation>Performance counter instance name.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -2107,6 +2296,7 @@
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="defaultFilter" minOccurs="0" maxOccurs="1" type="Condition" />
|
||||
<xs:element name="when" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.Wrappers.FilteringRule" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -2118,6 +2308,11 @@
|
||||
<xs:documentation>Default filter to be applied when no specific rule matches.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -2142,12 +2337,18 @@
|
||||
<xs:extension base="CompoundTargetBase">
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Name of the target.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -2156,6 +2357,7 @@
|
||||
<xs:extension base="WrapperTargetBase">
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="repeatCount" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
@ -2163,6 +2365,11 @@
|
||||
<xs:documentation>Name of the target.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="repeatCount" type="xs:integer">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Number of times to repeat each log message.</xs:documentation>
|
||||
@ -2176,6 +2383,7 @@
|
||||
<xs:extension base="WrapperTargetBase">
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="retryCount" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
<xs:element name="retryDelayMilliseconds" minOccurs="0" maxOccurs="1" type="xs:integer" />
|
||||
</xs:choice>
|
||||
@ -2184,6 +2392,11 @@
|
||||
<xs:documentation>Name of the target.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="retryCount" type="xs:integer">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Number of retries that should be attempted on the wrapped target in case of a failure.</xs:documentation>
|
||||
@ -2202,12 +2415,18 @@
|
||||
<xs:extension base="CompoundTargetBase">
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Name of the target.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -2216,12 +2435,18 @@
|
||||
<xs:extension base="CompoundTargetBase">
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Name of the target.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -2231,6 +2456,7 @@
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="layout" minOccurs="0" maxOccurs="1" type="Layout" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:string">
|
||||
<xs:annotation>
|
||||
@ -2242,6 +2468,11 @@
|
||||
<xs:documentation>Layout used to format log messages.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
@ -2252,6 +2483,7 @@
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="includeBOM" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="parameter" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.MethodCallParameter" />
|
||||
<xs:element name="optimizeBufferReuse" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="encoding" minOccurs="0" maxOccurs="1" type="xs:string" />
|
||||
<xs:element name="escapeDataNLogLegacy" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
<xs:element name="escapeDataRfc3986" minOccurs="0" maxOccurs="1" type="xs:boolean" />
|
||||
@ -2272,6 +2504,11 @@
|
||||
<xs:documentation>Should we include the BOM (Byte-order-mark) for UTF? Influences the property. This will only work for UTF-8.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="optimizeBufferReuse" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="encoding" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Encoding.</xs:documentation>
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Interfaces
|
||||
namespace Artemis.Profiles.Layers.Abstract
|
||||
{
|
||||
public interface ILayerCondition
|
||||
{
|
||||
bool ConditionsMet(LayerModel layerModel, ModuleDataModel dataModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,34 +2,49 @@
|
||||
using System.Windows.Media;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Betwixt;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Animations
|
||||
{
|
||||
public class PulseAnimation : ILayerAnimation
|
||||
{
|
||||
private bool _increase = true;
|
||||
|
||||
private Tweener<float> _opacityTweener = new Tweener<float>(0, 1000, 1000, Ease.Quad.InOut, LerpFuncFloat);
|
||||
public string Name => "Pulse";
|
||||
|
||||
public void Update(LayerModel layerModel, bool updateAnimations)
|
||||
{
|
||||
var animationSpeed = 3.1 - layerModel.Properties.AnimationSpeed;
|
||||
// TODO: Generic implementation
|
||||
// Reset animation progress if layer wasn't drawn for 100ms
|
||||
if ((new TimeSpan(0, 0, 0, 0, 100) < DateTime.Now - layerModel.LastRender) && updateAnimations)
|
||||
layerModel.AnimationProgress = 0;
|
||||
if (new TimeSpan(0, 0, 0, 0, 100) < DateTime.Now - layerModel.LastRender && updateAnimations || MustExpire(layerModel))
|
||||
{
|
||||
_opacityTweener = new Tweener<float>(0, 1000, animationSpeed * 1000, Ease.Quad.InOut, LerpFuncFloat);
|
||||
_increase = true;
|
||||
}
|
||||
|
||||
var progress = layerModel.AnimationProgress;
|
||||
// Update animation progress
|
||||
if (!updateAnimations)
|
||||
return;
|
||||
|
||||
if (MustExpire(layerModel))
|
||||
progress = 0;
|
||||
progress = progress + layerModel.Properties.AnimationSpeed/2;
|
||||
if (!_opacityTweener.Running && _increase)
|
||||
{
|
||||
_opacityTweener = new Tweener<float>(1000, 0, animationSpeed * 1000, Ease.Quad.InOut, LerpFuncFloat);
|
||||
_increase = false;
|
||||
}
|
||||
|
||||
// If not previewing, store the animation progress in the actual model for the next frame
|
||||
if (updateAnimations)
|
||||
layerModel.AnimationProgress = progress;
|
||||
_opacityTweener.Update(40);
|
||||
|
||||
if (_increase)
|
||||
layerModel.AnimationProgress = _opacityTweener.Value / 1000;
|
||||
else
|
||||
layerModel.AnimationProgress = 1 + (1 - _opacityTweener.Value / 1000);
|
||||
}
|
||||
|
||||
public void Draw(LayerModel layerModel, DrawingContext c, int drawScale)
|
||||
{
|
||||
if (layerModel.Brush == null)
|
||||
if (layerModel.Brush == null || _opacityTweener == null)
|
||||
return;
|
||||
|
||||
// Set up variables for this frame
|
||||
@ -41,7 +56,7 @@ namespace Artemis.Profiles.Layers.Animations
|
||||
|
||||
// Can't meddle with the original brush because it's frozen.
|
||||
var brush = layerModel.Brush.Clone();
|
||||
brush.Opacity = (Math.Sin(layerModel.AnimationProgress*Math.PI) + 1)*(layerModel.Opacity/2);
|
||||
brush.Opacity = _opacityTweener.Value / 1000;
|
||||
layerModel.Brush = brush;
|
||||
|
||||
c.PushClip(new RectangleGeometry(clip));
|
||||
@ -49,6 +64,11 @@ namespace Artemis.Profiles.Layers.Animations
|
||||
c.Pop();
|
||||
}
|
||||
|
||||
public bool MustExpire(LayerModel layer) => layer.AnimationProgress > 2;
|
||||
public bool MustExpire(LayerModel layer) => layer.AnimationProgress >= 2;
|
||||
|
||||
private static float LerpFuncFloat(float start, float end, float percent)
|
||||
{
|
||||
return start + (end - start) * percent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Animations
|
||||
{
|
||||
public class RotateClockwiseAnimation : ILayerAnimation
|
||||
{
|
||||
public string Name => "Rotate clockwise";
|
||||
|
||||
public void Update(LayerModel layerModel, bool updateAnimations)
|
||||
{
|
||||
var progress = layerModel.AnimationProgress;
|
||||
|
||||
if (MustExpire(layerModel))
|
||||
progress = 0;
|
||||
progress = progress + layerModel.Properties.AnimationSpeed / 2.5;
|
||||
|
||||
// If not previewing, store the animation progress in the actual model for the next frame
|
||||
if (updateAnimations)
|
||||
layerModel.AnimationProgress = progress;
|
||||
}
|
||||
|
||||
public void Draw(LayerModel layerModel, DrawingContext c, int drawScale)
|
||||
{
|
||||
if (layerModel.Brush == null)
|
||||
return;
|
||||
|
||||
// Set up variables for this frame
|
||||
var fillRect = layerModel.Properties.PropertiesRect(drawScale);
|
||||
var fillSize = Math.Sqrt(fillRect.Width * fillRect.Width + fillRect.Height * fillRect.Height);
|
||||
fillRect.Inflate(fillSize - fillRect.Width, fillSize - fillRect.Height);
|
||||
|
||||
var clip = layerModel.LayerRect(drawScale);
|
||||
|
||||
c.PushClip(new RectangleGeometry(clip));
|
||||
c.PushTransform(new RotateTransform(36 * layerModel.AnimationProgress, fillRect.X + fillRect.Width / 2, fillRect.Y + fillRect.Height / 2));
|
||||
c.DrawRectangle(layerModel.Brush, null, fillRect);
|
||||
c.Pop();
|
||||
c.Pop();
|
||||
}
|
||||
|
||||
public bool MustExpire(LayerModel layer) => layer.AnimationProgress >= 10;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Animations
|
||||
{
|
||||
public class RotateCounterclockwiseAnimation : ILayerAnimation
|
||||
{
|
||||
public string Name => "Rotate counterclockwise";
|
||||
|
||||
public void Update(LayerModel layerModel, bool updateAnimations)
|
||||
{
|
||||
var progress = layerModel.AnimationProgress;
|
||||
|
||||
if (MustExpire(layerModel))
|
||||
progress = 0;
|
||||
progress = progress + layerModel.Properties.AnimationSpeed / 2.5;
|
||||
|
||||
// If not previewing, store the animation progress in the actual model for the next frame
|
||||
if (updateAnimations)
|
||||
layerModel.AnimationProgress = progress;
|
||||
}
|
||||
|
||||
public void Draw(LayerModel layerModel, DrawingContext c, int drawScale)
|
||||
{
|
||||
if (layerModel.Brush == null)
|
||||
return;
|
||||
|
||||
// Set up variables for this frame
|
||||
var fillRect = layerModel.Properties.PropertiesRect(drawScale);
|
||||
var fillSize = Math.Sqrt(fillRect.Width * fillRect.Width + fillRect.Height * fillRect.Height);
|
||||
fillRect.Inflate(fillSize - fillRect.Width, fillSize - fillRect.Height);
|
||||
|
||||
var clip = layerModel.LayerRect(drawScale);
|
||||
|
||||
c.PushClip(new RectangleGeometry(clip));
|
||||
c.PushTransform(new RotateTransform(36 * layerModel.AnimationProgress*-1, fillRect.X + fillRect.Width / 2, fillRect.Y + fillRect.Height / 2));
|
||||
c.DrawRectangle(layerModel.Brush, null, fillRect);
|
||||
c.Pop();
|
||||
c.Pop();
|
||||
}
|
||||
|
||||
public bool MustExpire(LayerModel layer) => layer.AnimationProgress >= 10;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Animations
|
||||
{
|
||||
public class ShrinkAnimation : ILayerAnimation
|
||||
{
|
||||
public string Name => "Shrink";
|
||||
|
||||
public void Update(LayerModel layerModel, bool updateAnimations)
|
||||
{
|
||||
// TODO: Generic implementation
|
||||
// Reset animation progress if layer wasn't drawn for 100ms
|
||||
if ((new TimeSpan(0, 0, 0, 0, 100) < DateTime.Now - layerModel.LastRender) && updateAnimations)
|
||||
layerModel.AnimationProgress = 0;
|
||||
|
||||
var progress = layerModel.AnimationProgress;
|
||||
|
||||
if (MustExpire(layerModel))
|
||||
progress = 10;
|
||||
progress = progress - layerModel.Properties.AnimationSpeed/2.5;
|
||||
|
||||
// If not previewing, store the animation progress in the actual model for the next frame
|
||||
if (updateAnimations)
|
||||
layerModel.AnimationProgress = progress;
|
||||
}
|
||||
|
||||
public void Draw(LayerModel layerModel, DrawingContext c, int drawScale)
|
||||
{
|
||||
if (layerModel.Brush == null)
|
||||
return;
|
||||
|
||||
// Set up variables for this frame
|
||||
var rect = layerModel.Properties.Contain
|
||||
? layerModel.LayerRect(drawScale)
|
||||
: layerModel.Properties.PropertiesRect(drawScale);
|
||||
|
||||
var clip = layerModel.LayerRect(drawScale);
|
||||
|
||||
// Take an offset of 4 to allow layers to slightly leave their bounds
|
||||
var progress = (6.0 - layerModel.AnimationProgress)*10.0;
|
||||
if (progress < 0)
|
||||
{
|
||||
// Can't meddle with the original brush because it's frozen.
|
||||
var brush = layerModel.Brush.Clone();
|
||||
brush.Opacity = 1 + 0.025*progress;
|
||||
if (brush.Opacity < 0)
|
||||
brush.Opacity = 0;
|
||||
if (brush.Opacity > 1)
|
||||
brush.Opacity = 1;
|
||||
layerModel.Brush = brush;
|
||||
}
|
||||
rect.Inflate(-rect.Width/100.0*progress, -rect.Height/100.0*progress);
|
||||
clip.Inflate(-clip.Width/100.0*progress, -clip.Height/100.0*progress);
|
||||
|
||||
c.PushClip(new RectangleGeometry(clip));
|
||||
c.DrawRectangle(layerModel.Brush, null, rect);
|
||||
c.Pop();
|
||||
}
|
||||
|
||||
public bool MustExpire(LayerModel layer) => layer.AnimationProgress <= 0;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Abstract;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Conditions
|
||||
@ -12,18 +11,18 @@ namespace Artemis.Profiles.Layers.Conditions
|
||||
{
|
||||
lock (layerModel.Properties.Conditions)
|
||||
{
|
||||
var checkConditions = layerModel.Properties.Conditions.Where(c => c.Field != null).ToList();
|
||||
switch (layerModel.Properties.ConditionType)
|
||||
{
|
||||
case ConditionType.AnyMet:
|
||||
return layerModel.Properties.Conditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
return checkConditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
case ConditionType.AllMet:
|
||||
return layerModel.Properties.Conditions.All(cm => cm.ConditionMet(dataModel));
|
||||
return checkConditions.All(cm => cm.ConditionMet(dataModel));
|
||||
case ConditionType.NoneMet:
|
||||
return !layerModel.Properties.Conditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
default:
|
||||
return false;
|
||||
return !checkConditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,37 +1,50 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Conditions
|
||||
{
|
||||
public class EventCondition : ILayerCondition
|
||||
{
|
||||
public bool ConditionsMet(LayerModel layerModel, ModuleDataModel dataModel)
|
||||
{
|
||||
lock (layerModel.Properties.Conditions)
|
||||
{
|
||||
var conditionsMet = false;
|
||||
switch (layerModel.Properties.ConditionType)
|
||||
{
|
||||
case ConditionType.AnyMet:
|
||||
conditionsMet = layerModel.Properties.Conditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
break;
|
||||
case ConditionType.AllMet:
|
||||
conditionsMet = layerModel.Properties.Conditions.All(cm => cm.ConditionMet(dataModel));
|
||||
break;
|
||||
case ConditionType.NoneMet:
|
||||
conditionsMet = !layerModel.Properties.Conditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
break;
|
||||
}
|
||||
layerModel.EventProperties.Update(layerModel, conditionsMet);
|
||||
|
||||
if (conditionsMet && layerModel.EventProperties.CanTrigger)
|
||||
layerModel.EventProperties.TriggerEvent(layerModel);
|
||||
|
||||
return layerModel.EventProperties.MustDraw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using System.Linq;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Profiles.Layers.Abstract;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Conditions
|
||||
{
|
||||
public class EventCondition : ILayerCondition
|
||||
{
|
||||
public bool ConditionsMet(LayerModel layerModel, ModuleDataModel dataModel)
|
||||
{
|
||||
lock (layerModel.Properties.Conditions)
|
||||
{
|
||||
var checkConditions = layerModel.Properties.Conditions.Where(c => c.Field != null).ToList();
|
||||
|
||||
// Don't trigger constantly when there are no conditions
|
||||
if (!checkConditions.Any())
|
||||
{
|
||||
layerModel.EventProperties.Update(layerModel, false);
|
||||
return layerModel.EventProperties.MustDraw;
|
||||
}
|
||||
|
||||
// Determine whether conditions are met
|
||||
var conditionsMet = false;
|
||||
switch (layerModel.Properties.ConditionType)
|
||||
{
|
||||
case ConditionType.AnyMet:
|
||||
conditionsMet = checkConditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
break;
|
||||
case ConditionType.AllMet:
|
||||
conditionsMet = checkConditions.All(cm => cm.ConditionMet(dataModel));
|
||||
break;
|
||||
case ConditionType.NoneMet:
|
||||
conditionsMet = !checkConditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
break;
|
||||
}
|
||||
|
||||
// Update the event properties
|
||||
layerModel.EventProperties.Update(layerModel, conditionsMet);
|
||||
|
||||
// If conditions are met trigger the event, this won't do anything if the event isn't ready to be triggered yet
|
||||
if (conditionsMet)
|
||||
layerModel.EventProperties.TriggerEvent(layerModel);
|
||||
|
||||
// Return the event's MustDraw
|
||||
return layerModel.EventProperties.MustDraw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Timers;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Models
|
||||
@ -10,7 +11,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
public TimeSpan TriggerDelay { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public bool CanTrigger { get; set; }
|
||||
public bool CanTrigger { get; set; } = true;
|
||||
|
||||
[JsonIgnore]
|
||||
public DateTime EventTriggerTime { get; set; }
|
||||
@ -18,30 +19,46 @@ namespace Artemis.Profiles.Layers.Models
|
||||
[JsonIgnore]
|
||||
public bool MustDraw { get; set; }
|
||||
|
||||
public DateTime EventCanTriggerTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Resets the event's properties and triggers it
|
||||
/// If possible, triggers the event
|
||||
/// </summary>
|
||||
public virtual void TriggerEvent(LayerModel layer)
|
||||
{
|
||||
if (!CanTrigger)
|
||||
return;
|
||||
|
||||
// Don't allow any more triggering regardless of what happens next
|
||||
CanTrigger = false;
|
||||
|
||||
// If there is a trigger delay, stop here and await that delay
|
||||
if (TriggerDelay > TimeSpan.Zero)
|
||||
{
|
||||
if (EventCanTriggerTime == DateTime.MinValue)
|
||||
EventCanTriggerTime = DateTime.Now;
|
||||
var timer = new Timer(TriggerDelay.TotalMilliseconds) {AutoReset = false};
|
||||
timer.Elapsed += (sender, args) =>
|
||||
{
|
||||
HardTrigger(layer);
|
||||
timer.Dispose();
|
||||
};
|
||||
timer.Start();
|
||||
|
||||
if (DateTime.Now - EventCanTriggerTime < TriggerDelay)
|
||||
return;
|
||||
|
||||
EventCanTriggerTime = DateTime.MinValue;
|
||||
return;
|
||||
}
|
||||
|
||||
CanTrigger = false;
|
||||
// Trigger the event
|
||||
HardTrigger(layer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantly trigger the event regardless of current state
|
||||
/// </summary>
|
||||
/// <param name="layer"></param>
|
||||
public void HardTrigger(LayerModel layer)
|
||||
{
|
||||
MustDraw = true;
|
||||
CanTrigger = false;
|
||||
EventTriggerTime = DateTime.Now;
|
||||
|
||||
// Reset the animation in case it didn't finish before
|
||||
layer.AnimationProgress = 0.0;
|
||||
}
|
||||
|
||||
@ -60,7 +77,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
return DateTime.Now - EventTriggerTime > Length;
|
||||
}
|
||||
if (ExpirationType == ExpirationType.Animation)
|
||||
return (layer.LayerAnimation == null) || layer.LayerAnimation.MustExpire(layer);
|
||||
return layer.LayerAnimation == null || layer.LayerAnimation.MustExpire(layer);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -68,24 +85,17 @@ namespace Artemis.Profiles.Layers.Models
|
||||
// Called every frame, if parent conditions met.
|
||||
public void Update(LayerModel layerModel, bool conditionsMet)
|
||||
{
|
||||
if (EventCanTriggerTime > DateTime.MinValue && (DateTime.Now - EventCanTriggerTime > TriggerDelay))
|
||||
{
|
||||
CanTrigger = true;
|
||||
TriggerEvent(layerModel);
|
||||
// If the event isn't finished yet just keep going
|
||||
if (MustDraw && !MustStop(layerModel))
|
||||
return;
|
||||
}
|
||||
|
||||
if (MustDraw && MustStop(layerModel))
|
||||
MustDraw = false;
|
||||
// Otherwise make sure MustDraw is false
|
||||
MustDraw = false;
|
||||
|
||||
// If the conditions aren't met and the event has finished it can be triggered again
|
||||
if (!conditionsMet)
|
||||
CanTrigger = true;
|
||||
}
|
||||
|
||||
protected bool DelayExpired()
|
||||
{
|
||||
return EventCanTriggerTime > DateTime.MinValue && DateTime.Now - EventCanTriggerTime >= TriggerDelay;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ExpirationType
|
||||
@ -93,4 +103,4 @@ namespace Artemis.Profiles.Layers.Models
|
||||
Time,
|
||||
Animation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
{
|
||||
public override void TriggerEvent(LayerModel layer)
|
||||
{
|
||||
if (CanTrigger && DelayExpired())
|
||||
if (CanTrigger)
|
||||
{
|
||||
if (layer.GifImage != null)
|
||||
layer.GifImage.CurrentFrame = 0;
|
||||
@ -18,12 +18,10 @@ namespace Artemis.Profiles.Layers.Models
|
||||
|
||||
public override bool MustStop(LayerModel layer)
|
||||
{
|
||||
if (ExpirationType != ExpirationType.Animation)
|
||||
return base.MustStop(layer);
|
||||
|
||||
if (layer.LayerType is KeyboardGifType)
|
||||
if (layer.LayerType is KeyboardGifType && ExpirationType == ExpirationType.Animation)
|
||||
return layer.GifImage?.CurrentFrame >= layer.GifImage?.FrameCount - 1;
|
||||
return (layer.LayerAnimation == null) || layer.LayerAnimation.MustExpire(layer);
|
||||
|
||||
return base.MustStop(layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Globalization;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Utilities;
|
||||
using DynamicExpresso;
|
||||
using MahApps.Metro.Controls;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Models
|
||||
{
|
||||
@ -20,6 +21,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
public string Value { get; set; }
|
||||
public string Operator { get; set; }
|
||||
public string Type { get; set; }
|
||||
public HotKey HotKey { get; set; }
|
||||
|
||||
public bool ConditionMet(ModuleDataModel subject)
|
||||
{
|
||||
|
||||
126
Artemis/Artemis/Profiles/Layers/Models/LayerKeybindModel.cs
Normal file
126
Artemis/Artemis/Profiles/Layers/Models/LayerKeybindModel.cs
Normal file
@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Profiles.Layers.Conditions;
|
||||
using MahApps.Metro.Controls;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Models
|
||||
{
|
||||
public class LayerKeybindModel
|
||||
{
|
||||
private KeybindModel _downKeybind;
|
||||
private KeybindModel _upKeybind;
|
||||
|
||||
public ToggleType ToggleType { get; set; }
|
||||
public HotKey HotKey { get; set; }
|
||||
public MouseButtons? MouseButtons { get; set; }
|
||||
|
||||
public void Unregister()
|
||||
{
|
||||
if (_downKeybind != null)
|
||||
{
|
||||
KeybindManager.Remove(_downKeybind);
|
||||
_downKeybind = null;
|
||||
}
|
||||
if (_upKeybind != null)
|
||||
{
|
||||
KeybindManager.Remove(_upKeybind);
|
||||
_upKeybind = null;
|
||||
}
|
||||
}
|
||||
|
||||
internal void Register(LayerModel layerModel, int index)
|
||||
{
|
||||
Unregister();
|
||||
|
||||
if (layerModel.IsEvent)
|
||||
RegisterEvent(layerModel, index);
|
||||
else if (ToggleType == ToggleType.EnableHeldDown || ToggleType == ToggleType.DisableHeldDown)
|
||||
RegisterToggle(layerModel, index);
|
||||
else
|
||||
RegisterRegular(layerModel, index);
|
||||
}
|
||||
|
||||
private void RegisterEvent(LayerModel layerModel, int index)
|
||||
{
|
||||
Action action = () =>
|
||||
{
|
||||
layerModel.EventProperties.TriggerEvent(layerModel);
|
||||
};
|
||||
// Either bind HotKey or mouse buttons depending on what isn't null
|
||||
if (HotKey != null)
|
||||
_downKeybind = new KeybindModel($"{layerModel.GetHashCode()}-{layerModel.Name}-{index}-down", HotKey, PressType.Down, action);
|
||||
else if (MouseButtons != null)
|
||||
_downKeybind = new KeybindModel($"{layerModel.GetHashCode()}-{layerModel.Name}-{index}-down", MouseButtons.Value, PressType.Down, action);
|
||||
KeybindManager.AddOrUpdate(_downKeybind);
|
||||
}
|
||||
|
||||
private void RegisterRegular(LayerModel layerModel, int index)
|
||||
{
|
||||
// Bind Enable, Disable or Toggle
|
||||
Action action = null;
|
||||
switch (ToggleType)
|
||||
{
|
||||
case ToggleType.Enable:
|
||||
action = () => layerModel.RenderAllowed = true;
|
||||
break;
|
||||
case ToggleType.Disable:
|
||||
action = () => layerModel.RenderAllowed = false;
|
||||
break;
|
||||
case ToggleType.Toggle:
|
||||
action = () => layerModel.RenderAllowed = !layerModel.RenderAllowed;
|
||||
break;
|
||||
}
|
||||
|
||||
// Either bind HotKey or mouse buttons depending on what isn't null
|
||||
if (HotKey != null)
|
||||
_downKeybind = new KeybindModel($"{layerModel.GetHashCode()}-{layerModel.Name}-{index}-down", HotKey, PressType.Down, action);
|
||||
else if (MouseButtons != null)
|
||||
_downKeybind = new KeybindModel($"{layerModel.GetHashCode()}-{layerModel.Name}-{index}-down", MouseButtons.Value, PressType.Down, action);
|
||||
KeybindManager.AddOrUpdate(_downKeybind);
|
||||
}
|
||||
|
||||
private void RegisterToggle(LayerModel layerModel, int index)
|
||||
{
|
||||
Action downAction = null;
|
||||
Action upAction = null;
|
||||
switch (ToggleType)
|
||||
{
|
||||
case ToggleType.EnableHeldDown:
|
||||
layerModel.RenderAllowed = false;
|
||||
downAction = () => layerModel.RenderAllowed = true;
|
||||
upAction = () => layerModel.RenderAllowed = false;
|
||||
break;
|
||||
case ToggleType.DisableHeldDown:
|
||||
downAction = () => layerModel.RenderAllowed = false;
|
||||
upAction = () => layerModel.RenderAllowed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Either bind HotKey or mouse buttons depending on what isn't null
|
||||
if (HotKey != null)
|
||||
{
|
||||
_downKeybind = new KeybindModel($"{layerModel.GetHashCode()}-{layerModel.Name}-{index}-down", HotKey, PressType.Down, downAction);
|
||||
_upKeybind = new KeybindModel($"{layerModel.GetHashCode()}-{layerModel.Name}-{index}-up", HotKey, PressType.Up, upAction);
|
||||
}
|
||||
else if (MouseButtons != null)
|
||||
{
|
||||
_downKeybind = new KeybindModel($"{layerModel.GetHashCode()}-{layerModel.Name}-{index}-down", MouseButtons.Value, PressType.Down, downAction);
|
||||
_upKeybind = new KeybindModel($"{layerModel.GetHashCode()}-{layerModel.Name}-{index}-up", MouseButtons.Value, PressType.Up, upAction);
|
||||
}
|
||||
KeybindManager.AddOrUpdate(_downKeybind);
|
||||
KeybindManager.AddOrUpdate(_upKeybind);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ToggleType
|
||||
{
|
||||
Enable,
|
||||
Disable,
|
||||
Toggle,
|
||||
EnableHeldDown,
|
||||
DisableHeldDown
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Profiles.Layers.Abstract;
|
||||
using Artemis.Profiles.Layers.Animations;
|
||||
using Artemis.Profiles.Layers.Conditions;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
@ -20,10 +21,11 @@ namespace Artemis.Profiles.Layers.Models
|
||||
{
|
||||
Children = new ChildItemCollection<LayerModel, LayerModel>(this);
|
||||
TweenModel = new TweenModel(this);
|
||||
RenderAllowed = true;
|
||||
|
||||
var model = Properties as KeyboardPropertiesModel;
|
||||
if (model != null)
|
||||
GifImage = new GifImage(model.GifFile);
|
||||
GifImage = new GifImage(model.GifFile, Properties.AnimationSpeed);
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
@ -38,7 +40,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
/// </summary>
|
||||
/// <param name="dataModel"></param>
|
||||
/// <returns></returns>
|
||||
public bool ConditionsMet(ModuleDataModel dataModel)
|
||||
public bool AreConditionsMet(ModuleDataModel dataModel)
|
||||
{
|
||||
// Conditions are not even checked if the layer isn't enabled
|
||||
return Enabled && LayerCondition.ConditionsMet(this, dataModel);
|
||||
@ -91,7 +93,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
/// <param name="updateAnimations"></param>
|
||||
public void Draw(ModuleDataModel dataModel, DrawingContext c, bool preview, bool updateAnimations)
|
||||
{
|
||||
if (Brush == null)
|
||||
if (Brush == null || !preview && !RenderAllowed)
|
||||
return;
|
||||
|
||||
LayerType.Draw(this, c);
|
||||
@ -106,14 +108,12 @@ namespace Artemis.Profiles.Layers.Models
|
||||
|
||||
// If the type is an event, set it up
|
||||
if (IsEvent && EventProperties == null)
|
||||
{
|
||||
EventProperties = new KeyboardEventPropertiesModel
|
||||
{
|
||||
ExpirationType = ExpirationType.Time,
|
||||
Length = new TimeSpan(0, 0, 1),
|
||||
TriggerDelay = new TimeSpan(0)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -220,19 +220,15 @@ namespace Artemis.Profiles.Layers.Models
|
||||
if (Parent != null)
|
||||
{
|
||||
foreach (var child in Parent.Children.OrderBy(c => c.Order))
|
||||
{
|
||||
if (child.Order >= source.Order)
|
||||
child.Order++;
|
||||
}
|
||||
Parent.Children.Add(source);
|
||||
}
|
||||
else if (Profile != null)
|
||||
{
|
||||
foreach (var layer in Profile.Layers.OrderBy(l => l.Order))
|
||||
{
|
||||
if (layer.Order >= source.Order)
|
||||
layer.Order++;
|
||||
}
|
||||
Profile.Layers.Add(source);
|
||||
}
|
||||
}
|
||||
@ -246,9 +242,10 @@ namespace Artemis.Profiles.Layers.Models
|
||||
if (height < 0)
|
||||
height = 0;
|
||||
|
||||
return new Rect(X*scale, Y*scale, width*scale, height*scale);
|
||||
return new Rect(X * scale, Y * scale, width * scale, height * scale);
|
||||
}
|
||||
|
||||
// TODO: Make this and ProfileModel's GetRenderLayers the same through inheritance
|
||||
/// <summary>
|
||||
/// Generates a flat list containing all layers that must be rendered on the keyboard,
|
||||
/// the first mouse layer to be rendered and the first headset layer to be rendered
|
||||
@ -259,22 +256,22 @@ namespace Artemis.Profiles.Layers.Models
|
||||
/// <returns>A flat list containing all layers that must be rendered</returns>
|
||||
public List<LayerModel> GetRenderLayers(ModuleDataModel dataModel, bool keyboardOnly, bool ignoreConditions = false)
|
||||
{
|
||||
var layers = new List<LayerModel>();
|
||||
foreach (var layerModel in Children.OrderByDescending(l => l.Order))
|
||||
{
|
||||
if (!layerModel.Enabled || keyboardOnly && layerModel.LayerType.DrawType != DrawType.Keyboard)
|
||||
continue;
|
||||
|
||||
if (!ignoreConditions)
|
||||
{
|
||||
if (!layerModel.ConditionsMet(dataModel))
|
||||
continue;
|
||||
}
|
||||
|
||||
layers.Add(layerModel);
|
||||
layers.AddRange(layerModel.GetRenderLayers(dataModel, keyboardOnly, ignoreConditions));
|
||||
}
|
||||
|
||||
var layers = new List<LayerModel>();
|
||||
foreach (var layerModel in Children.OrderByDescending(l => l.Order))
|
||||
{
|
||||
if (!layerModel.Enabled || keyboardOnly && layerModel.LayerType.DrawType != DrawType.Keyboard)
|
||||
continue;
|
||||
|
||||
if (!ignoreConditions)
|
||||
{
|
||||
if (!layerModel.AreConditionsMet(dataModel) || !layerModel.RenderAllowed)
|
||||
continue;
|
||||
}
|
||||
|
||||
layers.Add(layerModel);
|
||||
layers.AddRange(layerModel.GetRenderLayers(dataModel, keyboardOnly, ignoreConditions));
|
||||
}
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
@ -286,6 +283,26 @@ namespace Artemis.Profiles.Layers.Models
|
||||
LayerCondition = new DataModelCondition();
|
||||
}
|
||||
|
||||
public void SetupKeybinds()
|
||||
{
|
||||
RenderAllowed = true;
|
||||
|
||||
// Clean up old keybinds
|
||||
RemoveKeybinds();
|
||||
|
||||
for (var index = 0; index < Properties.LayerKeybindModels.Count; index++)
|
||||
{
|
||||
var keybindModel = Properties.LayerKeybindModels[index];
|
||||
keybindModel.Register(this, index);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveKeybinds()
|
||||
{
|
||||
foreach (var keybindModel in Properties.LayerKeybindModels)
|
||||
keybindModel.Unregister();
|
||||
}
|
||||
|
||||
#region Properties
|
||||
|
||||
#region Layer type properties
|
||||
@ -301,6 +318,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
public string Name { get; set; }
|
||||
public int Order { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public bool RenderAllowed { get; set; }
|
||||
public bool Expanded { get; set; }
|
||||
public bool IsEvent { get; set; }
|
||||
public LayerPropertiesModel Properties { get; set; }
|
||||
@ -390,7 +408,13 @@ namespace Artemis.Profiles.Layers.Models
|
||||
get { return Profile; }
|
||||
set { Profile = value; }
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{nameof(Name)}: {Name}, {nameof(Order)}: {Order}, {nameof(X)}: {X}, {nameof(Y)}: {Y}, {nameof(Width)}: {Width}, {nameof(Height)}: {Height}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
Opacity = source.Opacity;
|
||||
AnimationSpeed = source.AnimationSpeed;
|
||||
Conditions = source.Conditions;
|
||||
LayerKeybindModels = source.LayerKeybindModels;
|
||||
ConditionType = source.ConditionType;
|
||||
DynamicProperties = source.DynamicProperties;
|
||||
Brush = source.Brush;
|
||||
@ -50,7 +51,8 @@ namespace Artemis.Profiles.Layers.Models
|
||||
public string HeightEase { get; set; }
|
||||
public string OpacityEase { get; set; }
|
||||
public ConditionType ConditionType { get; set; }
|
||||
public List<LayerConditionModel> Conditions { get; set; } = new List<LayerConditionModel>();
|
||||
public List<LayerConditionModel> Conditions { get; set; } = new List<LayerConditionModel>();
|
||||
public List<LayerKeybindModel> LayerKeybindModels { get; set; } = new List<LayerKeybindModel>();
|
||||
public List<DynamicPropertiesModel> DynamicProperties { get; set; } = new List<DynamicPropertiesModel>();
|
||||
|
||||
[JsonConverter(typeof(BrushJsonConverter))]
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
<UserControl x:Class="Artemis.Profiles.Layers.Types.AmbientLight.AmbientLightPropertiesView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:converters="clr-namespace:Artemis.Utilities.Converters"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:model="clr-namespace:Artemis.Profiles.Layers.Types.AmbientLight.Model"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:helper="clr-namespace:Artemis.Profiles.Layers.Types.AmbientLight.Helper"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="600" d:DesignWidth="500">
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:converters="clr-namespace:Artemis.Utilities.Converters"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:model="clr-namespace:Artemis.Profiles.Layers.Types.AmbientLight.Model"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:helper="clr-namespace:Artemis.Profiles.Layers.Types.AmbientLight.Helper"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="600" d:DesignWidth="500">
|
||||
|
||||
<UserControl.Resources>
|
||||
<converters:EnumDescriptionConverter x:Key="HEnumDescriptionConverter" />
|
||||
@ -29,135 +29,101 @@
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- AmbienceCreatorType -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10,13,10,10" FontSize="13.333" Text="Ambilight-Mode:"
|
||||
VerticalAlignment="Top" Height="18" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1"
|
||||
ItemsSource="{Binding Source={StaticResource AmbienceCreatorTypeValues}}"
|
||||
Margin="10,10,10,0" SelectedItem="{Binding Path=LayerModel.Properties.AmbienceCreatorType}"
|
||||
VerticalAlignment="Top" Height="22">
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="Ambilight-Mode:" VerticalAlignment="Center" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding Source={StaticResource AmbienceCreatorTypeValues}}" SelectedItem="{Binding Path=LayerModel.Properties.AmbienceCreatorType}" VerticalAlignment="Center">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={StaticResource HEnumDescriptionConverter}}" />
|
||||
<Label Content="{Binding Converter={StaticResource HEnumDescriptionConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<!-- MirrorAmount & Downsampling-->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Margin="10,13,10,10" FontSize="13.333" Text="Mirrored Amount (%):"
|
||||
Height="18" VerticalAlignment="Top" />
|
||||
<controls:NumericUpDown Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" Minimum="0" Maximum="100"
|
||||
Value="{Binding Path=LayerModel.Properties.MirroredAmount, Mode=TwoWay}"
|
||||
Margin="10,12,10,2" Height="24" />
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Mirrored Amount (%):" VerticalAlignment="Center" />
|
||||
<controls:NumericUpDown Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Minimum="0" Maximum="100" Value="{Binding Path=LayerModel.Properties.MirroredAmount, Mode=TwoWay}" Margin="0,5" />
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="2" Margin="10,13,10,10" FontSize="13.333" Text="Downsampling:"
|
||||
Height="18" VerticalAlignment="Top" />
|
||||
<controls:NumericUpDown Grid.Row="1" Grid.Column="3" VerticalAlignment="Top" Minimum="1" Maximum="20"
|
||||
Value="{Binding Path=LayerModel.Properties.Downsampling, Mode=TwoWay}"
|
||||
Margin="10,12,10,2" Height="24" />
|
||||
<Label Grid.Row="1" Grid.Column="2" Content="Downsampling:" VerticalAlignment="Center" />
|
||||
<controls:NumericUpDown Grid.Row="1" Grid.Column="3" VerticalAlignment="Center" Minimum="1" Maximum="20" Value="{Binding Path=LayerModel.Properties.Downsampling, Mode=TwoWay}" Margin="0,5" />
|
||||
|
||||
<!-- SmoothMode -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Margin="10,13,10,10" FontSize="13.333" Text="Smoothing:"
|
||||
VerticalAlignment="Top" Height="18" />
|
||||
<ComboBox Grid.Row="2" Grid.Column="1" ItemsSource="{Binding Source={StaticResource SmoothModeEnumValues}}"
|
||||
Margin="10,10,10,0" SelectedItem="{Binding Path=LayerModel.Properties.SmoothMode}"
|
||||
VerticalAlignment="Top" Height="22">
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="Smoothing:" VerticalAlignment="Center" />
|
||||
<ComboBox Grid.Row="2" Grid.Column="1" ItemsSource="{Binding Source={StaticResource SmoothModeEnumValues}}" SelectedItem="{Binding Path=LayerModel.Properties.SmoothMode}" VerticalAlignment="Center" Margin="0,5">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={StaticResource HEnumDescriptionConverter}}" />
|
||||
<Label Content="{Binding Converter={StaticResource HEnumDescriptionConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<!-- FlipMode -->
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Margin="10,13,10,10" FontSize="13.333" Text="Flip Horizontal:"
|
||||
Height="18" VerticalAlignment="Top" />
|
||||
<CheckBox Grid.Row="3" Grid.Column="1" VerticalAlignment="Top" Margin="10,12,10,2" Height="24"
|
||||
helper:CheckboxEnumFlagHelper.Value="{x:Static model:FlipMode.Horizontal}"
|
||||
helper:CheckboxEnumFlagHelper.Flags="{Binding Path=LayerModel.Properties.FlipMode}" />
|
||||
<Label Grid.Row="3" Grid.Column="0" Content="Flip Horizontal:" VerticalAlignment="Center" />
|
||||
<controls:ToggleSwitchButton Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" HorizontalAlignment="Left" Margin="0,5"
|
||||
helper:ToggleSwitchButtonEnumFlagHelper.Value="{x:Static model:FlipMode.Horizontal}"
|
||||
helper:ToggleSwitchButtonEnumFlagHelper.Flags="{Binding Path=LayerModel.Properties.FlipMode}" />
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="2" Margin="10,13,10,10" FontSize="13.333" Text="Flip Vertical:"
|
||||
Height="18" VerticalAlignment="Top" />
|
||||
<CheckBox Grid.Row="3" Grid.Column="3" VerticalAlignment="Top" Margin="10,12,10,2" Height="24"
|
||||
helper:CheckboxEnumFlagHelper.Value="{x:Static model:FlipMode.Vertical}"
|
||||
helper:CheckboxEnumFlagHelper.Flags="{Binding Path=LayerModel.Properties.FlipMode}" />
|
||||
<Label Grid.Row="3" Grid.Column="2" Content="Flip Vertical:" VerticalAlignment="Center" />
|
||||
<controls:ToggleSwitchButton Grid.Row="3" Grid.Column="3" VerticalAlignment="Center" Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" HorizontalAlignment="Left" Margin="0,5"
|
||||
helper:ToggleSwitchButtonEnumFlagHelper.Value="{x:Static model:FlipMode.Vertical}"
|
||||
helper:ToggleSwitchButtonEnumFlagHelper.Flags="{Binding Path=LayerModel.Properties.FlipMode}" />
|
||||
|
||||
<!-- Horizontal offsets -->
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Margin="10,20,10,3" FontSize="13.333" Text="Offset"
|
||||
Height="18" VerticalAlignment="Top" FontWeight="Black" />
|
||||
<Label Grid.Row="4" Grid.Column="0" Content="Offset" VerticalAlignment="Center" FontWeight="Black" />
|
||||
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Margin="10,13,10,10" FontSize="13.333" Text="Left:"
|
||||
Height="18" VerticalAlignment="Top" />
|
||||
<controls:NumericUpDown Grid.Row="5" Grid.Column="1" VerticalAlignment="Top" Minimum="0"
|
||||
Value="{Binding Path=LayerModel.Properties.OffsetLeft, Mode=TwoWay}"
|
||||
Margin="10,12,10,2" Height="24" />
|
||||
<Label Grid.Row="5" Grid.Column="0" Content="Left:" VerticalAlignment="Center" />
|
||||
<controls:NumericUpDown Grid.Row="5" Grid.Column="1" VerticalAlignment="Center" Minimum="0" Value="{Binding Path=LayerModel.Properties.OffsetLeft, Mode=TwoWay}" Margin="0,5" />
|
||||
|
||||
<TextBlock Grid.Row="5" Grid.Column="2" Margin="10,13,10,10" FontSize="13.333" Text="Right:"
|
||||
Height="18" VerticalAlignment="Top" />
|
||||
<controls:NumericUpDown Grid.Row="5" Grid.Column="3" VerticalAlignment="Top" Minimum="0"
|
||||
Value="{Binding Path=LayerModel.Properties.OffsetRight, Mode=TwoWay}"
|
||||
Margin="10,12,10,2" Height="24" />
|
||||
<Label Grid.Row="5" Grid.Column="2" Content="Right:" VerticalAlignment="Center" />
|
||||
<controls:NumericUpDown Grid.Row="5" Grid.Column="3" VerticalAlignment="Center" Minimum="0" Value="{Binding Path=LayerModel.Properties.OffsetRight, Mode=TwoWay}" Margin="0,5" />
|
||||
|
||||
<!-- Vertical offsets -->
|
||||
<TextBlock Grid.Row="6" Grid.Column="0" Margin="10,13,10,10" FontSize="13.333" Text="Top:"
|
||||
Height="18" VerticalAlignment="Top" />
|
||||
<controls:NumericUpDown Grid.Row="6" Grid.Column="1" VerticalAlignment="Top" Minimum="0"
|
||||
Value="{Binding Path=LayerModel.Properties.OffsetTop, Mode=TwoWay}" Margin="10,12,10,2"
|
||||
Height="24" />
|
||||
<Label Grid.Row="6" Grid.Column="0" Content="Top:" VerticalAlignment="Center" />
|
||||
<controls:NumericUpDown Grid.Row="6" Grid.Column="1" VerticalAlignment="Center" Minimum="0" Value="{Binding Path=LayerModel.Properties.OffsetTop, Mode=TwoWay}" Margin="0,5" />
|
||||
|
||||
<TextBlock Grid.Row="6" Grid.Column="2" Margin="10,13,10,10" FontSize="13.333" Text="Bottom:"
|
||||
Height="18" VerticalAlignment="Top" />
|
||||
<controls:NumericUpDown Grid.Row="6" Grid.Column="3" VerticalAlignment="Top" Minimum="0"
|
||||
Value="{Binding Path=LayerModel.Properties.OffsetBottom, Mode=TwoWay}"
|
||||
Margin="10,12,10,2" Height="24" />
|
||||
<Label Grid.Row="6" Grid.Column="2" Content="Bottom:" VerticalAlignment="Center" />
|
||||
<controls:NumericUpDown Grid.Row="6" Grid.Column="3" VerticalAlignment="Center" Minimum="0" Value="{Binding Path=LayerModel.Properties.OffsetBottom, Mode=TwoWay}" Margin="0,5" />
|
||||
|
||||
<!-- Horizontal BlackBar-detection -->
|
||||
<TextBlock Grid.Row="7" Grid.Column="0" Margin="10,20,10,3" FontSize="13.333" Text="Black-Bar detection"
|
||||
Height="18" VerticalAlignment="Top" FontWeight="Black" />
|
||||
<Label Grid.Row="7" Grid.Column="0" Content="Black-Bar detection" VerticalAlignment="Center" FontWeight="Black" />
|
||||
|
||||
<TextBlock Grid.Row="8" Grid.Column="0" Margin="10,13,10,10" FontSize="13.333" Text="Left:"
|
||||
Height="18" VerticalAlignment="Top" />
|
||||
<CheckBox Grid.Row="8" Grid.Column="1" VerticalAlignment="Top" Margin="10,12,10,2" Height="24"
|
||||
helper:CheckboxEnumFlagHelper.Value="{x:Static model:BlackBarDetectionMode.Left}"
|
||||
helper:CheckboxEnumFlagHelper.Flags="{Binding Path=LayerModel.Properties.BlackBarDetectionMode}" />
|
||||
|
||||
<TextBlock Grid.Row="8" Grid.Column="2" Margin="10,13,10,10" FontSize="13.333" Text="Right:"
|
||||
Height="18" VerticalAlignment="Top" />
|
||||
<CheckBox Grid.Row="8" Grid.Column="3" VerticalAlignment="Top" Margin="10,12,10,2" Height="24"
|
||||
helper:CheckboxEnumFlagHelper.Value="{x:Static model:BlackBarDetectionMode.Right}"
|
||||
helper:CheckboxEnumFlagHelper.Flags="{Binding Path=LayerModel.Properties.BlackBarDetectionMode}" />
|
||||
<Label Grid.Row="8" Grid.Column="0" Content="Left:" VerticalAlignment="Center" />
|
||||
<controls:ToggleSwitchButton Grid.Row="8" Grid.Column="1" VerticalAlignment="Center" Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" Margin="0,5"
|
||||
helper:ToggleSwitchButtonEnumFlagHelper.Value="{x:Static model:BlackBarDetectionMode.Left}"
|
||||
helper:ToggleSwitchButtonEnumFlagHelper.Flags="{Binding Path=LayerModel.Properties.BlackBarDetectionMode}" />
|
||||
|
||||
<Label Grid.Row="8" Grid.Column="2" Content="Right:" VerticalAlignment="Center" />
|
||||
<controls:ToggleSwitchButton Grid.Row="8" Grid.Column="3" VerticalAlignment="Center" Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" HorizontalAlignment="Left" Margin="0,5"
|
||||
helper:ToggleSwitchButtonEnumFlagHelper.Value="{x:Static model:BlackBarDetectionMode.Right}"
|
||||
helper:ToggleSwitchButtonEnumFlagHelper.Flags="{Binding Path=LayerModel.Properties.BlackBarDetectionMode}" />
|
||||
|
||||
<!-- Vertical BlackBar-detection -->
|
||||
<TextBlock Grid.Row="9" Grid.Column="0" Margin="10,13,10,10" FontSize="13.333" Text="Top:"
|
||||
Height="18" VerticalAlignment="Top" />
|
||||
<CheckBox Grid.Row="9" Grid.Column="1" VerticalAlignment="Top" Margin="10,12,10,2" Height="24"
|
||||
helper:CheckboxEnumFlagHelper.Value="{x:Static model:BlackBarDetectionMode.Top}"
|
||||
helper:CheckboxEnumFlagHelper.Flags="{Binding Path=LayerModel.Properties.BlackBarDetectionMode}" />
|
||||
|
||||
<TextBlock Grid.Row="9" Grid.Column="2" Margin="10,13,10,10" FontSize="13.333" Text="Bottom:"
|
||||
Height="18" VerticalAlignment="Top" />
|
||||
<CheckBox Grid.Row="9" Grid.Column="3" VerticalAlignment="Top" Margin="10,12,10,2" Height="24"
|
||||
helper:CheckboxEnumFlagHelper.Value="{x:Static model:BlackBarDetectionMode.Bottom}"
|
||||
helper:CheckboxEnumFlagHelper.Flags="{Binding Path=LayerModel.Properties.BlackBarDetectionMode}" />
|
||||
<Label Grid.Row="9" Grid.Column="0" Content="Top:" VerticalAlignment="Center" />
|
||||
<controls:ToggleSwitchButton Grid.Row="9" Grid.Column="1" VerticalAlignment="Center" Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" HorizontalAlignment="Left" Margin="0,5"
|
||||
helper:ToggleSwitchButtonEnumFlagHelper.Value="{x:Static model:BlackBarDetectionMode.Top}"
|
||||
helper:ToggleSwitchButtonEnumFlagHelper.Flags="{Binding Path=LayerModel.Properties.BlackBarDetectionMode}" />
|
||||
|
||||
<Label Grid.Row="9" Grid.Column="2" Content="Bottom:" VerticalAlignment="Center" />
|
||||
<controls:ToggleSwitchButton Grid.Row="9" Grid.Column="3" VerticalAlignment="Center" Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}" HorizontalAlignment="Left" Margin="0,5"
|
||||
helper:ToggleSwitchButtonEnumFlagHelper.Value="{x:Static model:BlackBarDetectionMode.Bottom}"
|
||||
helper:ToggleSwitchButtonEnumFlagHelper.Flags="{Binding Path=LayerModel.Properties.BlackBarDetectionMode}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,18 +1,18 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Artemis.Profiles.Layers.Types.AmbientLight.Model.Extensions;
|
||||
using MahApps.Metro.Controls;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Types.AmbientLight.Helper
|
||||
{
|
||||
public class CheckboxEnumFlagHelper
|
||||
public class ToggleSwitchButtonEnumFlagHelper
|
||||
{
|
||||
#region DependencyProperties
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public static readonly DependencyProperty FlagsProperty = DependencyProperty.RegisterAttached(
|
||||
"Flags", typeof(Enum), typeof(CheckboxEnumFlagHelper),
|
||||
"Flags", typeof(Enum), typeof(ToggleSwitchButtonEnumFlagHelper),
|
||||
new FrameworkPropertyMetadata(default(Enum), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
|
||||
FlagsChanged));
|
||||
|
||||
@ -27,7 +27,7 @@ namespace Artemis.Profiles.Layers.Types.AmbientLight.Helper
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ValueProperty = DependencyProperty.RegisterAttached(
|
||||
"Value", typeof(Enum), typeof(CheckboxEnumFlagHelper), new PropertyMetadata(default(Enum), ValueChanged));
|
||||
"Value", typeof(Enum), typeof(ToggleSwitchButtonEnumFlagHelper), new PropertyMetadata(default(Enum), ValueChanged));
|
||||
|
||||
public static void SetValue(DependencyObject element, Enum value)
|
||||
{
|
||||
@ -48,50 +48,54 @@ namespace Artemis.Profiles.Layers.Types.AmbientLight.Helper
|
||||
private static void FlagsChanged(DependencyObject dependencyObject,
|
||||
DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
|
||||
{
|
||||
UpdateTarget(dependencyObject as CheckBox, dependencyPropertyChangedEventArgs.NewValue as Enum);
|
||||
UpdateTarget(dependencyObject as ToggleSwitchButton, dependencyPropertyChangedEventArgs.NewValue as Enum);
|
||||
}
|
||||
|
||||
private static void ValueChanged(DependencyObject dependencyObject,
|
||||
DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
|
||||
{
|
||||
var checkbox = dependencyObject as CheckBox;
|
||||
if (checkbox == null) return;
|
||||
var toggleSwitchButton = dependencyObject as ToggleSwitchButton;
|
||||
if (toggleSwitchButton == null)
|
||||
return;
|
||||
|
||||
checkbox.Checked -= UpdateSource;
|
||||
checkbox.Unchecked -= UpdateSource;
|
||||
toggleSwitchButton.Checked -= UpdateSource;
|
||||
toggleSwitchButton.Unchecked -= UpdateSource;
|
||||
|
||||
if (dependencyPropertyChangedEventArgs.NewValue != null)
|
||||
{
|
||||
checkbox.Checked += UpdateSource;
|
||||
checkbox.Unchecked += UpdateSource;
|
||||
toggleSwitchButton.Checked += UpdateSource;
|
||||
toggleSwitchButton.Unchecked += UpdateSource;
|
||||
}
|
||||
|
||||
UpdateTarget(checkbox, GetFlags(checkbox));
|
||||
UpdateTarget(toggleSwitchButton, GetFlags(toggleSwitchButton));
|
||||
}
|
||||
|
||||
private static void UpdateTarget(CheckBox checkbox, Enum flags)
|
||||
private static void UpdateTarget(ToggleSwitchButton toggleSwitchButton, Enum flags)
|
||||
{
|
||||
if (checkbox == null) return;
|
||||
if (toggleSwitchButton == null)
|
||||
return;
|
||||
|
||||
var value = GetValue(checkbox);
|
||||
checkbox.IsChecked = value != null && (flags?.HasFlag(value) ?? false);
|
||||
var value = GetValue(toggleSwitchButton);
|
||||
toggleSwitchButton.IsChecked = value != null && (flags?.HasFlag(value) ?? false);
|
||||
}
|
||||
|
||||
private static void UpdateSource(object sender, RoutedEventArgs routedEventArgs)
|
||||
{
|
||||
var checkbox = sender as CheckBox;
|
||||
if (checkbox == null) return;
|
||||
var toggleSwitchButton = sender as ToggleSwitchButton;
|
||||
if (toggleSwitchButton == null)
|
||||
return;
|
||||
|
||||
var flags = GetFlags(checkbox);
|
||||
var value = GetValue(checkbox);
|
||||
if (value == null) return;
|
||||
var flags = GetFlags(toggleSwitchButton);
|
||||
var value = GetValue(toggleSwitchButton);
|
||||
if (value == null)
|
||||
return;
|
||||
|
||||
if (checkbox.IsChecked ?? false)
|
||||
SetFlags(checkbox, flags == null ? value : flags.SetFlag(value, true, flags.GetType()));
|
||||
if (toggleSwitchButton.IsChecked ?? false)
|
||||
SetFlags(toggleSwitchButton, flags == null ? value : flags.SetFlag(value, true, flags.GetType()));
|
||||
else
|
||||
SetFlags(checkbox, flags?.SetFlag(value, false, flags.GetType()));
|
||||
SetFlags(toggleSwitchButton, flags?.SetFlag(value, false, flags.GetType()));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,26 +1,26 @@
|
||||
<UserControl x:Class="Artemis.Profiles.Layers.Types.Audio.AudioPropertiesView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||
xmlns:properties="clr-namespace:Artemis.Profiles.Layers.Types.Audio"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:converters="clr-namespace:Artemis.Utilities.Converters"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="600" d:DesignWidth="500">
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||
xmlns:properties="clr-namespace:Artemis.Profiles.Layers.Types.Audio"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:converters="clr-namespace:Artemis.Utilities.Converters"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="600" d:DesignWidth="500">
|
||||
<UserControl.Resources>
|
||||
<converters:EnumDescriptionConverter x:Key="HEnumDescriptionConverter" />
|
||||
<ObjectDataProvider MethodName="GetValues"
|
||||
ObjectType="{x:Type system:Enum}"
|
||||
x:Key="MmDeviceTypeEnumValues">
|
||||
ObjectType="{x:Type system:Enum}"
|
||||
x:Key="MmDeviceTypeEnumValues">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="properties:MmDeviceType" />
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
<ObjectDataProvider MethodName="GetValues"
|
||||
ObjectType="{x:Type system:Enum}"
|
||||
x:Key="DirectionEnumValues">
|
||||
ObjectType="{x:Type system:Enum}"
|
||||
x:Key="DirectionEnumValues">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="properties:Direction" />
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
@ -28,25 +28,22 @@
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Animation -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
||||
VerticalAlignment="Center"
|
||||
Height="18" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top"
|
||||
Height="22">
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="Animation:" VerticalAlignment="Center" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="LayerAnimations" VerticalAlignment="Center" Margin="0,5">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
|
||||
@ -55,53 +52,38 @@
|
||||
</ComboBox>
|
||||
|
||||
<!-- Animation Speed -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Margin="10" FontSize="13.333" Text="Animation speed:"
|
||||
VerticalAlignment="Center" Height="18" />
|
||||
<Slider Grid.Row="0" Grid.Column="3" VerticalAlignment="Center"
|
||||
TickPlacement="None" TickFrequency="0.05"
|
||||
Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
|
||||
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
|
||||
<Label Grid.Row="0" Grid.Column="2" Content="Animation speed:" VerticalAlignment="Center" Margin="5,0,0,0" />
|
||||
<Slider Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" TickPlacement="None" TickFrequency="0.05"
|
||||
Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3" SmallChange="0" IsSnapToTickEnabled="True" Margin="0,5" />
|
||||
|
||||
<!-- Device type -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Margin="10,13,10,10" FontSize="13.333" Text="Device type:"
|
||||
Height="18" VerticalAlignment="Top" />
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Source={StaticResource MmDeviceTypeEnumValues}}"
|
||||
Margin="10,10,10,0" SelectedItem="{Binding Path=DeviceType}"
|
||||
VerticalAlignment="Top" Height="22">
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Device type:" VerticalAlignment="Center" />
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Source={StaticResource MmDeviceTypeEnumValues}}" SelectedItem="{Binding Path=DeviceType}" VerticalAlignment="Center" Margin="0,5">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={StaticResource HEnumDescriptionConverter}}" />
|
||||
<Label Content="{Binding Converter={StaticResource HEnumDescriptionConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<!-- Device -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="2" Margin="10,13,10,10" FontSize="13.333" Text="Device:"
|
||||
VerticalAlignment="Top" Height="18" />
|
||||
<ComboBox Grid.Row="1" Grid.Column="3" x:Name="Devices" Margin="10,10,10,0" VerticalAlignment="Top" />
|
||||
<Label Grid.Row="1" Grid.Column="2" Content="Device:" VerticalAlignment="Center" Margin="5,0,0,0" />
|
||||
<ComboBox Grid.Row="1" Grid.Column="3" x:Name="Devices" VerticalAlignment="Center" Margin="0,5" />
|
||||
|
||||
<!-- Colors -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
||||
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
||||
VerticalAlignment="Top" Height="18" Width="130" />
|
||||
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
||||
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" ShowNone="False" Height="24" Width="134"
|
||||
VerticalAlignment="Top" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="Color(s):" VerticalAlignment="Center" />
|
||||
<Border Grid.Row="2" Grid.Column="1" BorderBrush="{StaticResource ControlBorderBrush}" BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit" Height="26" Margin="0,5">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" ShowNone="False" VerticalAlignment="Stretch" />
|
||||
</Border>
|
||||
|
||||
<!-- Bar direction -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="2" Margin="10,13,10,10" FontSize="13.333" Text="Bar direction:"
|
||||
VerticalAlignment="Top" Height="18" />
|
||||
<ComboBox Grid.Row="2" Grid.Column="3" ItemsSource="{Binding Source={StaticResource DirectionEnumValues}}"
|
||||
Margin="10,10,10,0" SelectedItem="{Binding Path=LayerModel.Properties.Direction}"
|
||||
VerticalAlignment="Top" Height="22">
|
||||
<Label Grid.Row="2" Grid.Column="2" Content="Bar direction:" VerticalAlignment="Center" Margin="5,0,0,0" />
|
||||
<ComboBox Grid.Row="2" Grid.Column="3" ItemsSource="{Binding Source={StaticResource DirectionEnumValues}}" SelectedItem="{Binding Path=LayerModel.Properties.Direction}" VerticalAlignment="Center" Margin="0,5">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={StaticResource HEnumDescriptionConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -10,27 +10,23 @@
|
||||
<Grid>
|
||||
<!-- Colors -->
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Animation -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
||||
VerticalAlignment="Center"
|
||||
Height="18" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top"
|
||||
Height="22">
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="Animation:" VerticalAlignment="Center" Margin="0,0,5,0" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="LayerAnimations" VerticalAlignment="Center">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
|
||||
@ -39,42 +35,29 @@
|
||||
</ComboBox>
|
||||
|
||||
<!-- Animation Speed -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Margin="10" FontSize="13.333" Text="Animation speed:"
|
||||
VerticalAlignment="Center" Height="18" />
|
||||
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center"
|
||||
TickPlacement="None" TickFrequency="0.05"
|
||||
Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
|
||||
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
|
||||
<Label Grid.Row="0" Grid.Column="2" Content="Animation speed:" VerticalAlignment="Center" Margin="5,0" />
|
||||
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" TickPlacement="None" TickFrequency="0.05" Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}"
|
||||
Minimum="0.05" Maximum="3" SmallChange="0" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- ClippingType -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Margin="10, 13, 10, 10" FontSize="13.333" Text="Clipping type:"
|
||||
VerticalAlignment="Center" Height="23" />
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=LayerModel.Properties.Contain, Mode=TwoWay}"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1" OnLabel="Contain" OffLabel="Cut-off" Margin="10,1,5,1"
|
||||
VerticalAlignment="Center"
|
||||
Height="36" />
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Clipping type:" VerticalAlignment="Center" Margin="0,0,5,0" />
|
||||
<controls:ToggleSwitch Grid.Row="1" Grid.Column="1" IsChecked="{Binding Path=LayerModel.Properties.Contain, Mode=TwoWay}" OnLabel="Contain" OffLabel="Cut-off" VerticalAlignment="Center" Style="{StaticResource MahApps.Metro.Styles.ToggleSwitch.Win10}" Margin="0,10" />
|
||||
|
||||
<!-- Colors -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
||||
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
||||
VerticalAlignment="Top" Height="18" Width="130" />
|
||||
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
||||
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||
<ncore:ColorBox Brush="{Binding Brush, Mode=TwoWay}" ShowNone="False" Height="24" Width="134"
|
||||
VerticalAlignment="Top" ShowLinear="True" ShowRadial="False" ShowSolid="False" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="2" Content="Color(s):" VerticalAlignment="Center" Margin="5,0" />
|
||||
<Border Grid.Row="1" Grid.Column="3" BorderBrush="{StaticResource ControlBorderBrush}" BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit" Height="26" Margin="0,5">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" ShowNone="False" VerticalAlignment="Stretch" />
|
||||
</Border>
|
||||
|
||||
<!-- Dynamic -->
|
||||
<Label Grid.Row="3" Grid.Column="0" FontSize="20" HorizontalAlignment="Left"
|
||||
Content="Dynamic" Width="97" VerticalAlignment="Bottom" />
|
||||
<Label Grid.Row="2" Grid.Column="0" FontSize="20" Content="Dynamic" />
|
||||
|
||||
<!-- Dynamic property views -->
|
||||
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" x:Name="HeightProperties" />
|
||||
<ContentControl Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4" x:Name="WidthProperties" />
|
||||
<ContentControl Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="4" x:Name="HeightProperties" />
|
||||
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" x:Name="WidthProperties" />
|
||||
<ContentControl Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||
|
||||
<ContentControl Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="4" x:Name="LayerTweenViewModel" />
|
||||
<!-- Tweening -->
|
||||
<ContentControl Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="4" x:Name="LayerTweenViewModel" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@ -36,7 +36,7 @@ namespace Artemis.Profiles.Layers.Types.ConicalBrush
|
||||
|
||||
public ImageSource DrawThumbnail(LayerModel layer)
|
||||
{
|
||||
_conicalGradientDrawerThumbnail.GradientStops = GetGradientStops(layer.Brush).Select(x => new Tuple<double, Color>(x.Offset, x.Color)).ToList();
|
||||
_conicalGradientDrawerThumbnail.GradientStops = GetGradientStops(layer.Properties.Brush).Select(x => new Tuple<double, Color>(x.Offset, x.Color)).ToList();
|
||||
_conicalGradientDrawerThumbnail.Update();
|
||||
|
||||
Rect thumbnailRect = new Rect(0, 0, 18, 18);
|
||||
|
||||
@ -4,73 +4,57 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||
xmlns:ObjectModel="clr-namespace:System.Collections.ObjectModel;assembly=System"
|
||||
x:Class="Artemis.Profiles.Layers.Types.Generic.GenericPropertiesView"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="600" d:DesignWidth="500">
|
||||
<Grid>
|
||||
<!-- Colors -->
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Animation -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
||||
VerticalAlignment="Center"
|
||||
Height="18" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top"
|
||||
Height="22">
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="Animation:" VerticalAlignment="Center" Margin="0,0,5,0" HorizontalAlignment="Left" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="LayerAnimations" VerticalAlignment="Center">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name, Mode=OneWay}" />
|
||||
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<!-- Animation Speed -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Margin="10" FontSize="13.333" Text="Animation speed:"
|
||||
VerticalAlignment="Center" Height="18" />
|
||||
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center"
|
||||
TickPlacement="None" TickFrequency="0.05"
|
||||
Value="{Binding LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
|
||||
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
|
||||
<Label Grid.Row="0" Grid.Column="2" Content="Animation speed:" VerticalAlignment="Center" Margin="5,0" />
|
||||
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" TickPlacement="None" TickFrequency="0.05" Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}"
|
||||
Minimum="0.05" Maximum="3" SmallChange="0" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Colors -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
||||
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
||||
VerticalAlignment="Top" Height="18" Width="130" />
|
||||
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
||||
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" ShowNone="False" Height="24" Width="134"
|
||||
VerticalAlignment="Top" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Color(s):" VerticalAlignment="Center" Margin="0,0,5,0" HorizontalAlignment="Left" />
|
||||
<Border Grid.Row="1" Grid.Column="1" BorderBrush="{StaticResource ControlBorderBrush}" BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit" Height="26" Margin="0,5">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" ShowNone="False" VerticalAlignment="Stretch" />
|
||||
</Border>
|
||||
|
||||
<!-- Dynamic -->
|
||||
<Label Grid.Row="3" Grid.Column="0" FontSize="20" HorizontalAlignment="Left"
|
||||
Content="Dynamic" Width="97" VerticalAlignment="Bottom" />
|
||||
<Label Grid.Row="2" Grid.Column="0" FontSize="20" Content="Dynamic" />
|
||||
|
||||
<!-- Dynamic property views -->
|
||||
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||
|
||||
<!-- Note -->
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
|
||||
Foreground="{DynamicResource HighlightBrush}"
|
||||
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap">
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333" Foreground="{DynamicResource HighlightBrush}" VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap">
|
||||
<Run Text="Note: Generic devices are devices over which Artemis has limited control." /><LineBreak />
|
||||
<Run /><LineBreak />
|
||||
<Run Text="You can use this layer type to assign a color to all generic devices at once." /><LineBreak />
|
||||
<Run
|
||||
Text="Should your generic device have multiple LEDs, Artemis will try to take the colors from the Brush and spread them over the LEDs." />
|
||||
<Run Text="Should your generic device have multiple LEDs, Artemis will try to take the colors from the Brush and spread them over the LEDs." />
|
||||
<LineBreak /><Run /><LineBreak /><Run Text="Examples of supported generic devices:" /><LineBreak />
|
||||
<Run Text="- Logitech mice and headsets" /><LineBreak /><Run Text="- Logitech G19" /><LineBreak />
|
||||
<Run Text="- Logitech G510" /><LineBreak /><Run />
|
||||
|
||||
@ -7,26 +7,23 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<!-- Colors -->
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Animation -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
||||
VerticalAlignment="Center"
|
||||
Height="18" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top"
|
||||
Height="22">
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="Animation:" VerticalAlignment="Center" Margin="0,0,5,0" HorizontalAlignment="Left" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="LayerAnimations" VerticalAlignment="Center">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
|
||||
@ -35,35 +32,26 @@
|
||||
</ComboBox>
|
||||
|
||||
<!-- Animation Speed -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Margin="10" FontSize="13.333" Text="Animation speed:"
|
||||
VerticalAlignment="Center" Height="18" />
|
||||
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center"
|
||||
TickPlacement="None" TickFrequency="0.05"
|
||||
Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
|
||||
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
|
||||
<Label Grid.Row="0" Grid.Column="2" Content="Animation speed:" VerticalAlignment="Center" Margin="5,0" />
|
||||
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" TickPlacement="None" TickFrequency="0.05" Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}"
|
||||
Minimum="0.05" Maximum="3" SmallChange="0" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Colors -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
||||
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
||||
VerticalAlignment="Top" Height="18" Width="130" />
|
||||
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
||||
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" ShowNone="False" Height="24" Width="134"
|
||||
VerticalAlignment="Top" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Color(s):" VerticalAlignment="Center" Margin="0,0,5,0" HorizontalAlignment="Left" />
|
||||
<Border Grid.Row="1" Grid.Column="1" BorderBrush="{StaticResource ControlBorderBrush}" BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit" Height="26" Margin="0,5">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" ShowNone="False" VerticalAlignment="Stretch" />
|
||||
</Border>
|
||||
|
||||
<!-- Dynamic -->
|
||||
<Label Grid.Row="3" Grid.Column="0" FontSize="20" HorizontalAlignment="Left"
|
||||
Content="Dynamic" Width="97" VerticalAlignment="Bottom" />
|
||||
<Label Grid.Row="2" Grid.Column="0" FontSize="20" Content="Dynamic" />
|
||||
|
||||
<!-- Dynamic property views -->
|
||||
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||
|
||||
<!-- Note -->
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
|
||||
Foreground="{DynamicResource HighlightBrush}"
|
||||
Text="Note: If your headset has multiple controllable LEDs you can create a gradient. Artemis will take the colors in the gradient and assign them to the LEDs"
|
||||
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333" Foreground="{DynamicResource HighlightBrush}" VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap"
|
||||
Text="Note: If your headset has multiple controllable LEDs you can create a gradient. Artemis will take the colors in the gradient and assign them to the LEDs"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@ -12,7 +12,6 @@ using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Properties;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
using Artemis.ViewModels;
|
||||
using Artemis.ViewModels.Profiles;
|
||||
|
||||
@ -30,7 +29,7 @@ namespace Artemis.Profiles.Layers.Types.KeyPress
|
||||
_deviceManager = deviceManager;
|
||||
_keyPressLayers = new List<LayerModel>();
|
||||
|
||||
KeyboardHook.KeyDownCallback += KeyboardHookOnKeyDownCallback;
|
||||
InputHook.KeyDownCallback += KeyboardHookOnKeyDownCallback;
|
||||
}
|
||||
|
||||
public RadialGradientBrush TempBrush { get; set; }
|
||||
@ -140,6 +139,9 @@ namespace Artemis.Profiles.Layers.Types.KeyPress
|
||||
|
||||
lock (_keyPressLayers)
|
||||
{
|
||||
// Ensure the layer has keypress properties
|
||||
SetupProperties(_layerModel);
|
||||
|
||||
var properties = (KeyPressPropertiesModel) _layerModel.Properties;
|
||||
var layer = LayerModel.CreateLayer();
|
||||
layer.Properties.X = keyMatch.Value.X - properties.Scale/2;
|
||||
|
||||
@ -1,36 +1,33 @@
|
||||
<UserControl x:Class="Artemis.Profiles.Layers.Types.Keyboard.KeyboardPropertiesView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="500" d:DesignWidth="500">
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="500" d:DesignWidth="500">
|
||||
<Grid>
|
||||
<!-- Colors -->
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Animation -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
||||
VerticalAlignment="Center"
|
||||
Height="18" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top"
|
||||
Height="22">
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="Animation:" VerticalAlignment="Center" Margin="0,0,5,0" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="LayerAnimations" VerticalAlignment="Center">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
|
||||
@ -39,32 +36,19 @@
|
||||
</ComboBox>
|
||||
|
||||
<!-- Animation Speed -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Margin="10" FontSize="13.333" Text="Animation speed:"
|
||||
VerticalAlignment="Center" Height="18" />
|
||||
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center"
|
||||
TickPlacement="None" TickFrequency="0.05"
|
||||
Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
|
||||
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
|
||||
<Label Grid.Row="0" Grid.Column="2" Content="Animation speed:" VerticalAlignment="Center" Margin="5,0" />
|
||||
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" TickPlacement="None" TickFrequency="0.05" Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}"
|
||||
Minimum="0.05" Maximum="3" SmallChange="0" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- ClippingType -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Margin="10, 13, 10, 10" FontSize="13.333" Text="Clipping type:"
|
||||
VerticalAlignment="Center" Height="23" />
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=LayerModel.Properties.Contain, Mode=TwoWay}"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1" OnLabel="Contain" OffLabel="Cut-off" Margin="10,1,5,1"
|
||||
VerticalAlignment="Center"
|
||||
Height="36" />
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Clipping type:" VerticalAlignment="Center" Margin="0,0,5,0" />
|
||||
<controls:ToggleSwitch Grid.Row="1" Grid.Column="1" IsChecked="{Binding Path=LayerModel.Properties.Contain, Mode=TwoWay}" OnLabel="Contain" OffLabel="Cut-off" VerticalAlignment="Center" Style="{StaticResource MahApps.Metro.Styles.ToggleSwitch.Win10}" Margin="0,10" />
|
||||
|
||||
<!-- Colors -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
||||
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
||||
VerticalAlignment="Top" Height="18" Width="130" />
|
||||
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
||||
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" ShowNone="False" Height="24" Width="134"
|
||||
VerticalAlignment="Top" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<Label Grid.Row="1" Grid.Column="2" Content="Color(s):" VerticalAlignment="Center" Margin="5,0" />
|
||||
<Border Grid.Row="1" Grid.Column="3" BorderBrush="{StaticResource ControlBorderBrush}" BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit" Height="26" Margin="0,5">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" ShowNone="False" VerticalAlignment="Stretch" />
|
||||
</Border>
|
||||
|
||||
<!-- GIF settings -->
|
||||
<Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4" x:Name="ShowGif">
|
||||
@ -78,28 +62,25 @@
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10,5,10,0" FontSize="13.333" Text="GIF file:"
|
||||
VerticalAlignment="Top" Height="18" />
|
||||
<Grid Grid.Row="0" Grid.Column="1" ColumnSpan="3" Margin="5,2,10,0" VerticalAlignment="Top">
|
||||
<TextBox Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
||||
Text="{Binding Path=LayerModel.Properties.GifFile, Mode=TwoWay}" />
|
||||
<Button x:Name="BrowseGif" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25" Style="{DynamicResource SquareButtonStyle}" Height="25" />
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="GIF file:" VerticalAlignment="Center" />
|
||||
<Grid Grid.Row="0" Grid.Column="1" ColumnSpan="3" VerticalAlignment="Top">
|
||||
<TextBox TextWrapping="Wrap" Text="{Binding Path=LayerModel.Properties.GifFile, Mode=TwoWay}" />
|
||||
<Button x:Name="BrowseGif" Content="..." RenderTransformOrigin="-0.039,-0.944" HorizontalAlignment="Right" Width="25" Style="{DynamicResource SquareButtonStyle}" Height="25" />
|
||||
</Grid>
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
|
||||
Foreground="{DynamicResource HighlightBrush}"
|
||||
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" ><Run Text="Note: It is recommended to use very tiny gifs (25x7 per example, for size per keyboard see FAQ). "/><LineBreak/><Run Text="Any higher will degrade performance without any noticeable quality difference."/></TextBlock>
|
||||
<TextBlock Margin="5" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" Foreground="{DynamicResource HighlightBrush}" VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap">
|
||||
<Run Text="Note: It is recommended to use very tiny gifs (25x7 per example, for size per keyboard see FAQ). " /><LineBreak /><Run Text="Any higher will degrade performance without any noticeable quality difference." />
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
||||
<!-- Dynamic -->
|
||||
<Label Grid.Row="3" Grid.Column="0" FontSize="20" HorizontalAlignment="Left"
|
||||
Content="Dynamic" Width="97" VerticalAlignment="Bottom" />
|
||||
<Label Grid.Row="3" Grid.Column="0" FontSize="20" Content="Dynamic" />
|
||||
|
||||
<!-- Dynamic property views -->
|
||||
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" x:Name="HeightProperties" />
|
||||
<ContentControl Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4" x:Name="WidthProperties" />
|
||||
<ContentControl Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||
|
||||
|
||||
<!-- Tweening -->
|
||||
<ContentControl Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="4" x:Name="LayerTweenViewModel" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -42,9 +42,9 @@ namespace Artemis.Profiles.Layers.Types.KeyboardGif
|
||||
|
||||
// Only reconstruct GifImage if the underlying source has changed
|
||||
if (layerModel.GifImage == null)
|
||||
layerModel.GifImage = new GifImage(props.GifFile);
|
||||
layerModel.GifImage = new GifImage(props.GifFile, props.AnimationSpeed);
|
||||
if (layerModel.GifImage.Source != props.GifFile)
|
||||
layerModel.GifImage = new GifImage(props.GifFile);
|
||||
layerModel.GifImage = new GifImage(props.GifFile, props.AnimationSpeed);
|
||||
|
||||
var rect = new Rect(layerModel.X*4, layerModel.Y*4, layerModel.Width*4, layerModel.Height*4);
|
||||
|
||||
@ -61,6 +61,9 @@ namespace Artemis.Profiles.Layers.Types.KeyboardGif
|
||||
public void Update(LayerModel layerModel, ModuleDataModel dataModel, bool isPreview = false)
|
||||
{
|
||||
layerModel.ApplyProperties(true);
|
||||
if (layerModel.GifImage != null)
|
||||
layerModel.GifImage.AnimationSpeed = layerModel.Properties.AnimationSpeed;
|
||||
|
||||
if (isPreview || dataModel == null)
|
||||
return;
|
||||
|
||||
@ -74,7 +77,8 @@ namespace Artemis.Profiles.Layers.Types.KeyboardGif
|
||||
if (layerModel.Properties is KeyboardPropertiesModel)
|
||||
return;
|
||||
|
||||
layerModel.Properties = new KeyboardPropertiesModel(layerModel.Properties);
|
||||
// Set animation speed to 1.5, this translates back to a GIF playback rate of x1
|
||||
layerModel.Properties = new KeyboardPropertiesModel(layerModel.Properties) {AnimationSpeed = 1.5};
|
||||
}
|
||||
|
||||
public LayerPropertiesViewModel SetupViewModel(LayerEditorViewModel layerEditorViewModel,
|
||||
|
||||
@ -1,32 +1,29 @@
|
||||
<UserControl x:Class="Artemis.Profiles.Layers.Types.Mouse.MousePropertiesView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<!-- Colors -->
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Animation -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
||||
VerticalAlignment="Center"
|
||||
Height="18" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top"
|
||||
Height="22">
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="Animation:" VerticalAlignment="Center" Margin="0,0,5,0" HorizontalAlignment="Left" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="LayerAnimations" VerticalAlignment="Center">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
|
||||
@ -35,35 +32,25 @@
|
||||
</ComboBox>
|
||||
|
||||
<!-- Animation Speed -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Margin="10" FontSize="13.333" Text="Animation speed:"
|
||||
VerticalAlignment="Center" Height="18" />
|
||||
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center"
|
||||
TickPlacement="None" TickFrequency="0.05"
|
||||
Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
|
||||
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
|
||||
<Label Grid.Row="0" Grid.Column="2" Content="Animation speed:" VerticalAlignment="Center" Margin="5,0" />
|
||||
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" TickPlacement="None" TickFrequency="0.05" Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}"
|
||||
Minimum="0.05" Maximum="3" SmallChange="0" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Colors -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
||||
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
||||
VerticalAlignment="Top" Height="18" Width="130" />
|
||||
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
||||
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" ShowNone="False" Height="24" Width="134"
|
||||
VerticalAlignment="Top" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Color(s):" VerticalAlignment="Center" Margin="0,0,5,0" HorizontalAlignment="Left" />
|
||||
<Border Grid.Row="1" Grid.Column="1" BorderBrush="{StaticResource ControlBorderBrush}" BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit" Height="26" Margin="0,5">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" ShowNone="False" VerticalAlignment="Stretch" />
|
||||
</Border>
|
||||
|
||||
<!-- Dynamic -->
|
||||
<Label Grid.Row="3" Grid.Column="0" FontSize="20" HorizontalAlignment="Left"
|
||||
Content="Dynamic" Width="97" VerticalAlignment="Bottom" />
|
||||
<Label Grid.Row="2" Grid.Column="0" FontSize="20" Content="Dynamic" />
|
||||
|
||||
<!-- Dynamic property views -->
|
||||
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||
|
||||
<!-- Note -->
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
|
||||
Foreground="{DynamicResource HighlightBrush}"
|
||||
Text="Note: If your mouse has multiple controllable LEDs you can create a gradient. Artemis will take the colors in the gradient and assign them to the LEDs"
|
||||
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333" Foreground="{DynamicResource HighlightBrush}" VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap"
|
||||
Text="Note: If your mouse has multiple controllable LEDs you can create a gradient. Artemis will take the colors in the gradient and assign them to the LEDs" />
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,32 +1,29 @@
|
||||
<UserControl x:Class="Artemis.Profiles.Layers.Types.Mousemat.MousematPropertiesView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<!-- Colors -->
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Animation -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
||||
VerticalAlignment="Center"
|
||||
Height="18" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top"
|
||||
Height="22">
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="Animation:" VerticalAlignment="Center" Margin="0,0,5,0" HorizontalAlignment="Left" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="LayerAnimations" VerticalAlignment="Center">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
|
||||
@ -35,35 +32,25 @@
|
||||
</ComboBox>
|
||||
|
||||
<!-- Animation Speed -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Margin="10" FontSize="13.333" Text="Animation speed:"
|
||||
VerticalAlignment="Center" Height="18" />
|
||||
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center"
|
||||
TickPlacement="None" TickFrequency="0.05"
|
||||
Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
|
||||
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
|
||||
<Label Grid.Row="0" Grid.Column="2" Content="Animation speed:" VerticalAlignment="Center" Margin="5,0" />
|
||||
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" TickPlacement="None" TickFrequency="0.05" Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}"
|
||||
Minimum="0.05" Maximum="3" SmallChange="0" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Colors -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
||||
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
||||
VerticalAlignment="Top" Height="18" Width="130" />
|
||||
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
||||
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" ShowNone="False" Height="24" Width="134"
|
||||
VerticalAlignment="Top" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Color(s):" VerticalAlignment="Center" Margin="0,0,5,0" HorizontalAlignment="Left" />
|
||||
<Border Grid.Row="1" Grid.Column="1" BorderBrush="{StaticResource ControlBorderBrush}" BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit" Height="26" Margin="0,5">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" ShowNone="False" VerticalAlignment="Stretch" />
|
||||
</Border>
|
||||
|
||||
<!-- Dynamic -->
|
||||
<Label Grid.Row="3" Grid.Column="0" FontSize="20" HorizontalAlignment="Left"
|
||||
Content="Dynamic" Width="97" VerticalAlignment="Bottom" />
|
||||
<Label Grid.Row="2" Grid.Column="0" FontSize="20" Content="Dynamic" />
|
||||
|
||||
<!-- Dynamic property views -->
|
||||
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||
|
||||
<!-- Note -->
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
|
||||
Foreground="{DynamicResource HighlightBrush}"
|
||||
Text="Note: If your mousemat has multiple controllable LEDs you can create a gradient. Artemis will take the colors in the gradient and assign them to the LEDs"
|
||||
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333" Foreground="{DynamicResource HighlightBrush}" VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap"
|
||||
Text="Note: If your mousemat has multiple controllable LEDs you can create a gradient. Artemis will take the colors in the gradient and assign them to the LEDs" />
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -5,7 +5,7 @@ using Artemis.Events;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Profiles.Lua.Modules.Events;
|
||||
using Artemis.Profiles.Lua.Wrappers;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
using Artemis.Utilities;
|
||||
using MoonSharp.Interpreter;
|
||||
using NLog;
|
||||
|
||||
@ -23,7 +23,7 @@ namespace Artemis.Profiles.Lua.Modules
|
||||
_profileModel = luaManager.ProfileModel;
|
||||
_profileModel.OnDeviceUpdatedEvent += OnDeviceUpdatedEvent;
|
||||
_profileModel.OnDeviceDrawnEvent += OnDeviceDrawnEvent;
|
||||
KeyboardHook.KeyDownCallback += KeyboardHookOnKeyDownCallback;
|
||||
InputHook.KeyDownCallback += KeyboardHookOnKeyDownCallback;
|
||||
}
|
||||
|
||||
public override string ModuleName => "Events";
|
||||
@ -118,7 +118,7 @@ namespace Artemis.Profiles.Lua.Modules
|
||||
{
|
||||
_profileModel.OnDeviceUpdatedEvent -= OnDeviceUpdatedEvent;
|
||||
_profileModel.OnDeviceDrawnEvent -= OnDeviceDrawnEvent;
|
||||
KeyboardHook.KeyDownCallback -= KeyboardHookOnKeyDownCallback;
|
||||
InputHook.KeyDownCallback -= KeyboardHookOnKeyDownCallback;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
95
Artemis/Artemis/Profiles/Lua/Modules/LuaKeybindModule.cs
Normal file
95
Artemis/Artemis/Profiles/Lua/Modules/LuaKeybindModule.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Input;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using MahApps.Metro.Controls;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Profiles.Lua.Modules
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class LuaKeybindModule : LuaModule
|
||||
{
|
||||
private readonly List<KeybindModel> _keybindModels;
|
||||
|
||||
public LuaKeybindModule(LuaManager luaManager) : base(luaManager)
|
||||
{
|
||||
_keybindModels = new List<KeybindModel>();
|
||||
LuaManager.ProfileModel.OnProfileUpdatedEvent += ProfileModelOnOnProfileUpdatedEvent;
|
||||
}
|
||||
|
||||
public override string ModuleName => "Keybind";
|
||||
|
||||
private void ProfileModelOnOnProfileUpdatedEvent(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var keybindModel in _keybindModels)
|
||||
KeybindManager.AddOrUpdate(keybindModel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a keybind to call the provided function
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the keybind</param>
|
||||
/// <param name="hotKey">Hotkey in string format, per example: ALT+CTRL+SHIFT+D</param>
|
||||
/// <param name="pressType">The key type, either key up or key down</param>
|
||||
/// <param name="function">LUA function to call</param>
|
||||
/// <param name="args">Optional arguments for the passed function</param>
|
||||
public void SetKeybind(string name, string hotKey, PressType pressType, DynValue function, params DynValue[] args)
|
||||
{
|
||||
if (pressType != PressType.Down && pressType != PressType.Up)
|
||||
throw new ScriptRuntimeException("Key type must either be Down or Up.");
|
||||
|
||||
var modifierKeys = ModifierKeys.None;
|
||||
var key = Key.System;
|
||||
var hotKeyParts = hotKey.Split('+').Select(p => p.Trim());
|
||||
foreach (var hotKeyPart in hotKeyParts)
|
||||
if (hotKeyPart == "ALT")
|
||||
modifierKeys |= ModifierKeys.Alt;
|
||||
else if (hotKeyPart == "CTRL")
|
||||
modifierKeys |= ModifierKeys.Control;
|
||||
else if (hotKeyPart == "SHIFT")
|
||||
modifierKeys |= ModifierKeys.Shift;
|
||||
else
|
||||
Enum.TryParse(hotKeyPart, true, out key);
|
||||
|
||||
if (key == Key.System)
|
||||
throw new ScriptRuntimeException($"Hotkey '{hotKey}' couldn't be parsed.");
|
||||
|
||||
var hk = new HotKey(key, modifierKeys);
|
||||
var model = args != null
|
||||
? new KeybindModel("LUA-" + name, hk, pressType, () => LuaManager.Call(function, args))
|
||||
: new KeybindModel("LUA-" + name, hk, pressType, () => LuaManager.Call(function));
|
||||
|
||||
KeybindManager.AddOrUpdate(model);
|
||||
|
||||
var existing = _keybindModels.FirstOrDefault(k => k.Name == model.Name);
|
||||
if (existing != null)
|
||||
_keybindModels.Remove(existing);
|
||||
|
||||
_keybindModels.Add(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If found, removes a keybind with the given name
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public void RemoveKeybind(string name)
|
||||
{
|
||||
var existing = _keybindModels.FirstOrDefault(k => k.Name == name);
|
||||
if (existing != null)
|
||||
_keybindModels.Remove(existing);
|
||||
|
||||
KeybindManager.Remove(name);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
foreach (var keybindModel in _keybindModels)
|
||||
KeybindManager.Remove(keybindModel);
|
||||
|
||||
LuaManager.ProfileModel.OnProfileUpdatedEvent -= ProfileModelOnOnProfileUpdatedEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,7 +22,7 @@ namespace Artemis.Profiles.Lua.Wrappers
|
||||
public LuaDrawWrapper(DrawingContext ctx, string updateType)
|
||||
{
|
||||
_ctx = ctx;
|
||||
_scale = updateType == "keyboard" ? 4 : 2;
|
||||
_scale = updateType == "keyboard" || updateType == "preview" ? 4 : 2;
|
||||
}
|
||||
|
||||
public void DrawEllipse(LuaBrush luaBrush, double x, double y, double height, double width)
|
||||
|
||||
@ -1,243 +1,274 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Artemis.DeviceProviders;
|
||||
using Artemis.Events;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.ParentChild;
|
||||
using Newtonsoft.Json;
|
||||
using Color = System.Windows.Media.Color;
|
||||
using Point = System.Windows.Point;
|
||||
using Size = System.Windows.Size;
|
||||
|
||||
namespace Artemis.Profiles
|
||||
{
|
||||
public class ProfileModel
|
||||
{
|
||||
private readonly char[] _invalidFileNameChars;
|
||||
|
||||
public ProfileModel()
|
||||
{
|
||||
_invalidFileNameChars = Path.GetInvalidFileNameChars();
|
||||
Layers = new ChildItemCollection<ProfileModel, LayerModel>(this);
|
||||
}
|
||||
|
||||
public ChildItemCollection<ProfileModel, LayerModel> Layers { get; }
|
||||
public string Name { get; set; }
|
||||
public bool IsDefault { get; set; }
|
||||
public string KeyboardSlug { get; set; }
|
||||
public string GameName { get; set; }
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public string LuaScript { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string Slug => new string(Name.Where(ch => !_invalidFileNameChars.Contains(ch)).ToArray());
|
||||
|
||||
public event EventHandler<ProfileDeviceEventsArg> OnDeviceUpdatedEvent;
|
||||
public event EventHandler<ProfileDeviceEventsArg> OnDeviceDrawnEvent;
|
||||
|
||||
public void FixOrder()
|
||||
{
|
||||
Layers.Sort(l => l.Order);
|
||||
for (var i = 0; i < Layers.Count; i++)
|
||||
Layers[i].Order = i;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gives all the layers and their children in a flat list
|
||||
/// </summary>
|
||||
public List<LayerModel> GetLayers()
|
||||
{
|
||||
var layers = new List<LayerModel>();
|
||||
foreach (var layerModel in Layers.OrderBy(l => l.Order))
|
||||
{
|
||||
layers.Add(layerModel);
|
||||
layers.AddRange(layerModel.GetLayers());
|
||||
}
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a flat list containing all layers that must be rendered on the keyboard,
|
||||
/// the first mouse layer to be rendered and the first headset layer to be rendered
|
||||
/// </summary>
|
||||
/// <param name="dataModel">Instance of said game data model</param>
|
||||
/// <param name="keyboardOnly">Whether or not to ignore anything but keyboards</param>
|
||||
/// <param name="ignoreConditions"></param>
|
||||
/// <returns>A flat list containing all layers that must be rendered</returns>
|
||||
public List<LayerModel> GetRenderLayers(ModuleDataModel dataModel, bool keyboardOnly,
|
||||
bool ignoreConditions = false)
|
||||
{
|
||||
var layers = new List<LayerModel>();
|
||||
foreach (var layerModel in Layers.OrderByDescending(l => l.Order))
|
||||
{
|
||||
if (!layerModel.Enabled || keyboardOnly && layerModel.LayerType.DrawType != DrawType.Keyboard)
|
||||
continue;
|
||||
|
||||
if (!ignoreConditions)
|
||||
if (!layerModel.ConditionsMet(dataModel))
|
||||
continue;
|
||||
|
||||
layers.Add(layerModel);
|
||||
layers.AddRange(layerModel.GetRenderLayers(dataModel, keyboardOnly, ignoreConditions));
|
||||
}
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw all the given layers on the given rect
|
||||
/// </summary>
|
||||
/// <param name="deviceVisualModel"></param>
|
||||
/// <param name="renderLayers">The layers to render</param>
|
||||
/// <param name="dataModel">The data model to base the layer's properties on</param>
|
||||
/// <param name="preview">Indicates wheter the layer is drawn as a preview, ignoring dynamic properties</param>
|
||||
internal void DrawLayers(DeviceVisualModel deviceVisualModel, List<LayerModel> renderLayers,
|
||||
ModuleDataModel dataModel, bool preview)
|
||||
{
|
||||
renderLayers = renderLayers.Where(rl => rl.LayerType.DrawType == deviceVisualModel.DrawType).ToList();
|
||||
if (!renderLayers.Any())
|
||||
return;
|
||||
|
||||
// Setup the DrawingVisual's size
|
||||
var c = deviceVisualModel.GetDrawingContext();
|
||||
|
||||
c.PushClip(new RectangleGeometry(deviceVisualModel.Rect));
|
||||
c.DrawRectangle(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), null, deviceVisualModel.Rect);
|
||||
|
||||
// Update the layers
|
||||
foreach (var layerModel in renderLayers)
|
||||
layerModel.Update(dataModel, preview, true);
|
||||
RaiseDeviceUpdatedEvent(new ProfileDeviceEventsArg(deviceVisualModel.DrawType, dataModel, preview, null));
|
||||
|
||||
// Draw the layers
|
||||
foreach (var layerModel in renderLayers)
|
||||
layerModel.Draw(dataModel, c, preview, true);
|
||||
RaiseDeviceDrawnEvent(new ProfileDeviceEventsArg(deviceVisualModel.DrawType, dataModel, preview, c));
|
||||
|
||||
// Remove the clip
|
||||
c.Pop();
|
||||
}
|
||||
|
||||
private void RaiseDeviceUpdatedEvent(ProfileDeviceEventsArg e)
|
||||
{
|
||||
var handler = OnDeviceUpdatedEvent;
|
||||
handler?.Invoke(this, e);
|
||||
}
|
||||
|
||||
public void RaiseDeviceDrawnEvent(ProfileDeviceEventsArg e)
|
||||
{
|
||||
var handler = OnDeviceDrawnEvent;
|
||||
handler?.Invoke(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks at all the layers wthin the profile and makes sure they are within boundaries of the given rectangle
|
||||
/// </summary>
|
||||
/// <param name="keyboardRectangle"></param>
|
||||
public void FixBoundaries(Rect keyboardRectangle)
|
||||
{
|
||||
foreach (var layer in GetLayers())
|
||||
{
|
||||
if (!layer.LayerType.ShowInEdtor)
|
||||
continue;
|
||||
|
||||
var props = layer.Properties;
|
||||
var layerRect = new Rect(new Point(props.X, props.Y), new Size(props.Width, props.Height));
|
||||
if (keyboardRectangle.Contains(layerRect))
|
||||
continue;
|
||||
|
||||
props.X = 0;
|
||||
props.Y = 0;
|
||||
layer.Properties = props;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resizes layers that are shown in the editor and match exactly the full keyboard widht and height
|
||||
/// </summary>
|
||||
/// <param name="target">The new keyboard to adjust the layers for</param>
|
||||
public void ResizeLayers(KeyboardProvider target)
|
||||
{
|
||||
foreach (var layer in GetLayers())
|
||||
{
|
||||
if (!layer.LayerType.ShowInEdtor ||
|
||||
!(Math.Abs(layer.Properties.Width - Width) < 0.01) ||
|
||||
!(Math.Abs(layer.Properties.Height - Height) < 0.01))
|
||||
continue;
|
||||
|
||||
layer.Properties.Width = target.Width;
|
||||
layer.Properties.Height = target.Height;
|
||||
}
|
||||
}
|
||||
|
||||
public void Activate(LuaManager luaManager)
|
||||
{
|
||||
luaManager.SetupLua(this);
|
||||
}
|
||||
|
||||
public void Deactivate(LuaManager luaManager)
|
||||
{
|
||||
luaManager.ClearLua();
|
||||
}
|
||||
|
||||
public LayerModel AddLayer(LayerModel afterLayer)
|
||||
{
|
||||
// Create a new layer
|
||||
var layer = LayerModel.CreateLayer();
|
||||
|
||||
if (afterLayer != null)
|
||||
{
|
||||
afterLayer.InsertAfter(layer);
|
||||
}
|
||||
else
|
||||
{
|
||||
Layers.Add(layer);
|
||||
FixOrder();
|
||||
}
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
#region Compare
|
||||
|
||||
protected bool Equals(ProfileModel other)
|
||||
{
|
||||
return string.Equals(Slug, other.Slug) &&
|
||||
string.Equals(KeyboardSlug, other.KeyboardSlug) &&
|
||||
string.Equals(GameName, other.GameName);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
if (obj.GetType() != GetType()) return false;
|
||||
return Equals((ProfileModel) obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var hashCode = Slug?.GetHashCode() ?? 0;
|
||||
hashCode = (hashCode * 397) ^ (KeyboardSlug?.GetHashCode() ?? 0);
|
||||
hashCode = (hashCode * 397) ^ (GameName?.GetHashCode() ?? 0);
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Artemis.DeviceProviders;
|
||||
using Artemis.Events;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Utilities.ParentChild;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Profiles
|
||||
{
|
||||
public class ProfileModel
|
||||
{
|
||||
private readonly char[] _invalidFileNameChars;
|
||||
private List<KeybindModel> _profileBinds;
|
||||
|
||||
public ProfileModel()
|
||||
{
|
||||
_invalidFileNameChars = Path.GetInvalidFileNameChars();
|
||||
_profileBinds = new List<KeybindModel>();
|
||||
|
||||
Layers = new ChildItemCollection<ProfileModel, LayerModel>(this);
|
||||
OnProfileUpdatedEvent += OnOnProfileUpdatedEvent;
|
||||
}
|
||||
|
||||
public ChildItemCollection<ProfileModel, LayerModel> Layers { get; }
|
||||
public string Name { get; set; }
|
||||
public bool IsDefault { get; set; }
|
||||
public string KeyboardSlug { get; set; }
|
||||
public string GameName { get; set; }
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public string LuaScript { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string Slug => new string(Name.Where(ch => !_invalidFileNameChars.Contains(ch)).ToArray());
|
||||
|
||||
private void OnOnProfileUpdatedEvent(object sender, EventArgs e)
|
||||
{
|
||||
ClearKeybinds();
|
||||
ApplyKeybinds();
|
||||
}
|
||||
|
||||
public event EventHandler<ProfileDeviceEventsArg> OnDeviceUpdatedEvent;
|
||||
public event EventHandler<ProfileDeviceEventsArg> OnDeviceDrawnEvent;
|
||||
public event EventHandler<EventArgs> OnProfileUpdatedEvent;
|
||||
|
||||
public void FixOrder()
|
||||
{
|
||||
Layers.Sort(l => l.Order);
|
||||
for (var i = 0; i < Layers.Count; i++)
|
||||
Layers[i].Order = i;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gives all the layers and their children in a flat list
|
||||
/// </summary>
|
||||
public List<LayerModel> GetLayers()
|
||||
{
|
||||
var layers = new List<LayerModel>();
|
||||
foreach (var layerModel in Layers.OrderBy(l => l.Order))
|
||||
{
|
||||
layers.Add(layerModel);
|
||||
layers.AddRange(layerModel.GetLayers());
|
||||
}
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
// TODO: Make this and LayerModel's GetRenderLayers the same through inheritance
|
||||
/// <summary>
|
||||
/// Generates a flat list containing all layers that must be rendered on the keyboard,
|
||||
/// the first mouse layer to be rendered and the first headset layer to be rendered
|
||||
/// </summary>
|
||||
/// <param name="dataModel">Instance of said game data model</param>
|
||||
/// <param name="keyboardOnly">Whether or not to ignore anything but keyboards</param>
|
||||
/// <param name="ignoreConditions"></param>
|
||||
/// <returns>A flat list containing all layers that must be rendered</returns>
|
||||
public List<LayerModel> GetRenderLayers(ModuleDataModel dataModel, bool keyboardOnly, bool ignoreConditions = false)
|
||||
{
|
||||
var layers = new List<LayerModel>();
|
||||
foreach (var layerModel in Layers.OrderByDescending(l => l.Order))
|
||||
{
|
||||
if (!layerModel.Enabled || keyboardOnly && layerModel.LayerType.DrawType != DrawType.Keyboard)
|
||||
continue;
|
||||
|
||||
if (!ignoreConditions)
|
||||
{
|
||||
if (!layerModel.AreConditionsMet(dataModel) || !layerModel.RenderAllowed)
|
||||
continue;
|
||||
}
|
||||
|
||||
layers.Add(layerModel);
|
||||
layers.AddRange(layerModel.GetRenderLayers(dataModel, keyboardOnly, ignoreConditions));
|
||||
}
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw all the given layers on the given rect
|
||||
/// </summary>
|
||||
/// <param name="deviceVisualModel"></param>
|
||||
/// <param name="renderLayers">The layers to render</param>
|
||||
/// <param name="dataModel">The data model to base the layer's properties on</param>
|
||||
/// <param name="preview">Indicates wheter the layer is drawn as a preview, ignoring dynamic properties</param>
|
||||
internal void DrawLayers(DeviceVisualModel deviceVisualModel, List<LayerModel> renderLayers, ModuleDataModel dataModel, bool preview)
|
||||
{
|
||||
renderLayers = renderLayers.Where(rl => rl.LayerType.DrawType == deviceVisualModel.DrawType).ToList();
|
||||
if (!renderLayers.Any())
|
||||
return;
|
||||
|
||||
// Setup the DrawingVisual's size
|
||||
var c = deviceVisualModel.GetDrawingContext();
|
||||
|
||||
c.PushClip(new RectangleGeometry(deviceVisualModel.Rect));
|
||||
c.DrawRectangle(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), null, deviceVisualModel.Rect);
|
||||
|
||||
// Update the layers
|
||||
foreach (var layerModel in renderLayers)
|
||||
layerModel.Update(dataModel, preview, true);
|
||||
RaiseDeviceUpdatedEvent(new ProfileDeviceEventsArg(deviceVisualModel.DrawType, dataModel, preview, null));
|
||||
|
||||
// Draw the layers
|
||||
foreach (var layerModel in renderLayers)
|
||||
layerModel.Draw(dataModel, c, preview, true);
|
||||
RaiseDeviceDrawnEvent(new ProfileDeviceEventsArg(deviceVisualModel.DrawType, dataModel, preview, c));
|
||||
|
||||
// Remove the clip
|
||||
c.Pop();
|
||||
}
|
||||
|
||||
private void RaiseDeviceUpdatedEvent(ProfileDeviceEventsArg e)
|
||||
{
|
||||
OnDeviceUpdatedEvent?.Invoke(this, e);
|
||||
}
|
||||
|
||||
public void RaiseDeviceDrawnEvent(ProfileDeviceEventsArg e)
|
||||
{
|
||||
OnDeviceDrawnEvent?.Invoke(this, e);
|
||||
}
|
||||
|
||||
public virtual void OnOnProfileUpdatedEvent()
|
||||
{
|
||||
OnProfileUpdatedEvent?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks at all the layers wthin the profile and makes sure they are within boundaries of the given rectangle
|
||||
/// </summary>
|
||||
/// <param name="keyboardRectangle"></param>
|
||||
public void FixBoundaries(Rect keyboardRectangle)
|
||||
{
|
||||
foreach (var layer in GetLayers())
|
||||
{
|
||||
if (!layer.LayerType.ShowInEdtor)
|
||||
continue;
|
||||
|
||||
var props = layer.Properties;
|
||||
var layerRect = new Rect(new Point(props.X, props.Y), new Size(props.Width, props.Height));
|
||||
if (keyboardRectangle.Contains(layerRect))
|
||||
continue;
|
||||
|
||||
props.X = 0;
|
||||
props.Y = 0;
|
||||
layer.Properties = props;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resizes layers that are shown in the editor and match exactly the full keyboard widht and height
|
||||
/// </summary>
|
||||
/// <param name="target">The new keyboard to adjust the layers for</param>
|
||||
public void ResizeLayers(KeyboardProvider target)
|
||||
{
|
||||
foreach (var layer in GetLayers())
|
||||
{
|
||||
if (!layer.LayerType.ShowInEdtor ||
|
||||
!(Math.Abs(layer.Properties.Width - Width) < 0.01) ||
|
||||
!(Math.Abs(layer.Properties.Height - Height) < 0.01))
|
||||
continue;
|
||||
|
||||
layer.Properties.Width = target.Width;
|
||||
layer.Properties.Height = target.Height;
|
||||
}
|
||||
}
|
||||
|
||||
public void Activate(LuaManager luaManager)
|
||||
{
|
||||
ApplyKeybinds();
|
||||
luaManager.SetupLua(this);
|
||||
}
|
||||
|
||||
public void Deactivate(LuaManager luaManager)
|
||||
{
|
||||
ClearKeybinds();
|
||||
luaManager.ClearLua();
|
||||
}
|
||||
|
||||
public LayerModel AddLayer(LayerModel afterLayer)
|
||||
{
|
||||
// Create a new layer
|
||||
var layer = LayerModel.CreateLayer();
|
||||
|
||||
if (afterLayer != null)
|
||||
afterLayer.InsertAfter(layer);
|
||||
else
|
||||
{
|
||||
Layers.Add(layer);
|
||||
FixOrder();
|
||||
}
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
public void ApplyKeybinds()
|
||||
{
|
||||
foreach (var layerModel in GetLayers())
|
||||
layerModel.SetupKeybinds();
|
||||
}
|
||||
|
||||
public void ClearKeybinds()
|
||||
{
|
||||
foreach (var layerModel in GetLayers())
|
||||
layerModel.RemoveKeybinds();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{nameof(Name)}: {Name}, {nameof(KeyboardSlug)}: {KeyboardSlug}, {nameof(GameName)}: {GameName}";
|
||||
}
|
||||
|
||||
#region Compare
|
||||
|
||||
protected bool Equals(ProfileModel other)
|
||||
{
|
||||
return string.Equals(Slug, other.Slug) &&
|
||||
string.Equals(KeyboardSlug, other.KeyboardSlug) &&
|
||||
string.Equals(GameName, other.GameName);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
return false;
|
||||
if (ReferenceEquals(this, obj))
|
||||
return true;
|
||||
if (obj.GetType() != GetType())
|
||||
return false;
|
||||
return Equals((ProfileModel) obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var hashCode = Slug?.GetHashCode() ?? 0;
|
||||
hashCode = (hashCode * 397) ^ (KeyboardSlug?.GetHashCode() ?? 0);
|
||||
hashCode = (hashCode * 397) ^ (GameName?.GetHashCode() ?? 0);
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ using System.Windows;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("SpoinkyNL")]
|
||||
[assembly: AssemblyProduct("Artemis")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@ -53,7 +53,7 @@ using System.Windows;
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
[assembly: AssemblyVersion("1.8.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.1.0")]
|
||||
[assembly: AssemblyVersion("1.9.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.9.0.0")]
|
||||
[assembly: InternalsVisibleTo("Artemis.Explorables")]
|
||||
|
||||
|
||||
12
Artemis/Artemis/Properties/Resources.Designer.cs
generated
12
Artemis/Artemis/Properties/Resources.Designer.cs
generated
@ -22,7 +22,7 @@ namespace Artemis.Properties {
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Resources {
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
@ -278,6 +278,16 @@ namespace Artemis.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap k95_platinum {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("k95_platinum", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
||||
@ -220,4 +220,7 @@
|
||||
<data name="masterkeys_pro_s" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Keyboards\masterkeys-pro-s.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="k95_platinum" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Keyboards\k95-platinum.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -2,6 +2,7 @@
|
||||
{
|
||||
"uri" "http://localhost:{{port}}/csgo_game_event"
|
||||
"timeout" "0.1"
|
||||
"heartbeat" "0.1"
|
||||
"data"
|
||||
{
|
||||
"provider" "1"
|
||||
|
||||
Binary file not shown.
BIN
Artemis/Artemis/Resources/Keyboards/k95-platinum.png
Normal file
BIN
Artemis/Artemis/Resources/Keyboards/k95-platinum.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 300 KiB |
@ -1,4 +1,5 @@
|
||||
using Caliburn.Micro;
|
||||
using System.Dynamic;
|
||||
using Caliburn.Micro;
|
||||
using Ninject;
|
||||
using Ninject.Parameters;
|
||||
|
||||
@ -13,21 +14,25 @@ namespace Artemis.Services
|
||||
_kernel = kernel;
|
||||
}
|
||||
|
||||
public T ShowWindow<T>(params IParameter[] param) where T : class
|
||||
public T ShowWindow<T>(string windowName, params IParameter[] param) where T : class
|
||||
{
|
||||
var windowManager = new WindowManager();
|
||||
var viewModel = _kernel.Get<T>(param);
|
||||
|
||||
windowManager.ShowWindow(viewModel);
|
||||
var viewModel = _kernel.Get<T>(param);
|
||||
|
||||
dynamic settings = new ExpandoObject();
|
||||
settings.Title = windowName;
|
||||
windowManager.ShowWindow(viewModel, null, settings);
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
public T ShowDialog<T>(params IParameter[] param) where T : class
|
||||
public T ShowDialog<T>(string dialogName, params IParameter[] param) where T : class
|
||||
{
|
||||
var windowManager = new WindowManager();
|
||||
var viewModel = _kernel.Get<T>(param);
|
||||
|
||||
windowManager.ShowDialog(viewModel);
|
||||
dynamic settings = new ExpandoObject();
|
||||
settings.Title = dialogName;
|
||||
windowManager.ShowDialog(viewModel, null, settings);
|
||||
return viewModel;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user