1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-01-01 18:23:32 +00:00

Added K95 Platinum support

Added default profiles for Assetto Corsa resolving #131
Fixed default profiles for the CM Pro S resolving #316
Fixed keybinds on folders #276
Fixed window scaling with many layers #276
This commit is contained in:
SpoinkyNL 2017-03-18 17:23:51 +01:00
parent c13b9e4dd5
commit 87a30b8936
34 changed files with 844 additions and 799 deletions

View File

@ -163,8 +163,8 @@
<HintPath>..\packages\CSCore.1.2.0\lib\net35-client\CSCore.dll</HintPath> <HintPath>..\packages\CSCore.1.2.0\lib\net35-client\CSCore.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="CUE.NET, Version=1.1.2.1, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="CUE.NET, Version=1.1.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CUE.NET.1.1.2.1\lib\net45\CUE.NET.dll</HintPath> <HintPath>..\packages\CUE.NET.1.1.3.0\lib\net45\CUE.NET.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="DeltaCompressionDotNet, Version=1.1.0.0, Culture=neutral, PublicKeyToken=1d14d6e5194e7f4a, processorArchitecture=MSIL"> <Reference Include="DeltaCompressionDotNet, Version=1.1.0.0, Culture=neutral, PublicKeyToken=1d14d6e5194e7f4a, processorArchitecture=MSIL">
@ -199,8 +199,8 @@
<HintPath>..\packages\squirrel.windows.1.4.4\lib\Net45\ICSharpCode.SharpZipLib.dll</HintPath> <HintPath>..\packages\squirrel.windows.1.4.4\lib\Net45\ICSharpCode.SharpZipLib.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="log4net, Version=2.0.7.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.7\lib\net45-full\log4net.dll</HintPath> <HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="MahApps.Metro, Version=1.4.3.0, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL"> <Reference Include="MahApps.Metro, Version=1.4.3.0, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
@ -248,7 +248,7 @@
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.4.3\lib\net45\NLog.dll</HintPath> <HintPath>..\packages\NLog.4.4.4\lib\net45\NLog.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="NuGet.Squirrel, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="NuGet.Squirrel, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
@ -272,7 +272,7 @@
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="SpotifyAPI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <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> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Squirrel, Version=1.4.3.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Squirrel, Version=1.4.3.0, Culture=neutral, processorArchitecture=MSIL">
@ -778,6 +778,7 @@
<None Include="NLog.xsd"> <None Include="NLog.xsd">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
<None Include="Resources\Keyboards\k95-platinum.png" />
<None Include="Resources\Keyboards\masterkeys-pro-s.png" /> <None Include="Resources\Keyboards\masterkeys-pro-s.png" />
<None Include="Resources\Keyboards\masterkeys-pro-l.png" /> <None Include="Resources\Keyboards\masterkeys-pro-l.png" />
<Resource Include="Resources\Kottke Silkscreen License.txt" /> <Resource Include="Resources\Kottke Silkscreen License.txt" />
@ -1064,12 +1065,12 @@
<Folder Include="Resources\Lua\" /> <Folder Include="Resources\Lua\" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <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"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <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> <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> </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> </Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -57,6 +57,12 @@ namespace Artemis.DeviceProviders.Corsair
Slug = "corsair-k95-rgb"; Slug = "corsair-k95-rgb";
PreviewSettings = new PreviewSettings(new Rect(20, 26, 1066, 282), Resources.k95); PreviewSettings = new PreviewSettings(new Rect(20, 26, 1066, 282), Resources.k95);
break; 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":
case "K70 RGB RAPIDFIRE": case "K70 RGB RAPIDFIRE":
case "K70 LUX RGB": case "K70 LUX RGB":
@ -72,13 +78,13 @@ namespace Artemis.DeviceProviders.Corsair
Height = 7; Height = 7;
Width = 18; Width = 18;
Slug = "corsair-k65-rgb"; Slug = "corsair-k65-rgb";
PreviewSettings = new PreviewSettings(new Rect(15, 30, 747, 363), Resources.k65); PreviewSettings = new PreviewSettings(new Rect(15, 30, 751, 284), Resources.k65);
break; break;
case "STRAFE RGB": case "STRAFE RGB":
Height = 7; Height = 7;
Width = 22; Width = 22;
Slug = "corsair-strafe-rgb"; Slug = "corsair-strafe-rgb";
PreviewSettings = new PreviewSettings(new Rect(23, 30, 984, 375), Resources.strafe); PreviewSettings = new PreviewSettings(new Rect(23, 30, 940, 303), Resources.strafe);
break; break;
} }
@ -108,8 +114,7 @@ namespace Artemis.DeviceProviders.Corsair
/// <param name="bitmap"></param> /// <param name="bitmap"></param>
public override void DrawBitmap(Bitmap bitmap) public override void DrawBitmap(Bitmap bitmap)
{ {
using (var image = ImageUtilities.ResizeImage(bitmap, Width, Height))
{
// For STRAFE, stretch the image on row 2. // For STRAFE, stretch the image on row 2.
if (_keyboard.DeviceInfo.Model == "STRAFE RGB") if (_keyboard.DeviceInfo.Model == "STRAFE RGB")
{ {
@ -117,8 +122,8 @@ namespace Artemis.DeviceProviders.Corsair
{ {
using (var g = Graphics.FromImage(strafeBitmap)) using (var g = Graphics.FromImage(strafeBitmap))
{ {
g.DrawImage(image, new Point(0, 0)); g.DrawImage(bitmap, new Point(0, 0));
g.DrawImage(image, new Rectangle(0, 3, 22, 7), new Rectangle(0, 2, 22, 7), g.DrawImage(bitmap, new Rectangle(0, 3, 22, 7), new Rectangle(0, 2, 22, 7),
GraphicsUnit.Pixel); GraphicsUnit.Pixel);
_keyboardBrush.Image = strafeBitmap; _keyboardBrush.Image = strafeBitmap;
@ -128,10 +133,10 @@ namespace Artemis.DeviceProviders.Corsair
} }
else else
{ {
_keyboardBrush.Image = image; _keyboardBrush.Image = bitmap;
_keyboard.Update(); _keyboard.Update();
} }
}
} }
public override KeyMatch? GetKeyPosition(Keys keyCode) public override KeyMatch? GetKeyPosition(Keys keyCode)

View File

@ -134,7 +134,12 @@ namespace Artemis.Modules.Abstract
private void ChangeToLastProfile() private void ChangeToLastProfile()
{ {
var profileName = !string.IsNullOrEmpty(Settings?.LastProfile) ? Settings.LastProfile : "Default"; 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) protected virtual void RaiseProfileChangedEvent(ProfileChangedEventArgs e)

View File

@ -7,7 +7,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="900"> d:DesignHeight="600" d:DesignWidth="900">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -48,5 +47,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -8,6 +8,7 @@ using Artemis.Services;
using Artemis.Utilities; using Artemis.Utilities;
using Artemis.Utilities.GameState; using Artemis.Utilities.GameState;
using Newtonsoft.Json; using Newtonsoft.Json;
using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;
namespace Artemis.Modules.Games.CounterStrike namespace Artemis.Modules.Games.CounterStrike
{ {
@ -56,7 +57,7 @@ namespace Artemis.Modules.Games.CounterStrike
return; return;
var dm = (CounterStrikeDataModel) DataModel; var dm = (CounterStrikeDataModel) DataModel;
if (dm.player != null) if (dm.player != null && dm.player.weapons != null)
{ {
// Detect active weapon // Detect active weapon
if (dm.player.weapons.weapon_0?.state == "active") if (dm.player.weapons.weapon_0?.state == "active")
@ -147,7 +148,7 @@ namespace Artemis.Modules.Games.CounterStrike
{ {
if (DataModel == null) if (DataModel == null)
DataModel = new CounterStrikeDataModel(); DataModel = new CounterStrikeDataModel();
JsonConvert.PopulateObject(jsonString, DataModel); JsonConvert.PopulateObject(jsonString, DataModel, new JsonSerializerSettings {Error = HandleGameDataError});
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -155,5 +156,11 @@ namespace Artemis.Modules.Games.CounterStrike
throw; throw;
} }
} }
private void HandleGameDataError(object sender, ErrorEventArgs e)
{
// Ignore errors and leave them null
e.ErrorContext.Handled = true;
}
} }
} }

View File

@ -7,7 +7,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="476.986" d:DesignWidth="538.772"> d:DesignHeight="476.986" d:DesignWidth="538.772">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -53,5 +52,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -7,7 +7,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="476.986" d:DesignWidth="538.772"> d:DesignHeight="476.986" d:DesignWidth="538.772">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -53,5 +52,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -7,7 +7,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="559.725" d:DesignWidth="882.696"> d:DesignHeight="559.725" d:DesignWidth="882.696">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -73,5 +72,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -7,7 +7,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"> d:DesignHeight="300" d:DesignWidth="300">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -43,5 +42,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -7,7 +7,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="559.725" d:DesignWidth="882.696"> d:DesignHeight="559.725" d:DesignWidth="882.696">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -43,5 +42,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -7,7 +7,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="410.933" d:DesignWidth="732.154"> d:DesignHeight="410.933" d:DesignWidth="732.154">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -58,5 +57,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -7,7 +7,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="559.725" d:DesignWidth="882.696"> d:DesignHeight="559.725" d:DesignWidth="882.696">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -48,5 +47,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -7,7 +7,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="476.986" d:DesignWidth="538.772"> d:DesignHeight="476.986" d:DesignWidth="538.772">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -46,5 +45,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -8,7 +8,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="416.495" d:DesignWidth="553.608"> d:DesignHeight="416.495" d:DesignWidth="553.608">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -49,5 +48,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -8,7 +8,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="476.986" d:DesignWidth="538.772"> d:DesignHeight="476.986" d:DesignWidth="538.772">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -54,5 +53,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -7,7 +7,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="386.842" d:DesignWidth="554.887"> d:DesignHeight="386.842" d:DesignWidth="554.887">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -53,5 +52,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -8,7 +8,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="476.986" d:DesignWidth="538.772"> d:DesignHeight="476.986" d:DesignWidth="538.772">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -49,5 +48,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -7,7 +7,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="476.986" d:DesignWidth="538.772"> d:DesignHeight="476.986" d:DesignWidth="538.772">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -43,5 +42,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -7,7 +7,6 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="476.986" d:DesignWidth="538.772"> d:DesignHeight="476.986" d:DesignWidth="538.772">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -43,5 +42,4 @@
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" /> <Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100" Margin="10,0,0,0" Style="{DynamicResource SquareButtonStyle}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -42,12 +42,32 @@
</xs:attribute> </xs:attribute>
<xs:attribute name="throwExceptions" type="xs:boolean"> <xs:attribute name="throwExceptions" type="xs:boolean">
<xs:annotation> <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:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="internalLogToTrace" type="xs:boolean"> <xs:attribute name="internalLogToTrace" type="xs:boolean">
<xs:annotation> <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:annotation>
</xs:attribute> </xs:attribute>
</xs:complexType> </xs:complexType>
@ -174,7 +194,7 @@
<xs:complexType name="NLogInclude"> <xs:complexType name="NLogInclude">
<xs:attribute name="file" type="SimpleLayoutAttribute" use="required"> <xs:attribute name="file" type="SimpleLayoutAttribute" use="required">
<xs:annotation> <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:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="ignoreErrors" type="xs:boolean" use="optional" default="false"> <xs:attribute name="ignoreErrors" type="xs:boolean" use="optional" default="false">
@ -1327,6 +1347,13 @@
<xs:enumeration value="Day" /> <xs:enumeration value="Day" />
<xs:enumeration value="Hour" /> <xs:enumeration value="Hour" />
<xs:enumeration value="Minute" /> <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:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="NLog.Targets.FilePathKind"> <xs:simpleType name="NLog.Targets.FilePathKind">

View File

@ -244,6 +244,7 @@ namespace Artemis.Profiles.Layers.Models
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> /// <summary>
/// Generates a flat list containing all layers that must be rendered on the keyboard, /// 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 /// the first mouse layer to be rendered and the first headset layer to be rendered
@ -261,8 +262,10 @@ namespace Artemis.Profiles.Layers.Models
continue; continue;
if (!ignoreConditions) if (!ignoreConditions)
if (!layerModel.AreConditionsMet(dataModel)) {
if (!layerModel.AreConditionsMet(dataModel) || !layerModel.RenderAllowed)
continue; continue;
}
layers.Add(layerModel); layers.Add(layerModel);
layers.AddRange(layerModel.GetRenderLayers(dataModel, keyboardOnly, ignoreConditions)); layers.AddRange(layerModel.GetRenderLayers(dataModel, keyboardOnly, ignoreConditions));
@ -312,7 +315,7 @@ namespace Artemis.Profiles.Layers.Models
public string Name { get; set; } public string Name { get; set; }
public int Order { get; set; } public int Order { get; set; }
public bool Enabled { get; set; } public bool Enabled { get; set; }
public bool RenderAllowed { get; set; } public bool RenderAllowed { get; set; } = true;
public bool Expanded { get; set; } public bool Expanded { get; set; }
public bool IsEvent { get; set; } public bool IsEvent { get; set; }
public LayerPropertiesModel Properties { get; set; } public LayerPropertiesModel Properties { get; set; }
@ -404,5 +407,11 @@ namespace Artemis.Profiles.Layers.Models
} }
#endregion #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}";
}
} }
} }

View File

@ -74,6 +74,7 @@ namespace Artemis.Profiles
return layers; return layers;
} }
// TODO: Make this and LayerModel's GetRenderLayers the same through inheritance
/// <summary> /// <summary>
/// Generates a flat list containing all layers that must be rendered on the keyboard, /// 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 /// the first mouse layer to be rendered and the first headset layer to be rendered
@ -82,8 +83,7 @@ namespace Artemis.Profiles
/// <param name="keyboardOnly">Whether or not to ignore anything but keyboards</param> /// <param name="keyboardOnly">Whether or not to ignore anything but keyboards</param>
/// <param name="ignoreConditions"></param> /// <param name="ignoreConditions"></param>
/// <returns>A flat list containing all layers that must be rendered</returns> /// <returns>A flat list containing all layers that must be rendered</returns>
public List<LayerModel> GetRenderLayers(ModuleDataModel dataModel, bool keyboardOnly, public List<LayerModel> GetRenderLayers(ModuleDataModel dataModel, bool keyboardOnly, bool ignoreConditions = false)
bool ignoreConditions = false)
{ {
var layers = new List<LayerModel>(); var layers = new List<LayerModel>();
foreach (var layerModel in Layers.OrderByDescending(l => l.Order)) foreach (var layerModel in Layers.OrderByDescending(l => l.Order))
@ -92,8 +92,10 @@ namespace Artemis.Profiles
continue; continue;
if (!ignoreConditions) if (!ignoreConditions)
if (!layerModel.AreConditionsMet(dataModel)) {
if (!layerModel.AreConditionsMet(dataModel) || !layerModel.RenderAllowed)
continue; continue;
}
layers.Add(layerModel); layers.Add(layerModel);
layers.AddRange(layerModel.GetRenderLayers(dataModel, keyboardOnly, ignoreConditions)); layers.AddRange(layerModel.GetRenderLayers(dataModel, keyboardOnly, ignoreConditions));
@ -109,8 +111,7 @@ namespace Artemis.Profiles
/// <param name="renderLayers">The layers to render</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="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> /// <param name="preview">Indicates wheter the layer is drawn as a preview, ignoring dynamic properties</param>
internal void DrawLayers(DeviceVisualModel deviceVisualModel, List<LayerModel> renderLayers, internal void DrawLayers(DeviceVisualModel deviceVisualModel, List<LayerModel> renderLayers, ModuleDataModel dataModel, bool preview)
ModuleDataModel dataModel, bool preview)
{ {
renderLayers = renderLayers.Where(rl => rl.LayerType.DrawType == deviceVisualModel.DrawType).ToList(); renderLayers = renderLayers.Where(rl => rl.LayerType.DrawType == deviceVisualModel.DrawType).ToList();
if (!renderLayers.Any()) if (!renderLayers.Any())
@ -209,9 +210,7 @@ namespace Artemis.Profiles
var layer = LayerModel.CreateLayer(); var layer = LayerModel.CreateLayer();
if (afterLayer != null) if (afterLayer != null)
{
afterLayer.InsertAfter(layer); afterLayer.InsertAfter(layer);
}
else else
{ {
Layers.Add(layer); Layers.Add(layer);
@ -233,6 +232,12 @@ namespace Artemis.Profiles
layerModel.RemoveKeybinds(); layerModel.RemoveKeybinds();
} }
/// <inheritdoc />
public override string ToString()
{
return $"{nameof(Name)}: {Name}, {nameof(KeyboardSlug)}: {KeyboardSlug}, {nameof(GameName)}: {GameName}";
}
#region Compare #region Compare
protected bool Equals(ProfileModel other) protected bool Equals(ProfileModel other)

View File

@ -22,7 +22,7 @@ namespace Artemis.Properties {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources { internal class Resources {
private static global::System.Resources.ResourceManager resourceMan; 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> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>

View File

@ -220,4 +220,7 @@
<data name="masterkeys_pro_s" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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> <value>..\Resources\Keyboards\masterkeys-pro-s.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </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> </root>

View File

@ -2,6 +2,7 @@
{ {
"uri" "http://localhost:{{port}}/csgo_game_event" "uri" "http://localhost:{{port}}/csgo_game_event"
"timeout" "0.1" "timeout" "0.1"
"heartbeat" "0.1"
"data" "data"
{ {
"provider" "1" "provider" "1"

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

View File

@ -60,20 +60,20 @@ namespace Artemis.Utilities.DataReaders
if (DllPlaced()) if (DllPlaced())
return; return;
try
{
// Create directory structure, just in case // Create directory structure, just in case
Directory.CreateDirectory(LogitechPath + @""); Directory.CreateDirectory(LogitechPath + @"");
// Backup the existing DLL // Backup the existing DLL
if (File.Exists(LogitechPath + @"\LogitechLed.dll")) if (File.Exists(LogitechPath + @"\LogitechLed.dll"))
{ {
if (File.Exists(LogitechPath + @"\LogitechLed.dll.bak")) if (!File.Exists(LogitechPath + @"\LogitechLed.dll.bak"))
File.Delete(LogitechPath + @"\LogitechLed.dll.bak");
File.Move(LogitechPath + @"\LogitechLed.dll", LogitechPath + @"\LogitechLed.dll.bak"); File.Move(LogitechPath + @"\LogitechLed.dll", LogitechPath + @"\LogitechLed.dll.bak");
} }
// Copy our own DLL in place // Copy our own DLL in place
File.WriteAllBytes(LogitechPath + @"\LogitechLED.dll", File.WriteAllBytes(LogitechPath + @"\LogitechLED.dll", Resources.LogitechLED);
Resources.LogitechLED);
// A token to show the file is placed // A token to show the file is placed
File.Create(LogitechPath + @"\artemis.txt"); File.Create(LogitechPath + @"\artemis.txt");
@ -83,6 +83,11 @@ namespace Artemis.Utilities.DataReaders
if (!RegistryKeyPlaced()) if (!RegistryKeyPlaced())
PlaceRegistryKey(); PlaceRegistryKey();
} }
catch (Exception e)
{
Logger.Error(e, "Failed to place Logitech DLL");
}
}
public static bool DllPlaced() public static bool DllPlaced()
{ {

View File

@ -1,6 +1,8 @@
using System.Threading.Tasks; using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Gma.System.MouseKeyHook; using Gma.System.MouseKeyHook;
using NLog;
namespace Artemis.Utilities.Keyboard namespace Artemis.Utilities.Keyboard
{ {
@ -15,6 +17,15 @@ namespace Artemis.Utilities.Keyboard
public static void Start() public static void Start()
{ {
_globalHook = Hook.GlobalEvents(); _globalHook = Hook.GlobalEvents();
// When hitting breakpoints all user input freezes for ~10 seconds due to Windows waiting on the hooks to time out.
// By simply not hooking when the debugger is attached this no longer happens but keybinds obviously wont work.
if (Debugger.IsAttached)
{
LogManager.GetCurrentClassLogger().Fatal("Debugger attached so not enabling any global hooks, keybinds won't work!");
return;
}
_globalHook.KeyDown += GlobalHookOnKeyDown; _globalHook.KeyDown += GlobalHookOnKeyDown;
_globalHook.KeyUp += GlobalHookOnKeyUp; _globalHook.KeyUp += GlobalHookOnKeyUp;
_globalHook.MouseDown += GlobalHookOnMouseDown; _globalHook.MouseDown += GlobalHookOnMouseDown;

View File

@ -68,7 +68,7 @@ namespace Artemis.ViewModels
_dialogService = dialogService; _dialogService = dialogService;
_copyKeybind = new KeybindModel("copy", new HotKey(Key.C, ModifierKeys.Control), PressType.Down, LayerToClipboard); _copyKeybind = new KeybindModel("copy", new HotKey(Key.C, ModifierKeys.Control), PressType.Down, LayerToClipboard);
_pasteKeybind = new KeybindModel("paste", new HotKey(Key.V, ModifierKeys.Control), PressType.Up, ClipboardToLayer); _pasteKeybind = new KeybindModel("paste", new HotKey(Key.V, ModifierKeys.Control), PressType.Up, ClipboardToLayer);
_placeholderKeyboard = KeyboardPreview = ImageUtilities.BitmapToBitmapImage(Resources.none);
ProfileNames = new ObservableCollection<string>(); ProfileNames = new ObservableCollection<string>();
Layers = new ObservableCollection<LayerModel>(); Layers = new ObservableCollection<LayerModel>();
ProfileEditorModel = profileEditorModel; ProfileEditorModel = profileEditorModel;
@ -325,7 +325,7 @@ namespace Artemis.ViewModels
public void LayerToClipboard() public void LayerToClipboard()
{ {
if (SelectedLayer == null) if (SelectedLayer == null || !ActiveWindowHelper.MainWindowActive)
return; return;
// Probably not how the cool kids do it but leveraging on JsonConvert gives flawless serialization // Probably not how the cool kids do it but leveraging on JsonConvert gives flawless serialization
@ -334,6 +334,9 @@ namespace Artemis.ViewModels
public void ClipboardToLayer() public void ClipboardToLayer()
{ {
if (!ActiveWindowHelper.MainWindowActive)
return;
GeneralHelpers.ExecuteSta(() => GeneralHelpers.ExecuteSta(() =>
{ {
var data = (string) Clipboard.GetData("layer"); var data = (string) Clipboard.GetData("layer");
@ -503,17 +506,20 @@ namespace Artemis.ViewModels
#region Rendering #region Rendering
private readonly ImageSource _placeholderKeyboard;
private void LoopManagerOnRenderCompleted(object sender, EventArgs eventArgs) private void LoopManagerOnRenderCompleted(object sender, EventArgs eventArgs)
{ {
// Besides the usual checks, also check if the ActiveKeyboard isn't the NoneKeyboard // Besides the usual checks, also check if the ActiveKeyboard isn't the NoneKeyboard
if (SelectedProfile == null || _deviceManager.ActiveKeyboard == null || _deviceManager.ActiveKeyboard.Slug == "none") if (SelectedProfile == null || _deviceManager.ActiveKeyboard == null || _deviceManager.ActiveKeyboard.Slug == "none")
{ {
KeyboardPreview = null;
// Setup layers for the next frame // Setup layers for the next frame
if (_moduleModel.IsInitialized && ActiveWindowHelper.MainWindowActive) if (_moduleModel.IsInitialized && ActiveWindowHelper.MainWindowActive)
_moduleModel.PreviewLayers = new List<LayerModel>(); _moduleModel.PreviewLayers = new List<LayerModel>();
if (!Equals(KeyboardPreview, _placeholderKeyboard))
KeyboardPreview = _placeholderKeyboard;
return; return;
} }

View File

@ -16,19 +16,6 @@ namespace Artemis.ViewModels.Profiles
private readonly LayerEditorViewModel _editorViewModel; private readonly LayerEditorViewModel _editorViewModel;
private readonly NamedOperator[] _hotkeyOperators =
{
new NamedOperator("Pressed", "enable"),
new NamedOperator("Held down", "held")
};
private readonly GeneralHelpers.PropertyCollection[] _hotkeyProperties =
{
new GeneralHelpers.PropertyCollection {Display = "Enable when hotkey", Type = "hotkeyEnable", Path = "hotkeyEnable"},
new GeneralHelpers.PropertyCollection {Display = "Disable when hotkey", Type = "hotkeyDisable", Path = "hotkeyDisable"},
new GeneralHelpers.PropertyCollection {Display = "Toggle when hotkey", Type = "hotkeyToggle", Path = "hotkeyToggle"}
};
private readonly NamedOperator[] _int32Operators = private readonly NamedOperator[] _int32Operators =
{ {
new NamedOperator("Lower than", "<"), new NamedOperator("Lower than", "<"),
@ -55,12 +42,10 @@ namespace Artemis.ViewModels.Profiles
}; };
private HotKey _hotKey; private HotKey _hotKey;
private bool _keybindIsVisible; private bool _keybindIsVisible;
private GeneralHelpers.PropertyCollection _selectedDataModelProp; private GeneralHelpers.PropertyCollection _selectedDataModelProp;
private string _selectedDropdownValue; private string _selectedDropdownValue;
private NamedOperator _selectedOperator; private NamedOperator _selectedOperator;
private bool _userDropdownValueIsVisible; private bool _userDropdownValueIsVisible;
private string _userValue; private string _userValue;
private bool _userValueIsVisible; private bool _userValueIsVisible;
@ -72,7 +57,7 @@ namespace Artemis.ViewModels.Profiles
ConditionModel = conditionModel; ConditionModel = conditionModel;
Operators = new BindableCollection<NamedOperator>(); Operators = new BindableCollection<NamedOperator>();
DropdownValues = new BindableCollection<string>(); DropdownValues = new BindableCollection<string>();
DataModelProps = new BindableCollection<GeneralHelpers.PropertyCollection>(_hotkeyProperties); DataModelProps = new BindableCollection<GeneralHelpers.PropertyCollection>();
DataModelProps.AddRange(editorViewModel.DataModelProps); DataModelProps.AddRange(editorViewModel.DataModelProps);
PropertyChanged += MapViewToModel; PropertyChanged += MapViewToModel;
@ -80,9 +65,7 @@ namespace Artemis.ViewModels.Profiles
} }
public LayerConditionModel ConditionModel { get; set; } public LayerConditionModel ConditionModel { get; set; }
public BindableCollection<GeneralHelpers.PropertyCollection> DataModelProps { get; set; } public BindableCollection<GeneralHelpers.PropertyCollection> DataModelProps { get; set; }
public BindableCollection<NamedOperator> Operators { get; set; } public BindableCollection<NamedOperator> Operators { get; set; }
public BindableCollection<string> DropdownValues { get; set; } public BindableCollection<string> DropdownValues { get; set; }
@ -91,7 +74,8 @@ namespace Artemis.ViewModels.Profiles
get { return _userValue; } get { return _userValue; }
set set
{ {
if (value == _userValue) return; if (value == _userValue)
return;
_userValue = value; _userValue = value;
NotifyOfPropertyChange(() => UserValue); NotifyOfPropertyChange(() => UserValue);
} }
@ -102,7 +86,8 @@ namespace Artemis.ViewModels.Profiles
get { return _hotKey; } get { return _hotKey; }
set set
{ {
if (Equals(value, _hotKey)) return; if (Equals(value, _hotKey))
return;
_hotKey = value; _hotKey = value;
NotifyOfPropertyChange(() => HotKey); NotifyOfPropertyChange(() => HotKey);
} }
@ -113,7 +98,8 @@ namespace Artemis.ViewModels.Profiles
get { return _selectedDataModelProp; } get { return _selectedDataModelProp; }
set set
{ {
if (value.Equals(_selectedDataModelProp)) return; if (value.Equals(_selectedDataModelProp))
return;
_selectedDataModelProp = value; _selectedDataModelProp = value;
SetupPropertyInput(); SetupPropertyInput();
NotifyOfPropertyChange(() => SelectedDataModelProp); NotifyOfPropertyChange(() => SelectedDataModelProp);
@ -125,7 +111,8 @@ namespace Artemis.ViewModels.Profiles
get { return _userValueIsVisible; } get { return _userValueIsVisible; }
set set
{ {
if (value == _userValueIsVisible) return; if (value == _userValueIsVisible)
return;
_userValueIsVisible = value; _userValueIsVisible = value;
NotifyOfPropertyChange(() => UserValueIsVisible); NotifyOfPropertyChange(() => UserValueIsVisible);
} }
@ -136,7 +123,8 @@ namespace Artemis.ViewModels.Profiles
get { return _userDropdownValueIsVisible; } get { return _userDropdownValueIsVisible; }
set set
{ {
if (value == _userDropdownValueIsVisible) return; if (value == _userDropdownValueIsVisible)
return;
_userDropdownValueIsVisible = value; _userDropdownValueIsVisible = value;
NotifyOfPropertyChange(() => UserDropdownValueIsVisible); NotifyOfPropertyChange(() => UserDropdownValueIsVisible);
} }
@ -147,7 +135,8 @@ namespace Artemis.ViewModels.Profiles
get { return _keybindIsVisible; } get { return _keybindIsVisible; }
set set
{ {
if (value == _keybindIsVisible) return; if (value == _keybindIsVisible)
return;
_keybindIsVisible = value; _keybindIsVisible = value;
NotifyOfPropertyChange(); NotifyOfPropertyChange();
} }
@ -169,7 +158,8 @@ namespace Artemis.ViewModels.Profiles
get { return _selectedDropdownValue; } get { return _selectedDropdownValue; }
set set
{ {
if (value == _selectedDropdownValue) return; if (value == _selectedDropdownValue)
return;
_selectedDropdownValue = value; _selectedDropdownValue = value;
NotifyOfPropertyChange(() => SelectedDropdownValue); NotifyOfPropertyChange(() => SelectedDropdownValue);
} }
@ -233,15 +223,6 @@ namespace Artemis.ViewModels.Profiles
Operators.AddRange(_stringOperators); Operators.AddRange(_stringOperators);
UserValueIsVisible = true; UserValueIsVisible = true;
break; break;
case "hotkeyEnable":
case "hotkeyDisable":
Operators.AddRange(_hotkeyOperators);
KeybindIsVisible = true;
break;
case "hotkeyToggle":
Operators.Add(_hotkeyOperators[0]);
KeybindIsVisible = true;
break;
default: default:
Operators.AddRange(_operators); Operators.AddRange(_operators);
UserValueIsVisible = true; UserValueIsVisible = true;
@ -270,8 +251,7 @@ namespace Artemis.ViewModels.Profiles
KeybindIsVisible = false; KeybindIsVisible = false;
// Event operators don't have any form of input // Event operators don't have any form of input
if (SelectedOperator.Value == "changed" || SelectedOperator.Value == "decreased" || if (SelectedOperator.Value == "changed" || SelectedOperator.Value == "decreased" || SelectedOperator.Value == "increased")
SelectedOperator.Value == "increased")
return; return;
if (SelectedDataModelProp.Type != null && SelectedDataModelProp.Type.Contains("hotkey")) if (SelectedDataModelProp.Type != null && SelectedDataModelProp.Type.Contains("hotkey"))

View File

@ -28,7 +28,7 @@
<!-- Preview --> <!-- Preview -->
<Label Grid.Column="0" Grid.Row="0" FontSize="20" HorizontalAlignment="Left" Content="Preview" /> <Label Grid.Column="0" Grid.Row="0" FontSize="20" HorizontalAlignment="Left" Content="Preview" />
<Border Grid.Column="0" Grid.Row="1" Background="#FF232323" BorderBrush="{DynamicResource HighlightBrush}" BorderThickness="3"> <Border Grid.Column="0" Grid.Row="1" Background="#FF232323" BorderBrush="{DynamicResource HighlightBrush}" BorderThickness="3">
<Border Padding="50"> <Border Padding="50" x:Name="PreviewBorder">
<Border.Effect> <Border.Effect>
<DropShadowEffect x:Name="ShadowEffect" ShadowDepth="0" Color="{DynamicResource HighlightColor}" Opacity="1" BlurRadius="25" /> <DropShadowEffect x:Name="ShadowEffect" ShadowDepth="0" Color="{DynamicResource HighlightColor}" Opacity="1" BlurRadius="25" />
</Border.Effect> </Border.Effect>

View File

@ -52,18 +52,18 @@
</ComboBox> </ComboBox>
<!-- Mouse/keyboard button --> <!-- Mouse/keyboard button -->
<Button Grid.Column="3" x:Name="ToggleBindType" Width="22" Height="22" Style="{DynamicResource SquareButtonStyle}" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="10,0,0,0"> <Button Grid.Column="3" x:Name="ToggleBindType" Width="22" Height="22" Style="{DynamicResource SquareButtonStyle}" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Toggle between mousebind and keybind">
<Button.Content> <Button.Content>
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12"> <Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
<Rectangle.OpacityMask> <Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_hardware_mouse}" Stretch="Fill" /> <VisualBrush Visual="{StaticResource appbar_swap}" Stretch="Fill" />
</Rectangle.OpacityMask> </Rectangle.OpacityMask>
</Rectangle> </Rectangle>
</Button.Content> </Button.Content>
</Button> </Button>
<!-- Delete button --> <!-- Delete button -->
<Button Grid.Column="4" x:Name="Delete" Width="22" Height="22" Style="{DynamicResource SquareButtonStyle}" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="10,0,0,0"> <Button Grid.Column="4" x:Name="Delete" Width="22" Height="22" Style="{DynamicResource SquareButtonStyle}" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Delete">
<Button.Content> <Button.Content>
<Rectangle <Rectangle
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12"> Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">

View File

@ -6,12 +6,12 @@
<package id="Castle.Core" version="4.0.0" targetFramework="net461" /> <package id="Castle.Core" version="4.0.0" targetFramework="net461" />
<package id="Colore" version="5.1.0" targetFramework="net461" /> <package id="Colore" version="5.1.0" targetFramework="net461" />
<package id="CSCore" version="1.2.0" targetFramework="net461" /> <package id="CSCore" version="1.2.0" targetFramework="net461" />
<package id="CUE.NET" version="1.1.2.1" targetFramework="net461" /> <package id="CUE.NET" version="1.1.3.0" targetFramework="net461" />
<package id="DeltaCompressionDotNet" version="1.1.0" targetFramework="net461" /> <package id="DeltaCompressionDotNet" version="1.1.0" targetFramework="net461" />
<package id="DynamicExpresso.Core" version="1.3.3.5" targetFramework="net461" /> <package id="DynamicExpresso.Core" version="1.3.3.5" targetFramework="net461" />
<package id="gong-wpf-dragdrop" version="0.1.4.3" targetFramework="net461" /> <package id="gong-wpf-dragdrop" version="0.1.4.3" targetFramework="net461" />
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net452" /> <package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net452" />
<package id="log4net" version="2.0.7" targetFramework="net461" /> <package id="log4net" version="2.0.8" targetFramework="net461" />
<package id="MahApps.Metro" version="1.4.3" targetFramework="net461" /> <package id="MahApps.Metro" version="1.4.3" targetFramework="net461" />
<package id="MahApps.Metro.Resources" version="0.6.1.0" targetFramework="net452" /> <package id="MahApps.Metro.Resources" version="0.6.1.0" targetFramework="net452" />
<package id="Mono.Cecil" version="0.9.6.4" targetFramework="net461" /> <package id="Mono.Cecil" version="0.9.6.4" targetFramework="net461" />
@ -22,13 +22,13 @@
<package id="Ninject.Extensions.Conventions" version="3.2.0.0" targetFramework="net461" /> <package id="Ninject.Extensions.Conventions" version="3.2.0.0" targetFramework="net461" />
<package id="Ninject.Extensions.Logging" version="3.2.3.0" targetFramework="net452" /> <package id="Ninject.Extensions.Logging" version="3.2.3.0" targetFramework="net452" />
<package id="Ninject.Extensions.Logging.nlog4" version="3.2.3.0" targetFramework="net452" /> <package id="Ninject.Extensions.Logging.nlog4" version="3.2.3.0" targetFramework="net452" />
<package id="NLog" version="4.4.3" targetFramework="net461" /> <package id="NLog" version="4.4.4" targetFramework="net461" />
<package id="NLog.Schema" version="4.4.3" targetFramework="net461" /> <package id="NLog.Schema" version="4.4.4" targetFramework="net461" />
<package id="Process.NET" version="1.0.8" targetFramework="net461" /> <package id="Process.NET" version="1.0.8" targetFramework="net461" />
<package id="SharpDX" version="3.1.1" targetFramework="net461" /> <package id="SharpDX" version="3.1.1" targetFramework="net461" />
<package id="SharpDX.Direct3D9" version="3.1.1" targetFramework="net461" /> <package id="SharpDX.Direct3D9" version="3.1.1" targetFramework="net461" />
<package id="Splat" version="2.0.0" targetFramework="net461" /> <package id="Splat" version="2.0.0" targetFramework="net461" />
<package id="SpotifyAPI-NET" version="2.12.0" targetFramework="net461" /> <package id="SpotifyAPI-NET" version="2.13.1" targetFramework="net461" />
<package id="squirrel.windows" version="1.4.4" targetFramework="net461" /> <package id="squirrel.windows" version="1.4.4" targetFramework="net461" />
<package id="WpfExceptionViewer" version="1.0.0.0" targetFramework="net452" /> <package id="WpfExceptionViewer" version="1.0.0.0" targetFramework="net452" />
</packages> </packages>