1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Spotify fixes and project cleanup

This commit is contained in:
SpoinkyNL 2016-06-08 17:33:24 +02:00
parent 390e93b6b6
commit a9aa9f4df6
87 changed files with 935 additions and 733 deletions

View File

@ -2,22 +2,56 @@
<configuration> <configuration>
<configSections> <configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <sectionGroup name="userSettings"
<section name="Artemis.Modules.Games.Overwatch.Overwatch" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Artemis.Modules.Games.TheDivision.TheDivision" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> <section name="Artemis.Modules.Effects.WindowsProfile.WindowsProfile"
<section name="Artemis.Modules.Games.Dota2.Dota2" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
<section name="Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Games.RocketLeague.RocketLeague" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> <section name="Artemis.Modules.Games.Overwatch.Overwatch"
<section name="Artemis.Settings.Offsets" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
<section name="Artemis.Modules.Games.Witcher3.Witcher3" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Effects.AudioVisualizer.AudioVisualization" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> <section name="Artemis.Modules.Games.TheDivision.TheDivision"
<section name="Artemis.Modules.Games.CounterStrike.CounterStrike" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
<section name="Artemis.Settings.CounterStrike" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.AudioVisualization" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> <section name="Artemis.Modules.Games.Dota2.Dota2"
<section name="Artemis.Settings.RocketLeague" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
<section name="Artemis.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.TypeWave" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> <section name="Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay"
<section name="Artemis.Settings.General" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Games.RocketLeague.RocketLeague"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.Offsets"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Games.Witcher3.Witcher3"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Effects.AudioVisualizer.AudioVisualization"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Games.CounterStrike.CounterStrike"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.CounterStrike"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.AudioVisualization"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.RocketLeague"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.TypeWave"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.General"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup> </sectionGroup>
</configSections> </configSections>
<connectionStrings /> <connectionStrings />
@ -25,6 +59,11 @@
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup> </startup>
<userSettings> <userSettings>
<Artemis.Modules.Effects.WindowsProfile.WindowsProfile>
<setting name="LastProfile" serializeAs="String">
<value>Demo (Duplicate to keep changes)</value>
</setting>
</Artemis.Modules.Effects.WindowsProfile.WindowsProfile>
<Artemis.Modules.Games.Overwatch.Overwatch> <Artemis.Modules.Games.Overwatch.Overwatch>
<setting name="Enabled" serializeAs="String"> <setting name="Enabled" serializeAs="String">
<value>True</value> <value>True</value>

View File

@ -2,7 +2,6 @@
using System.Security.Principal; using System.Security.Principal;
using System.Windows; using System.Windows;
using System.Windows.Threading; using System.Windows.Threading;
using Artemis.Utilities;
using NLog; using NLog;
using WpfExceptionViewer; using WpfExceptionViewer;
@ -21,6 +20,8 @@ namespace Artemis
InitializeComponent(); InitializeComponent();
} }
public bool DoHandle { get; set; }
private static bool IsRunAsAdministrator() private static bool IsRunAsAdministrator()
{ {
var wi = WindowsIdentity.GetCurrent(); var wi = WindowsIdentity.GetCurrent();
@ -29,8 +30,6 @@ namespace Artemis
return wp.IsInRole(WindowsBuiltInRole.Administrator); return wp.IsInRole(WindowsBuiltInRole.Administrator);
} }
public bool DoHandle { get; set; }
private void Application_Startup(object sender, StartupEventArgs e) private void Application_Startup(object sender, StartupEventArgs e)
{ {
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

View File

@ -219,6 +219,8 @@
<Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Linq.Dynamic, Version=1.0.5840.25917, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="System.Linq.Dynamic, Version=1.0.5840.25917, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\System.Linq.Dynamic.1.0.6\lib\net40\System.Linq.Dynamic.dll</HintPath> <HintPath>..\packages\System.Linq.Dynamic.1.0.6\lib\net40\System.Linq.Dynamic.dll</HintPath>
<Private>True</Private> <Private>True</Private>
@ -339,6 +341,12 @@
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualizerModel.cs" /> <Compile Include="Modules\Effects\AudioVisualizer\AudioVisualizerModel.cs" />
<Compile Include="Modules\Effects\AudioVisualizer\Utilities\FftEventArgs.cs" /> <Compile Include="Modules\Effects\AudioVisualizer\Utilities\FftEventArgs.cs" />
<Compile Include="Modules\Effects\AudioVisualizer\Utilities\SampleAggregator.cs" /> <Compile Include="Modules\Effects\AudioVisualizer\Utilities\SampleAggregator.cs" />
<Compile Include="Modules\Effects\WindowsProfile\WindowsProfile.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>WindowsProfile.settings</DependentUpon>
</Compile>
<Compile Include="Modules\Effects\WindowsProfile\WindowsProfileSettings.cs" />
<Compile Include="Modules\Effects\WindowsProfile\WindowsProfileView.xaml.cs"> <Compile Include="Modules\Effects\WindowsProfile\WindowsProfileView.xaml.cs">
<DependentUpon>WindowsProfileView.xaml</DependentUpon> <DependentUpon>WindowsProfileView.xaml</DependentUpon>
</Compile> </Compile>
@ -583,6 +591,10 @@
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>TypeWave.Designer.cs</LastGenOutput> <LastGenOutput>TypeWave.Designer.cs</LastGenOutput>
</None> </None>
<None Include="Modules\Effects\WindowsProfile\WindowsProfile.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>WindowsProfile.Designer.cs</LastGenOutput>
</None>
<None Include="Modules\Games\CounterStrike\CounterStrike.settings"> <None Include="Modules\Games\CounterStrike\CounterStrike.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>CounterStrike.Designer.cs</LastGenOutput> <LastGenOutput>CounterStrike.Designer.cs</LastGenOutput>
@ -644,6 +656,7 @@
<Resource Include="Resources\Entypo-license.txt" /> <Resource Include="Resources\Entypo-license.txt" />
<None Include="Resources\RzChromaSDK64.dll" /> <None Include="Resources\RzChromaSDK64.dll" />
<Resource Include="Resources\Keyboards\blackwidow.png" /> <Resource Include="Resources\Keyboards\blackwidow.png" />
<None Include="Resources\Keyboards\none.png" />
<Content Include="Resources\Witcher3\playerWitcher.txt" /> <Content Include="Resources\Witcher3\playerWitcher.txt" />
<Content Include="Resources\Witcher3\artemis.txt" /> <Content Include="Resources\Witcher3\artemis.txt" />
<None Include="Settings\Offsets.settings"> <None Include="Settings\Offsets.settings">

View File

@ -1,22 +1,26 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.IO.Compression;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Xml.Serialization; using System.Xml.Serialization;
using Artemis.DeviceProviders; using Artemis.DeviceProviders;
using Artemis.Models; using Artemis.Models;
using Artemis.Models.Profiles; using Artemis.Models.Profiles;
using Artemis.Utilities;
using NLog; using NLog;
namespace Artemis.DAL namespace Artemis.DAL
{ {
public static class ProfileProvider public static class ProfileProvider
{ {
private static readonly Logger _logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private static readonly string ProfileFolder = private static readonly string ProfileFolder = Environment
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis\profiles"; .GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis\profiles";
private static bool _installedDefaults;
/// <summary> /// <summary>
/// Get all profiles /// Get all profiles
@ -93,7 +97,7 @@ namespace Artemis.DAL
} }
catch (InvalidOperationException e) catch (InvalidOperationException e)
{ {
_logger.Error("Failed to load profile: {0} - {1}", path, e.InnerException.Message); Logger.Error("Failed to load profile: {0} - {1}", path, e.InnerException.Message);
} }
} }
@ -105,13 +109,20 @@ namespace Artemis.DAL
/// </summary> /// </summary>
private static void InstallDefaults() private static void InstallDefaults()
{ {
var test = Assembly.GetExecutingAssembly().GetManifestResourceNames(); // Only install the defaults once per session
//var stream = if (_installedDefaults)
// Assembly.GetExecutingAssembly() return;
// .GetManifestResourceStream("Artemis.Properties.Resources.logo.jpg"); _installedDefaults = true;
//Resources. // Load the ZIP from resources
//ZipPackage.Open(Re.defaultProfiles) var stream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream("Artemis.Resources.Keyboards.default-profiles.zip");
// Extract it over the old defaults in case one was updated
if (stream == null)
return;
var archive = new ZipArchive(stream);
archive.ExtractToDirectory(ProfileFolder, true);
} }
/// <summary> /// <summary>

View File

@ -41,12 +41,12 @@ namespace Artemis.DeviceProviders.Corsair
return; return;
var leds = CueSDK.HeadsetSDK.Leds.Count(); var leds = CueSDK.HeadsetSDK.Leds.Count();
var rect = new Rect(new Size(leds * 20, leds * 20)); var rect = new Rect(new Size(leds*20, leds*20));
var visual = new DrawingVisual(); var visual = new DrawingVisual();
using (var c = visual.RenderOpen()) using (var c = visual.RenderOpen())
c.DrawRectangle(brush, null, rect); c.DrawRectangle(brush, null, rect);
var img = ImageUtilities.DrawinVisualToBitmap(visual, rect); var img = ImageUtilities.DrawinVisualToBitmap(visual, rect);
var ledIndex = 0; var ledIndex = 0;
// Color each LED according to one of the pixels // Color each LED according to one of the pixels
@ -54,7 +54,7 @@ namespace Artemis.DeviceProviders.Corsair
{ {
corsairLed.Color = ledIndex == 0 corsairLed.Color = ledIndex == 0
? img.GetPixel(0, 0) ? img.GetPixel(0, 0)
: img.GetPixel((ledIndex + 1) * 20 - 1, (ledIndex + 1) * 20 - 1); : img.GetPixel((ledIndex + 1)*20 - 1, (ledIndex + 1)*20 - 1);
ledIndex++; ledIndex++;
} }

View File

@ -41,12 +41,12 @@ namespace Artemis.DeviceProviders.Corsair
return; return;
var leds = CueSDK.MouseSDK.Leds.Count(); var leds = CueSDK.MouseSDK.Leds.Count();
var rect = new Rect(new Size(leds * 20, leds * 20)); var rect = new Rect(new Size(leds*20, leds*20));
var visual = new DrawingVisual(); var visual = new DrawingVisual();
using (var c = visual.RenderOpen()) using (var c = visual.RenderOpen())
c.DrawRectangle(brush, null, rect); c.DrawRectangle(brush, null, rect);
var img = ImageUtilities.DrawinVisualToBitmap(visual, rect); var img = ImageUtilities.DrawinVisualToBitmap(visual, rect);
var ledIndex = 0; var ledIndex = 0;
// Color each LED according to one of the pixels // Color each LED according to one of the pixels
@ -54,7 +54,7 @@ namespace Artemis.DeviceProviders.Corsair
{ {
corsairLed.Color = ledIndex == 0 corsairLed.Color = ledIndex == 0
? img.GetPixel(0, 0) ? img.GetPixel(0, 0)
: img.GetPixel((ledIndex + 1) * 20 - 1, (ledIndex + 1) * 20 - 1); : img.GetPixel((ledIndex + 1)*20 - 1, (ledIndex + 1)*20 - 1);
ledIndex++; ledIndex++;
} }

View File

@ -72,7 +72,7 @@ namespace Artemis.DeviceProviders.Corsair
PreviewSettings = new PreviewSettings(665, 215, new Thickness(0, -5, 0, 0), Resources.strafe); PreviewSettings = new PreviewSettings(665, 215, new Thickness(0, -5, 0, 0), Resources.strafe);
break; break;
} }
Slug = "corsair-"+_keyboard.DeviceInfo.Model.Replace(' ', '-').ToLower(); Slug = "corsair-" + _keyboard.DeviceInfo.Model.Replace(' ', '-').ToLower();
_keyboard.Brush = _keyboardBrush ?? (_keyboardBrush = new ImageBrush()); _keyboard.Brush = _keyboardBrush ?? (_keyboardBrush = new ImageBrush());
} }

View File

@ -1,11 +1,11 @@
using System.Drawing; using System.Drawing;
using System.Threading; using System.Threading;
using System.Windows; using System.Windows;
using Microsoft.Win32;
using Artemis.DeviceProviders.Logitech.Utilities; using Artemis.DeviceProviders.Logitech.Utilities;
using Artemis.Properties; using Artemis.Properties;
using Artemis.Utilities; using Artemis.Utilities;
using Artemis.Utilities.LogitechDll; using Artemis.Utilities.LogitechDll;
using Microsoft.Win32;
namespace Artemis.DeviceProviders.Logitech namespace Artemis.DeviceProviders.Logitech
{ {
@ -28,12 +28,14 @@ namespace Artemis.DeviceProviders.Logitech
{ {
//Check to see if VC++ 2012 x64 is installed. //Check to see if VC++ 2012 x64 is installed.
if (Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}") == null) if (
Registry.LocalMachine.OpenSubKey(
@"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}") == null)
{ {
CantEnableText = "Couldn't connect to your Logitech G910.\n" + CantEnableText = "Couldn't connect to your Logitech G910.\n" +
"The Visual C 2012 Redistributable could not be found, which is required.\n" + "The Visual C 2012 Redistributable could not be found, which is required.\n" +
"Please download it by going to the following URL:\n\n" + "Please download it by going to the following URL:\n\n" +
"https://www.microsoft.com/download/confirmation.aspx?id=30679"; "https://www.microsoft.com/download/confirmation.aspx?id=30679";
return false; return false;
} }

View File

@ -1,6 +1,5 @@
using Artemis.Models.Interfaces; using Artemis.Models.Interfaces;
using Artemis.Models.Profiles; using Artemis.Models.Profiles;
using Artemis.Services;
using Artemis.ViewModels.Profiles; using Artemis.ViewModels.Profiles;
namespace Artemis.InjectionFactories namespace Artemis.InjectionFactories

View File

@ -15,8 +15,8 @@ namespace Artemis.Managers
/// </summary> /// </summary>
public class EffectManager public class EffectManager
{ {
private readonly IEventAggregator _events;
private readonly DeviceManager _deviceManager; private readonly DeviceManager _deviceManager;
private readonly IEventAggregator _events;
private readonly ILogger _logger; private readonly ILogger _logger;
private EffectModel _activeEffect; private EffectModel _activeEffect;

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Timers; using System.Timers;
@ -19,7 +18,6 @@ namespace Artemis.Managers
private readonly IEventAggregator _events; private readonly IEventAggregator _events;
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly Timer _loopTimer; private readonly Timer _loopTimer;
private int _fpsCount;
public LoopManager(ILogger logger, IEventAggregator events, EffectManager effectManager, public LoopManager(ILogger logger, IEventAggregator events, EffectManager effectManager,
DeviceManager deviceManager) DeviceManager deviceManager)
@ -33,14 +31,6 @@ namespace Artemis.Managers
_loopTimer = new Timer(40); _loopTimer = new Timer(40);
_loopTimer.Elapsed += Render; _loopTimer.Elapsed += Render;
_loopTimer.Start(); _loopTimer.Start();
var fpsTimer = new Timer(1000);
fpsTimer.Elapsed += delegate
{
Debug.WriteLine(_fpsCount);
_fpsCount = 0;
};
fpsTimer.Start();
} }
/// <summary> /// <summary>
@ -155,10 +145,7 @@ namespace Artemis.Managers
// If no bitmap was generated this frame is done // If no bitmap was generated this frame is done
if (bitmap == null) if (bitmap == null)
{
_fpsCount++;
return; return;
}
// Fill the bitmap's background with black to avoid trailing colors on some keyboards // Fill the bitmap's background with black to avoid trailing colors on some keyboards
var fixedBmp = new Bitmap(bitmap.Width, bitmap.Height); var fixedBmp = new Bitmap(bitmap.Width, bitmap.Height);
@ -172,8 +159,6 @@ namespace Artemis.Managers
// Update the keyboard // Update the keyboard
_deviceManager.ActiveKeyboard?.DrawBitmap(bitmap); _deviceManager.ActiveKeyboard?.DrawBitmap(bitmap);
_fpsCount++;
} }
} }
} }

View File

@ -43,7 +43,7 @@ namespace Artemis.Models
mouse = null; mouse = null;
headset = null; headset = null;
if (Profile == null || DataModel == null) if (Profile == null || DataModel == null || MainManager.DeviceManager.ActiveKeyboard == null)
return; return;
// Get all enabled layers who's conditions are met // Get all enabled layers who's conditions are met

View File

@ -1,13 +1,12 @@
using System.Collections.Generic; using Artemis.Managers;
using Artemis.Managers;
using Artemis.Models.Interfaces; using Artemis.Models.Interfaces;
using Artemis.Models.Profiles;
namespace Artemis.Models namespace Artemis.Models
{ {
public abstract class GameModel : EffectModel public abstract class GameModel : EffectModel
{ {
protected GameModel(MainManager mainManager, GameSettings settings, IDataModel dataModel) : base(mainManager, dataModel) protected GameModel(MainManager mainManager, GameSettings settings, IDataModel dataModel)
: base(mainManager, dataModel)
{ {
Settings = settings; Settings = settings;
} }

View File

@ -214,22 +214,6 @@ namespace Artemis.Models.Profiles
} }
} }
#region IChildItem<Parent> Members
LayerModel IChildItem<LayerModel>.Parent
{
get { return Parent; }
set { Parent = value; }
}
ProfileModel IChildItem<ProfileModel>.Parent
{
get { return Profile; }
set { Profile = value; }
}
#endregion
/// <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
@ -240,7 +224,8 @@ namespace Artemis.Models.Profiles
/// <param name="includeHeadsets">Whether or not to include headsets in the list</param> /// <param name="includeHeadsets">Whether or not to include headsets in the list</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<T>(IDataModel dataModel, bool includeMice, bool includeHeadsets, bool ignoreConditions = false) public List<LayerModel> GetRenderLayers<T>(IDataModel dataModel, bool includeMice, bool includeHeadsets,
bool ignoreConditions = false)
{ {
var layers = new List<LayerModel>(); var layers = new List<LayerModel>();
foreach (var layerModel in Children.OrderByDescending(c => c.Order)) foreach (var layerModel in Children.OrderByDescending(c => c.Order))
@ -262,6 +247,22 @@ namespace Artemis.Models.Profiles
return layers; return layers;
} }
#region IChildItem<Parent> Members
LayerModel IChildItem<LayerModel>.Parent
{
get { return Parent; }
set { Parent = value; }
}
ProfileModel IChildItem<ProfileModel>.Parent
{
get { return Profile; }
set { Profile = value; }
}
#endregion
} }
public enum LayerType public enum LayerType

View File

@ -126,7 +126,8 @@ namespace Artemis.Models.Profiles
/// <param name="includeHeadsets">Whether or not to include headsets in the list</param> /// <param name="includeHeadsets">Whether or not to include headsets in the list</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<T>(IDataModel dataModel, bool includeMice, bool includeHeadsets, bool ignoreConditions = false) public List<LayerModel> GetRenderLayers<T>(IDataModel dataModel, bool includeMice, bool includeHeadsets,
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))

View File

@ -63,7 +63,7 @@ namespace Artemis.Models.Profiles.Properties
private void ApplyWidth(ref AppliedProperties properties, double percentage) private void ApplyWidth(ref AppliedProperties properties, double percentage)
{ {
var newWidth = percentage * properties.Width; var newWidth = percentage*properties.Width;
var difference = properties.Width - newWidth; var difference = properties.Width - newWidth;
properties.Width = newWidth; properties.Width = newWidth;

View File

@ -1,5 +1,4 @@
using Artemis.Models.Interfaces; using Artemis.Models.Interfaces;
using Artemis.Utilities;
namespace Artemis.Models.Profiles.Properties namespace Artemis.Models.Profiles.Properties
{ {

View File

@ -2,10 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Windows; using System.Windows;
using System.Windows.Media;
using System.Xml.Serialization; using System.Xml.Serialization;
using Artemis.Models.Interfaces; using Artemis.Models.Interfaces;
using Artemis.Utilities;
namespace Artemis.Models.Profiles.Properties namespace Artemis.Models.Profiles.Properties
{ {

View File

@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Windows.Media; using System.Windows.Media;
using System.Xml.Serialization; using System.Xml.Serialization;
using Artemis.Models.Interfaces; using Artemis.Models.Interfaces;
using Artemis.Utilities;
namespace Artemis.Models.Profiles.Properties namespace Artemis.Models.Profiles.Properties
{ {

View File

@ -6,7 +6,7 @@ namespace Artemis.Models.Profiles.Properties
{ {
public override AppliedProperties GetAppliedProperties(IDataModel dataModel, bool ignoreDynamic = false) public override AppliedProperties GetAppliedProperties(IDataModel dataModel, bool ignoreDynamic = false)
{ {
return new AppliedProperties { Brush = Brush }; return new AppliedProperties {Brush = Brush};
} }
} }
} }

View File

@ -190,7 +190,8 @@ namespace Artemis.Modules.Effects.AudioVisualizer
return null; return null;
} }
public override void Render(out Bitmap keyboard, out Brush mouse, out Brush headset, bool renderMice, bool renderHeadsets) public override void Render(out Bitmap keyboard, out Brush mouse, out Brush headset, bool renderMice,
bool renderHeadsets)
{ {
keyboard = null; keyboard = null;
mouse = null; mouse = null;

View File

@ -14,7 +14,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
events.Subscribe(this); events.Subscribe(this);
MainManager.EffectManager.EffectModels.Add(EffectModel); MainManager.EffectManager.EffectModels.Add(EffectModel);
EffectSettings = ((AudioVisualizerModel)EffectModel).Settings; EffectSettings = ((AudioVisualizerModel) EffectModel).Settings;
} }
public void Handle(ActiveEffectChanged message) public void Handle(ActiveEffectChanged message)

View File

@ -35,7 +35,8 @@ namespace Artemis.Modules.Effects.ProfilePreview
return Profile.GetRenderLayers<ProfilePreviewDataModel>(DataModel, renderMice, renderHeadsets, true); return Profile.GetRenderLayers<ProfilePreviewDataModel>(DataModel, renderMice, renderHeadsets, true);
} }
public override void Render(out Bitmap keyboard, out Brush mouse, out Brush headset, bool renderMice, bool renderHeadsets) public override void Render(out Bitmap keyboard, out Brush mouse, out Brush headset, bool renderMice,
bool renderHeadsets)
{ {
keyboard = null; keyboard = null;
mouse = null; mouse = null;
@ -48,11 +49,13 @@ namespace Artemis.Modules.Effects.ProfilePreview
var renderLayers = GetRenderLayers(renderMice, renderHeadsets); var renderLayers = GetRenderLayers(renderMice, renderHeadsets);
// Render the keyboard layer-by-layer // Render the keyboard layer-by-layer
keyboard = Profile?.GenerateBitmap(renderLayers, DataModel, MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(4), true, true); keyboard = Profile?.GenerateBitmap(renderLayers, DataModel,
MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(4), true, true);
// Render the first enabled mouse (will default to null if renderMice was false) // Render the first enabled mouse (will default to null if renderMice was false)
mouse = Profile?.GenerateBrush(renderLayers.LastOrDefault(l => l.LayerType == LayerType.Mouse), DataModel); mouse = Profile?.GenerateBrush(renderLayers.LastOrDefault(l => l.LayerType == LayerType.Mouse), DataModel);
// Render the first enabled headset (will default to null if renderHeadsets was false) // Render the first enabled headset (will default to null if renderHeadsets was false)
headset = Profile?.GenerateBrush(renderLayers.LastOrDefault(l => l.LayerType == LayerType.Headset), DataModel); headset = Profile?.GenerateBrush(renderLayers.LastOrDefault(l => l.LayerType == LayerType.Headset),
DataModel);
} }
} }

View File

@ -98,7 +98,8 @@ namespace Artemis.Modules.Effects.TypeWave
return null; return null;
} }
public override void Render(out Bitmap keyboard, out Brush mouse, out Brush headset, bool renderMice, bool renderHeadsets) public override void Render(out Bitmap keyboard, out Brush mouse, out Brush headset, bool renderMice,
bool renderHeadsets)
{ {
keyboard = null; keyboard = null;
mouse = null; mouse = null;
@ -120,7 +121,7 @@ namespace Artemis.Modules.Effects.TypeWave
if (_waves[i].Size == 0) if (_waves[i].Size == 0)
continue; continue;
var path = new GraphicsPath(); var path = new GraphicsPath();
path.AddEllipse(_waves[i].Point.X - _waves[i].Size / 2, _waves[i].Point.Y - _waves[i].Size / 2, path.AddEllipse(_waves[i].Point.X - _waves[i].Size/2, _waves[i].Point.Y - _waves[i].Size/2,
_waves[i].Size, _waves[i].Size); _waves[i].Size, _waves[i].Size);
Color fillColor; Color fillColor;
@ -131,7 +132,7 @@ namespace Artemis.Modules.Effects.TypeWave
var pthGrBrush = new PathGradientBrush(path) var pthGrBrush = new PathGradientBrush(path)
{ {
SurroundColors = new[] { _waves[i].Color }, SurroundColors = new[] {_waves[i].Color},
CenterColor = fillColor CenterColor = fillColor
}; };
@ -139,8 +140,8 @@ namespace Artemis.Modules.Effects.TypeWave
pthGrBrush.FocusScales = new PointF(0.3f, 0.8f); pthGrBrush.FocusScales = new PointF(0.3f, 0.8f);
g.FillPath(pthGrBrush, path); g.FillPath(pthGrBrush, path);
g.DrawEllipse(new Pen(pthGrBrush, 1), _waves[i].Point.X - _waves[i].Size / 2, g.DrawEllipse(new Pen(pthGrBrush, 1), _waves[i].Point.X - _waves[i].Size/2,
_waves[i].Point.Y - _waves[i].Size / 2, _waves[i].Size, _waves[i].Size); _waves[i].Point.Y - _waves[i].Size/2, _waves[i].Size, _waves[i].Size);
} }
} }
} }

View File

@ -14,7 +14,7 @@ namespace Artemis.Modules.Effects.TypeWave
events.Subscribe(this); events.Subscribe(this);
MainManager.EffectManager.EffectModels.Add(EffectModel); MainManager.EffectManager.EffectModels.Add(EffectModel);
EffectSettings = ((TypeWaveModel)EffectModel).Settings; EffectSettings = ((TypeWaveModel) EffectModel).Settings;
} }
public void Handle(ActiveEffectChanged message) public void Handle(ActiveEffectChanged message)

View File

@ -0,0 +1,38 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Artemis.Modules.Effects.WindowsProfile {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class WindowsProfile : global::System.Configuration.ApplicationSettingsBase {
private static WindowsProfile defaultInstance = ((WindowsProfile)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new WindowsProfile())));
public static WindowsProfile Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Demo (Duplicate to keep changes)")]
public string LastProfile {
get {
return ((string)(this["LastProfile"]));
}
set {
this["LastProfile"] = value;
}
}
}
}

View File

@ -0,0 +1,11 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Effects.WindowsProfile" GeneratedClassName="WindowsProfile">
<Profiles />
<Settings>
<Setting Name="LastProfile" Type="System.String" Scope="User">
<Value Profile="(Default)">Demo (Duplicate to keep changes)</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -1,18 +1,17 @@
using Artemis.Models.Interfaces; using Artemis.Models.Interfaces;
using SpotifyAPI.Local.Models;
namespace Artemis.Modules.Effects.WindowsProfile namespace Artemis.Modules.Effects.WindowsProfile
{ {
public class WindowsProfileDataModel : IDataModel public class WindowsProfileDataModel : IDataModel
{ {
public CpuDataModel Cpu { get; set; }
public Spotify Spotify { get; set; }
public WindowsProfileDataModel() public WindowsProfileDataModel()
{ {
Spotify = new Spotify(); Spotify = new Spotify();
Cpu = new CpuDataModel(); Cpu = new CpuDataModel();
} }
public CpuDataModel Cpu { get; set; }
public Spotify Spotify { get; set; }
} }
public class CpuDataModel public class CpuDataModel
@ -26,6 +25,7 @@ namespace Artemis.Modules.Effects.WindowsProfile
public int Core7Usage { get; set; } public int Core7Usage { get; set; }
public int Core8Usage { get; set; } public int Core8Usage { get; set; }
} }
public class Spotify public class Spotify
{ {
public bool Running { get; set; } public bool Running { get; set; }
@ -37,5 +37,6 @@ namespace Artemis.Modules.Effects.WindowsProfile
public bool Repeat { get; set; } public bool Repeat { get; set; }
public bool Shuffle { get; set; } public bool Shuffle { get; set; }
public bool Playing { get; set; } public bool Playing { get; set; }
public int SongLength { get; set; }
} }
} }

View File

@ -1,11 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Artemis.Managers; using Artemis.Managers;
using Artemis.Models; using Artemis.Models;
using Artemis.Models.Profiles; using Artemis.Models.Profiles;
using SpotifyAPI.Local; using SpotifyAPI.Local;
using SpotifyAPI.Local.Models;
namespace Artemis.Modules.Effects.WindowsProfile namespace Artemis.Modules.Effects.WindowsProfile
{ {
@ -13,14 +14,14 @@ namespace Artemis.Modules.Effects.WindowsProfile
{ {
private List<PerformanceCounter> _cores; private List<PerformanceCounter> _cores;
private int _cpuFrames; private int _cpuFrames;
private readonly SpotifyLocalAPI _spotify; private SpotifyLocalAPI _spotify;
private bool _spotifySetupBusy;
public WindowsProfileModel(MainManager mainManager, WindowsProfileSettings settings) public WindowsProfileModel(MainManager mainManager, WindowsProfileSettings settings)
: base(mainManager, new WindowsProfileDataModel()) : base(mainManager, new WindowsProfileDataModel())
{ {
Name = "WindowsProfile"; Name = "WindowsProfile";
Settings = settings; Settings = settings;
_spotify = new SpotifyLocalAPI();
} }
public WindowsProfileSettings Settings { get; set; } public WindowsProfileSettings Settings { get; set; }
@ -32,19 +33,8 @@ namespace Artemis.Modules.Effects.WindowsProfile
public override void Enable() public override void Enable()
{ {
// Setup CPU cores SetupCpu();
_cores = GetPerformanceCounters(); SetupSpotify();
var coreCount = _cores.Count;
while (coreCount < 8)
{
_cores.Add(null);
coreCount++;
}
if (SpotifyLocalAPI.IsSpotifyRunning())
{
_spotify.Connect();
}
Initialized = true; Initialized = true;
} }
@ -56,6 +46,19 @@ namespace Artemis.Modules.Effects.WindowsProfile
UpdateSpotify(dataModel); UpdateSpotify(dataModel);
} }
#region CPU
private void SetupCpu()
{
_cores = GetPerformanceCounters();
var coreCount = _cores.Count;
while (coreCount < 8)
{
_cores.Add(null);
coreCount++;
}
}
private void UpdateCpu(WindowsProfileDataModel dataModel) private void UpdateCpu(WindowsProfileDataModel dataModel)
{ {
// CPU is only updated every 15 frames, the performance counter gives 0 if updated too often // CPU is only updated every 15 frames, the performance counter gives 0 if updated too often
@ -67,26 +70,26 @@ namespace Artemis.Modules.Effects.WindowsProfile
// Update cores, not ideal but data models don't support lists. // Update cores, not ideal but data models don't support lists.
if (_cores[0] != null) if (_cores[0] != null)
dataModel.Cpu.Core1Usage = (int)_cores[0].NextValue(); dataModel.Cpu.Core1Usage = (int) _cores[0].NextValue();
if (_cores[1] != null) if (_cores[1] != null)
dataModel.Cpu.Core2Usage = (int)_cores[1].NextValue(); dataModel.Cpu.Core2Usage = (int) _cores[1].NextValue();
if (_cores[2] != null) if (_cores[2] != null)
dataModel.Cpu.Core3Usage = (int)_cores[2].NextValue(); dataModel.Cpu.Core3Usage = (int) _cores[2].NextValue();
if (_cores[3] != null) if (_cores[3] != null)
dataModel.Cpu.Core4Usage = (int)_cores[3].NextValue(); dataModel.Cpu.Core4Usage = (int) _cores[3].NextValue();
if (_cores[4] != null) if (_cores[4] != null)
dataModel.Cpu.Core5Usage = (int)_cores[4].NextValue(); dataModel.Cpu.Core5Usage = (int) _cores[4].NextValue();
if (_cores[5] != null) if (_cores[5] != null)
dataModel.Cpu.Core6Usage = (int)_cores[5].NextValue(); dataModel.Cpu.Core6Usage = (int) _cores[5].NextValue();
if (_cores[6] != null) if (_cores[6] != null)
dataModel.Cpu.Core7Usage = (int)_cores[6].NextValue(); dataModel.Cpu.Core7Usage = (int) _cores[6].NextValue();
if (_cores[7] != null) if (_cores[7] != null)
dataModel.Cpu.Core8Usage = (int)_cores[7].NextValue(); dataModel.Cpu.Core8Usage = (int) _cores[7].NextValue();
} }
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets) public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
{ {
return Profile.GetRenderLayers<WindowsProfileDataModel>(DataModel, renderMice, renderHeadsets, true); return Profile.GetRenderLayers<WindowsProfileDataModel>(DataModel, renderMice, renderHeadsets, false);
} }
public static List<PerformanceCounter> GetPerformanceCounters() public static List<PerformanceCounter> GetPerformanceCounters()
@ -101,29 +104,66 @@ namespace Artemis.Modules.Effects.WindowsProfile
return performanceCounters; return performanceCounters;
} }
#endregion
#region Spotify
public void SetupSpotify()
{
if (_spotifySetupBusy)
return;
_spotifySetupBusy = true;
_spotify = new SpotifyLocalAPI {ListenForEvents = true};
_spotify.OnPlayStateChange += UpdateSpotifyPlayState;
_spotify.OnTrackChange += UpdateSpotifyTrack;
_spotify.OnTrackTimeChange += UpdateSpotifyTrackTime;
// Connecting can sometimes use a little bit more conviction
Task.Factory.StartNew(() =>
{
var tryCount = 0;
while (tryCount <= 10)
{
tryCount++;
var connected = _spotify.Connect();
if (connected)
break;
Thread.Sleep(1000);
}
_spotifySetupBusy = false;
});
}
public void UpdateSpotify(WindowsProfileDataModel dataModel) public void UpdateSpotify(WindowsProfileDataModel dataModel)
{ {
StatusResponse status = _spotify.GetStatus(); if (!dataModel.Spotify.Running && SpotifyLocalAPI.IsSpotifyRunning())
if (status == null) SetupSpotify();
{
dataModel.Spotify.Running = false;
return;
}
dataModel.Spotify.Running = true; dataModel.Spotify.Running = SpotifyLocalAPI.IsSpotifyRunning();
dataModel.Spotify.SpotifyVolume = (int)(status.Volume * 100);
dataModel.Spotify.Repeat = status.Repeat;
dataModel.Spotify.Shuffle = status.Shuffle;
dataModel.Spotify.Playing = status.Playing;
// Only update track info if not null
if (status.Track == null)
return;
dataModel.Spotify.Artist = status.Track.ArtistResource?.Name;
dataModel.Spotify.SongName = status.Track.TrackResource?.Name;
dataModel.Spotify.SongPercentCompleted = (int)(status.PlayingPosition / status.Track.Length * 100.0);
dataModel.Spotify.Album = status.Track.AlbumResource?.Name;
} }
private void UpdateSpotifyPlayState(object sender, PlayStateEventArgs e)
{
((WindowsProfileDataModel) DataModel).Spotify.Playing = e.Playing;
}
private void UpdateSpotifyTrack(object sender, TrackChangeEventArgs e)
{
var dataModel = (WindowsProfileDataModel) DataModel;
dataModel.Spotify.Artist = e.NewTrack.ArtistResource?.Name;
dataModel.Spotify.SongName = e.NewTrack.TrackResource?.Name;
dataModel.Spotify.Album = e.NewTrack.AlbumResource?.Name;
dataModel.Spotify.SongLength = e.NewTrack.Length;
}
private void UpdateSpotifyTrackTime(object sender, TrackTimeChangeEventArgs e)
{
var dataModel = (WindowsProfileDataModel) DataModel;
if (dataModel.Spotify.SongLength > 0)
dataModel.Spotify.SongPercentCompleted = (int) (e.TrackTime/dataModel.Spotify.SongLength*100.0);
}
#endregion
} }
} }

View File

@ -0,0 +1,28 @@
using Artemis.Models;
namespace Artemis.Modules.Effects.WindowsProfile
{
public class WindowsProfileSettings : GameSettings
{
public WindowsProfileSettings()
{
Load();
}
public sealed override void Load()
{
LastProfile = WindowsProfile.Default.LastProfile;
}
public sealed override void Save()
{
WindowsProfile.Default.LastProfile = LastProfile;
WindowsProfile.Default.Save();
}
public sealed override void ToDefault()
{
}
}
}

View File

@ -2,7 +2,6 @@
using Artemis.Events; using Artemis.Events;
using Artemis.InjectionFactories; using Artemis.InjectionFactories;
using Artemis.Managers; using Artemis.Managers;
using Artemis.Models;
using Artemis.Modules.Effects.ProfilePreview; using Artemis.Modules.Effects.ProfilePreview;
using Artemis.ViewModels.Abstract; using Artemis.ViewModels.Abstract;
using Artemis.ViewModels.Profiles; using Artemis.ViewModels.Profiles;
@ -20,9 +19,9 @@ namespace Artemis.Modules.Effects.WindowsProfile
DisplayName = "Windows Profile"; DisplayName = "Windows Profile";
PFactory = pFactory; PFactory = pFactory;
ProfilePreviewModel = profilePreviewModel; ProfilePreviewModel = profilePreviewModel;
EffectSettings = ((WindowsProfileModel)EffectModel).Settings; EffectSettings = ((WindowsProfileModel) EffectModel).Settings;
ProfileEditor = PFactory.CreateProfileEditorVm(events, main, (WindowsProfileModel)EffectModel, ProfileEditor = PFactory.CreateProfileEditorVm(events, main, (WindowsProfileModel) EffectModel,
((WindowsProfileSettings)EffectSettings).LastProfile); ((WindowsProfileSettings) EffectSettings).LastProfile);
ProfilePreviewModel.Profile = ProfileEditor.SelectedProfile; ProfilePreviewModel.Profile = ProfileEditor.SelectedProfile;
events.Subscribe(this); events.Subscribe(this);
@ -35,6 +34,11 @@ namespace Artemis.Modules.Effects.WindowsProfile
public IProfileEditorVmFactory PFactory { get; set; } public IProfileEditorVmFactory PFactory { get; set; }
public ProfilePreviewModel ProfilePreviewModel { get; set; } public ProfilePreviewModel ProfilePreviewModel { get; set; }
public void Handle(ActiveEffectChanged message)
{
NotifyOfPropertyChange(() => EffectEnabled);
}
private void ProfileUpdater(object sender, PropertyChangedEventArgs e) private void ProfileUpdater(object sender, PropertyChangedEventArgs e)
{ {
if (e.PropertyName != "SelectedProfile" && IsActive) if (e.PropertyName != "SelectedProfile" && IsActive)
@ -45,7 +49,7 @@ namespace Artemis.Modules.Effects.WindowsProfile
if (e.PropertyName != "SelectedProfile" || !ProfileEditor.ProfileViewModel.Activated || if (e.PropertyName != "SelectedProfile" || !ProfileEditor.ProfileViewModel.Activated ||
ProfileEditor.ProfileViewModel.SelectedProfile == null) ProfileEditor.ProfileViewModel.SelectedProfile == null)
return; return;
((WindowsProfileSettings)EffectSettings).LastProfile = ProfileEditor.ProfileViewModel.SelectedProfile.Name; ((WindowsProfileSettings) EffectSettings).LastProfile = ProfileEditor.ProfileViewModel.SelectedProfile.Name;
EffectSettings.Save(); EffectSettings.Save();
} }
@ -60,25 +64,5 @@ namespace Artemis.Modules.Effects.WindowsProfile
base.OnDeactivate(close); base.OnDeactivate(close);
ProfileEditor.ProfileViewModel.Deactivate(); ProfileEditor.ProfileViewModel.Deactivate();
} }
public void Handle(ActiveEffectChanged message)
{
NotifyOfPropertyChange(() => EffectEnabled);
}
}
public class WindowsProfileSettings : GameSettings
{
public override void Load()
{
}
public override void Save()
{
}
public override void ToDefault()
{
}
} }
} }

View File

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User"> <Setting Name="Enabled" Type="System.Boolean" Scope="User">

View File

@ -23,7 +23,7 @@ namespace Artemis.Modules.Games.Dota2
public void FindGameDir() public void FindGameDir()
{ {
var gameSettings = (Dota2Settings)GameSettings; var gameSettings = (Dota2Settings) GameSettings;
// If already propertly set up, don't do anything // If already propertly set up, don't do anything
if (gameSettings.GameDirectory != null && File.Exists(gameSettings.GameDirectory + "csgo.exe") && if (gameSettings.GameDirectory != null && File.Exists(gameSettings.GameDirectory + "csgo.exe") &&
File.Exists(gameSettings.GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg")) File.Exists(gameSettings.GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg"))
@ -80,7 +80,7 @@ namespace Artemis.Modules.Games.Dota2
} }
DialogService.ShowErrorMessageBox("Please select a valid Dota 2 directory\n\n" + DialogService.ShowErrorMessageBox("Please select a valid Dota 2 directory\n\n" +
@"By default Dota 2 is in \SteamApps\common\dota 2 beta"); @"By default Dota 2 is in \SteamApps\common\dota 2 beta");
((Dota2Settings) GameSettings).GameDirectory = string.Empty; ((Dota2Settings) GameSettings).GameDirectory = string.Empty;
NotifyOfPropertyChange(() => GameSettings); NotifyOfPropertyChange(() => GameSettings);

View File

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.Overwatch" GeneratedClassName="Overwatch">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Games.Overwatch" GeneratedClassName="Overwatch">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User"> <Setting Name="Enabled" Type="System.Boolean" Scope="User">

View File

@ -9,6 +9,8 @@ namespace Artemis.Modules.Games.Overwatch
Load(); Load();
} }
public string GameDirectory { get; set; }
public sealed override void Load() public sealed override void Load()
{ {
Enabled = Overwatch.Default.Enabled; Enabled = Overwatch.Default.Enabled;
@ -25,8 +27,6 @@ namespace Artemis.Modules.Games.Overwatch
Overwatch.Default.Save(); Overwatch.Default.Save();
} }
public string GameDirectory { get; set; }
public sealed override void ToDefault() public sealed override void ToDefault()
{ {
Enabled = true; Enabled = true;

View File

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.RocketLeague" GeneratedClassName="RocketLeague">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Games.RocketLeague" GeneratedClassName="RocketLeague">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User"> <Setting Name="Enabled" Type="System.Boolean" Scope="User">

View File

@ -1,5 +1,4 @@
using System.Windows.Media; using Artemis.Models;
using Artemis.Models;
namespace Artemis.Modules.Games.RocketLeague namespace Artemis.Modules.Games.RocketLeague
{ {

View File

@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Artemis.Managers; using Artemis.Managers;
@ -7,7 +6,6 @@ using Artemis.Models;
using Artemis.Models.Profiles; using Artemis.Models.Profiles;
using Artemis.Utilities; using Artemis.Utilities;
using Artemis.Utilities.LogitechDll; using Artemis.Utilities.LogitechDll;
using Brush = System.Windows.Media.Brush;
namespace Artemis.Modules.Games.TheDivision namespace Artemis.Modules.Games.TheDivision
{ {
@ -94,7 +92,7 @@ namespace Artemis.Modules.Games.TheDivision
newState = PlayerState.Offline; newState = PlayerState.Offline;
if (playerId == 1) if (playerId == 1)
gameDataModel.LowHp = (newState == PlayerState.Hit); gameDataModel.LowHp = newState == PlayerState.Hit;
else if (playerId == 2) else if (playerId == 2)
gameDataModel.PartyMember1 = newState; gameDataModel.PartyMember1 = newState;
else if (playerId == 3) else if (playerId == 3)

View File

@ -39,7 +39,9 @@
TextAlignment="Justify" Margin="5,0,0,10"> 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. 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> </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" /> <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 --> <!-- Profile editor -->
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" /> <ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />

View File

@ -94,7 +94,7 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
public override void RenderOverlay(ref Bitmap keyboard, ref Brush mouse, ref Brush headset, bool renderMice, public override void RenderOverlay(ref Bitmap keyboard, ref Brush mouse, ref Brush headset, bool renderMice,
bool renderHeadsets) bool renderHeadsets)
{ {
keyboard= GenerateBitmap(keyboard ?? MainManager.DeviceManager.ActiveKeyboard.KeyboardBitmap(4)); keyboard = GenerateBitmap(keyboard ?? MainManager.DeviceManager.ActiveKeyboard.KeyboardBitmap(4));
} }
} }
} }

View File

@ -1,20 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true" autoReload="true"
throwExceptions="false" throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" > internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<targets> <targets>
<target name="file" <target name="file"
xsi:type="File" xsi:type="File"
maxArchiveFiles="7" maxArchiveFiles="7"
fileName="${specialfolder:folder=MyDocuments}/Artemis/logs/${shortdate}.txt" fileName="${specialfolder:folder=MyDocuments}/Artemis/logs/${shortdate}.txt"
layout="${longdate}|${level:uppercase=true}|${logger}|${message} ${exception:format=tostring}"/> layout="${longdate}|${level:uppercase=true}|${logger}|${message} ${exception:format=tostring}" />
<target name="debugger" <target name="debugger"
xsi:type="Debugger" xsi:type="Debugger"
layout="${logger:shortName=True} - ${uppercase:${level}}: ${message}"/> layout="${logger:shortName=True} - ${uppercase:${level}}: ${message}" />
</targets> </targets>
<rules> <rules>

View File

@ -265,6 +265,16 @@ namespace Artemis.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap none {
get {
object obj = ResourceManager.GetObject("none", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to /***********************************************************************/ /// Looks up a localized string similar to /***********************************************************************/
////** © 2015 CD PROJEKT S.A. All rights reserved. ////** © 2015 CD PROJEKT S.A. All rights reserved.

View File

@ -178,4 +178,7 @@
<data name="defaultProfiles" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="defaultProfiles" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Keyboards\default-profiles.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>..\Resources\Keyboards\default-profiles.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="none" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Keyboards\none.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -27,7 +27,6 @@ using Caliburn.Micro;
using MahApps.Metro.Controls; using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs; using MahApps.Metro.Controls.Dialogs;
using Microsoft.Win32; using Microsoft.Win32;
using Ninject;
namespace Artemis.Services namespace Artemis.Services
{ {

View File

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="General">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="General">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="LastEffect" Type="System.String" Scope="User"> <Setting Name="LastEffect" Type="System.String" Scope="User">

View File

@ -50,7 +50,7 @@ namespace Artemis.Styles.DropTargetAdorners
// Create the pen and triangle in a static constructor and freeze them to improve performance. // Create the pen and triangle in a static constructor and freeze them to improve performance.
const int triangleSize = 5; const int triangleSize = 5;
var color = (Color)ThemeManager.DetectAppStyle(Application.Current).Item2.Resources["AccentColor"]; var color = (Color) ThemeManager.DetectAppStyle(Application.Current).Item2.Resources["AccentColor"];
m_Pen = new Pen(new SolidColorBrush(color), 2); m_Pen = new Pen(new SolidColorBrush(color), 2);
m_Pen.Freeze(); m_Pen.Freeze();
@ -59,7 +59,7 @@ namespace Artemis.Styles.DropTargetAdorners
var secondLine = new LineSegment(new Point(0, triangleSize), false); var secondLine = new LineSegment(new Point(0, triangleSize), false);
secondLine.Freeze(); secondLine.Freeze();
var figure = new PathFigure { StartPoint = new Point(triangleSize, 0) }; var figure = new PathFigure {StartPoint = new Point(triangleSize, 0)};
figure.Segments.Add(firstLine); figure.Segments.Add(firstLine);
figure.Segments.Add(secondLine); figure.Segments.Add(secondLine);
figure.Freeze(); figure.Freeze();
@ -109,7 +109,7 @@ namespace Artemis.Styles.DropTargetAdorners
} }
} }
var itemContainer = (UIElement)itemParent.ItemContainerGenerator.ContainerFromIndex(index); var itemContainer = (UIElement) itemParent.ItemContainerGenerator.ContainerFromIndex(index);
if (itemContainer != null) if (itemContainer != null)
{ {

View File

@ -1,9 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Windows.Media;
using Brush = System.Windows.Media.Brush;
using Color = System.Drawing.Color;
namespace Artemis.Utilities namespace Artemis.Utilities
{ {

View File

@ -1,4 +1,6 @@
using System.Text.RegularExpressions; using System.IO;
using System.IO.Compression;
using System.Text.RegularExpressions;
namespace Artemis.Utilities namespace Artemis.Utilities
{ {
@ -19,6 +21,30 @@ namespace Artemis.Utilities
#endregion #endregion
#region Zip files
public static void ExtractToDirectory(this ZipArchive archive, string destinationDirectoryName, bool overwrite)
{
if (!overwrite)
{
archive.ExtractToDirectory(destinationDirectoryName);
return;
}
foreach (var file in archive.Entries)
{
var completeFileName = Path.Combine(destinationDirectoryName, file.FullName);
if (file.Name == "")
{
// Assuming Empty for Directory
Directory.CreateDirectory(Path.GetDirectoryName(completeFileName));
continue;
}
file.ExtractToFile(completeFileName, true);
}
}
#endregion
#region Color #region Color
// TODO: Convert ColorHelpers to ExtensionMethods // TODO: Convert ColorHelpers to ExtensionMethods

View File

@ -5,8 +5,6 @@ using System.IO;
using System.Reflection; using System.Reflection;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows; using System.Windows;
using System.Windows.Markup;
using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
using Microsoft.Win32; using Microsoft.Win32;
using static System.String; using static System.String;

View File

@ -1,12 +1,9 @@
using System; using System.Drawing;
using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using PixelFormat = System.Drawing.Imaging.PixelFormat;
namespace Artemis.Utilities namespace Artemis.Utilities
{ {

View File

@ -15,13 +15,13 @@ namespace Artemis.Utilities.Layers
case LayerAnimation.SlideLeft: case LayerAnimation.SlideLeft:
if (progress + 1 >= properties.Width*scale) if (progress + 1 >= properties.Width*scale)
progress = 0; progress = 0;
progress = progress + properties.AnimationSpeed * 2; progress = progress + properties.AnimationSpeed*2;
break; break;
case LayerAnimation.SlideDown: case LayerAnimation.SlideDown:
case LayerAnimation.SlideUp: case LayerAnimation.SlideUp:
if (progress + 1 >= properties.Height*scale) if (progress + 1 >= properties.Height*scale)
progress = 0; progress = 0;
progress = progress + properties.AnimationSpeed * 2; progress = progress + properties.AnimationSpeed*2;
break; break;
case LayerAnimation.Pulse: case LayerAnimation.Pulse:
if (progress > 2) if (progress > 2)
@ -31,7 +31,7 @@ namespace Artemis.Utilities.Layers
case LayerAnimation.Grow: case LayerAnimation.Grow:
if (progress > 10) if (progress > 10)
progress = 0; progress = 0;
progress = progress + properties.AnimationSpeed / 2.5; progress = progress + properties.AnimationSpeed/2.5;
break; break;
default: default:
progress = progress + properties.AnimationSpeed*2; progress = progress + properties.AnimationSpeed*2;

View File

@ -31,7 +31,6 @@ namespace Artemis.Utilities.LogitechDll
{ {
return false; return false;
} }
} }
public static void PlaceDll() public static void PlaceDll()

View File

@ -21,6 +21,7 @@ namespace Artemis.ViewModels.Abstract
[Inject] [Inject]
public MetroDialogService DialogService { get; set; } public MetroDialogService DialogService { get; set; }
public EffectSettings EffectSettings public EffectSettings EffectSettings
{ {
get { return _effectSettings; } get { return _effectSettings; }

View File

@ -18,6 +18,7 @@ namespace Artemis.ViewModels.Abstract
[Inject] [Inject]
public MetroDialogService DialogService { get; set; } public MetroDialogService DialogService { get; set; }
public OverlayModel OverlayModel { get; set; } public OverlayModel OverlayModel { get; set; }
public OverlaySettings OverlaySettings public OverlaySettings OverlaySettings

View File

@ -145,8 +145,7 @@ namespace Artemis.ViewModels.Flyouts
if (EnableDebug) if (EnableDebug)
rule.EnableLoggingForLevel(LogLevel.Debug); rule.EnableLoggingForLevel(LogLevel.Debug);
else rule.DisableLoggingForLevel(LogLevel.Debug);
rule.DisableLoggingForLevel(LogLevel.Debug);
LogManager.ReconfigExistingLoggers(); LogManager.ReconfigExistingLoggers();
_logger.Info("Set debug logging to: {0}", EnableDebug); _logger.Info("Set debug logging to: {0}", EnableDebug);

View File

@ -8,7 +8,8 @@ namespace Artemis.ViewModels
{ {
private readonly GameViewModel[] _gameViewModels; private readonly GameViewModel[] _gameViewModels;
public GamesViewModel(GameViewModel[] gameViewModels, ProfileManager profileManager, ProfilePreviewModel profilePreviewModel) public GamesViewModel(GameViewModel[] gameViewModels, ProfileManager profileManager,
ProfilePreviewModel profilePreviewModel)
{ {
DisplayName = "Games"; DisplayName = "Games";
_gameViewModels = gameViewModels; _gameViewModels = gameViewModels;

View File

@ -213,7 +213,7 @@ namespace Artemis.ViewModels.Profiles
SelectedDataModelProp = DataModelProps.FirstOrDefault(m => m.Path == LayerConditionModel.Field); SelectedDataModelProp = DataModelProps.FirstOrDefault(m => m.Path == LayerConditionModel.Field);
SelectedOperator = Operators.FirstOrDefault(o => o.Value == LayerConditionModel.Operator); SelectedOperator = Operators.FirstOrDefault(o => o.Value == LayerConditionModel.Operator);
LayerConditionModel.Type = SelectedDataModelProp.Type; LayerConditionModel.Type = SelectedDataModelProp.Type;
if (LayerConditionModel.Type =="Enum") if (LayerConditionModel.Type == "Enum")
SelectedEnum = LayerConditionModel.Value; SelectedEnum = LayerConditionModel.Value;
else else
UserValue = LayerConditionModel.Value; UserValue = LayerConditionModel.Value;

View File

@ -2,8 +2,6 @@
using System.ComponentModel; using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Timers;
using System.Xml.Serialization;
using Artemis.Models.Interfaces; using Artemis.Models.Interfaces;
using Artemis.Models.Profiles; using Artemis.Models.Profiles;
using Artemis.Models.Profiles.Properties; using Artemis.Models.Profiles.Properties;
@ -11,7 +9,6 @@ using Artemis.Services;
using Artemis.Utilities; using Artemis.Utilities;
using Artemis.ViewModels.Profiles.Properties; using Artemis.ViewModels.Profiles.Properties;
using Caliburn.Micro; using Caliburn.Micro;
using Newtonsoft.Json;
using Ninject; using Ninject;
namespace Artemis.ViewModels.Profiles namespace Artemis.ViewModels.Profiles
@ -169,7 +166,6 @@ namespace Artemis.ViewModels.Profiles
Layer.Properties.Conditions.Clear(); Layer.Properties.Conditions.Clear();
foreach (var conditionViewModel in LayerConditionVms) foreach (var conditionViewModel in LayerConditionVms)
{ {
Layer.Properties.Conditions.Add(conditionViewModel.LayerConditionModel); Layer.Properties.Conditions.Add(conditionViewModel.LayerConditionModel);
} }
@ -206,7 +202,8 @@ namespace Artemis.ViewModels.Profiles
return; return;
} }
var close = await DialogService.ShowQuestionMessageBox("Unsaved changes", "Do you want to discard your changes?"); var close =
await DialogService.ShowQuestionMessageBox("Unsaved changes", "Do you want to discard your changes?");
callback(close.Value); callback(close.Value);
} }
} }

View File

@ -69,7 +69,10 @@ namespace Artemis.ViewModels.Profiles
public ProfileViewModel ProfileViewModel { get; set; } public ProfileViewModel ProfileViewModel { get; set; }
public bool EditorEnabled => SelectedProfile != null && !SelectedProfile.IsDefault; public bool EditorEnabled
=>
SelectedProfile != null && !SelectedProfile.IsDefault &&
_mainManager.DeviceManager.ActiveKeyboard != null;
public BindableCollection<ProfileModel> Profiles public BindableCollection<ProfileModel> Profiles
{ {
@ -457,6 +460,13 @@ namespace Artemis.ViewModels.Profiles
/// </summary> /// </summary>
public async void AddProfile() public async void AddProfile()
{ {
if (_mainManager.DeviceManager.ActiveKeyboard == null)
{
DialogService.ShowMessageBox("Cannot add profile.",
"To add a profile, please select a keyboard in the options menu first.");
return;
}
var name = await DialogService.ShowInputDialog("Add new profile", var name = await DialogService.ShowInputDialog("Add new profile",
"Please provide a profile name unique to this game and keyboard."); "Please provide a profile name unique to this game and keyboard.");

View File

@ -10,6 +10,7 @@ using Artemis.Managers;
using Artemis.Models.Profiles; using Artemis.Models.Profiles;
using Artemis.Models.Profiles.Properties; using Artemis.Models.Profiles.Properties;
using Artemis.Modules.Effects.ProfilePreview; using Artemis.Modules.Effects.ProfilePreview;
using Artemis.Properties;
using Artemis.Utilities; using Artemis.Utilities;
using Caliburn.Micro; using Caliburn.Micro;
using MahApps.Metro; using MahApps.Metro;
@ -74,10 +75,8 @@ namespace Artemis.ViewModels.Profiles
} }
} }
public ImageSource KeyboardImage public ImageSource KeyboardImage => ImageUtilities
{ .BitmapToBitmapImage(_deviceManager.ActiveKeyboard?.PreviewSettings.Image ?? Resources.none);
get { return ImageUtilities.BitmapToBitmapImage(_deviceManager.ActiveKeyboard?.PreviewSettings.Image); }
}
public bool Activated { get; set; } public bool Activated { get; set; }
@ -91,7 +90,7 @@ namespace Artemis.ViewModels.Profiles
if (_blurProgress > 2) if (_blurProgress > 2)
_blurProgress = 0; _blurProgress = 0;
_blurProgress = _blurProgress + 0.025; _blurProgress = _blurProgress + 0.025;
BlurRadius = (Math.Sin(_blurProgress * Math.PI) + 1) * 10 + 10; BlurRadius = (Math.Sin(_blurProgress*Math.PI) + 1)*10 + 10;
if (SelectedProfile == null || _deviceManager.ActiveKeyboard == null) if (SelectedProfile == null || _deviceManager.ActiveKeyboard == null)
{ {
@ -120,12 +119,12 @@ namespace Artemis.ViewModels.Profiles
if (accentColor == null) if (accentColor == null)
return; return;
var pen = new Pen(new SolidColorBrush((Color)accentColor), 0.4); var pen = new Pen(new SolidColorBrush((Color) accentColor), 0.4);
// Draw the selection outline and resize indicator // Draw the selection outline and resize indicator
if (SelectedLayer != null && SelectedLayer.MustDraw()) if (SelectedLayer != null && SelectedLayer.MustDraw())
{ {
var layerRect = ((KeyboardPropertiesModel)SelectedLayer.Properties).GetRect(); var layerRect = ((KeyboardPropertiesModel) SelectedLayer.Properties).GetRect();
// Deflate the rect so that the border is drawn on the inside // Deflate the rect so that the border is drawn on the inside
layerRect.Inflate(-0.2, -0.2); layerRect.Inflate(-0.2, -0.2);
@ -192,13 +191,13 @@ namespace Artemis.ViewModels.Profiles
return; return;
var keyboard = _deviceManager.ActiveKeyboard; var keyboard = _deviceManager.ActiveKeyboard;
var pos = e.GetPosition((Image)e.OriginalSource); var pos = e.GetPosition((Image) e.OriginalSource);
var x = pos.X / ((double)keyboard.PreviewSettings.Width / keyboard.Width); var x = pos.X/((double) keyboard.PreviewSettings.Width/keyboard.Width);
var y = pos.Y / ((double)keyboard.PreviewSettings.Height / keyboard.Height); var y = pos.Y/((double) keyboard.PreviewSettings.Height/keyboard.Height);
var hoverLayer = SelectedProfile.GetLayers() var hoverLayer = SelectedProfile.GetLayers()
.Where(l => l.MustDraw()) .Where(l => l.MustDraw())
.FirstOrDefault(l => ((KeyboardPropertiesModel)l.Properties) .FirstOrDefault(l => ((KeyboardPropertiesModel) l.Properties)
.GetRect(1) .GetRect(1)
.Contains(x, y)); .Contains(x, y));
@ -214,13 +213,13 @@ namespace Artemis.ViewModels.Profiles
if (SelectedProfile == null) if (SelectedProfile == null)
return; return;
var pos = e.GetPosition((Image)e.OriginalSource); var pos = e.GetPosition((Image) e.OriginalSource);
var keyboard = _deviceManager.ActiveKeyboard; var keyboard = _deviceManager.ActiveKeyboard;
var x = pos.X / ((double)keyboard.PreviewSettings.Width / keyboard.Width); var x = pos.X/((double) keyboard.PreviewSettings.Width/keyboard.Width);
var y = pos.Y / ((double)keyboard.PreviewSettings.Height / keyboard.Height); var y = pos.Y/((double) keyboard.PreviewSettings.Height/keyboard.Height);
var hoverLayer = SelectedProfile.GetLayers() var hoverLayer = SelectedProfile.GetLayers()
.Where(l => l.MustDraw()) .Where(l => l.MustDraw())
.FirstOrDefault(l => ((KeyboardPropertiesModel)l.Properties) .FirstOrDefault(l => ((KeyboardPropertiesModel) l.Properties)
.GetRect(1).Contains(x, y)); .GetRect(1).Contains(x, y));
HandleDragging(e, x, y, hoverLayer); HandleDragging(e, x, y, hoverLayer);
@ -235,7 +234,7 @@ namespace Artemis.ViewModels.Profiles
// Turn the mouse pointer into a hand if hovering over an active layer // Turn the mouse pointer into a hand if hovering over an active layer
if (hoverLayer == SelectedLayer) if (hoverLayer == SelectedLayer)
{ {
var rect = ((KeyboardPropertiesModel)hoverLayer.Properties).GetRect(1); var rect = ((KeyboardPropertiesModel) hoverLayer.Properties).GetRect(1);
KeyboardPreviewCursor = KeyboardPreviewCursor =
Math.Sqrt(Math.Pow(x - rect.BottomRight.X, 2) + Math.Pow(y - rect.BottomRight.Y, 2)) < 0.6 Math.Sqrt(Math.Pow(x - rect.BottomRight.X, 2) + Math.Pow(y - rect.BottomRight.Y, 2)) < 0.6
? Cursors.SizeNWSE ? Cursors.SizeNWSE
@ -280,8 +279,8 @@ namespace Artemis.ViewModels.Profiles
// Setup the dragging state on mouse press // Setup the dragging state on mouse press
if (_draggingLayerOffset == null && hoverLayer != null && e.LeftButton == MouseButtonState.Pressed) if (_draggingLayerOffset == null && hoverLayer != null && e.LeftButton == MouseButtonState.Pressed)
{ {
var layerRect = ((KeyboardPropertiesModel)hoverLayer.Properties).GetRect(1); var layerRect = ((KeyboardPropertiesModel) hoverLayer.Properties).GetRect(1);
var selectedProps = (KeyboardPropertiesModel)SelectedLayer.Properties; var selectedProps = (KeyboardPropertiesModel) SelectedLayer.Properties;
_draggingLayerOffset = new Point(x - selectedProps.X, y - selectedProps.Y); _draggingLayerOffset = new Point(x - selectedProps.X, y - selectedProps.Y);
_draggingLayer = hoverLayer; _draggingLayer = hoverLayer;
@ -293,13 +292,13 @@ namespace Artemis.ViewModels.Profiles
if (_draggingLayerOffset == null || _draggingLayer == null || (_draggingLayer != SelectedLayer)) if (_draggingLayerOffset == null || _draggingLayer == null || (_draggingLayer != SelectedLayer))
return; return;
var draggingProps = (KeyboardPropertiesModel)_draggingLayer?.Properties; var draggingProps = (KeyboardPropertiesModel) _draggingLayer?.Properties;
// If no setup or reset was done, handle the actual dragging action // If no setup or reset was done, handle the actual dragging action
if (_resizing) if (_resizing)
{ {
draggingProps.Width = (int)Math.Round(x - draggingProps.X); draggingProps.Width = (int) Math.Round(x - draggingProps.X);
draggingProps.Height = (int)Math.Round(y - draggingProps.Y); draggingProps.Height = (int) Math.Round(y - draggingProps.Y);
if (draggingProps.Width < 1) if (draggingProps.Width < 1)
draggingProps.Width = 1; draggingProps.Width = 1;
if (draggingProps.Height < 1) if (draggingProps.Height < 1)
@ -307,8 +306,8 @@ namespace Artemis.ViewModels.Profiles
} }
else else
{ {
draggingProps.X = (int)Math.Round(x - _draggingLayerOffset.Value.X); draggingProps.X = (int) Math.Round(x - _draggingLayerOffset.Value.X);
draggingProps.Y = (int)Math.Round(y - _draggingLayerOffset.Value.Y); draggingProps.Y = (int) Math.Round(y - _draggingLayerOffset.Value.Y);
} }
} }

View File

@ -7,8 +7,8 @@ namespace Artemis.ViewModels.Profiles.Properties
{ {
public class HeadsetPropertiesViewModel : LayerPropertiesViewModel public class HeadsetPropertiesViewModel : LayerPropertiesViewModel
{ {
private LayerPropertiesModel _proposedProperties;
private Brush _brush; private Brush _brush;
private LayerPropertiesModel _proposedProperties;
public HeadsetPropertiesViewModel(IDataModel dataModel, LayerPropertiesModel properties) public HeadsetPropertiesViewModel(IDataModel dataModel, LayerPropertiesModel properties)
: base(dataModel) : base(dataModel)

View File

@ -1,5 +1,4 @@
using System.Windows.Media; using Artemis.Models.Interfaces;
using Artemis.Models.Interfaces;
using Artemis.Models.Profiles.Properties; using Artemis.Models.Profiles.Properties;
using Caliburn.Micro; using Caliburn.Micro;
@ -7,13 +6,13 @@ namespace Artemis.ViewModels.Profiles.Properties
{ {
public abstract class LayerPropertiesViewModel : PropertyChangedBase public abstract class LayerPropertiesViewModel : PropertyChangedBase
{ {
public IDataModel DataModel { get; set; }
protected LayerPropertiesViewModel(IDataModel dataModel) protected LayerPropertiesViewModel(IDataModel dataModel)
{ {
DataModel = dataModel; DataModel = dataModel;
} }
public IDataModel DataModel { get; set; }
public abstract LayerPropertiesModel GetAppliedProperties(); public abstract LayerPropertiesModel GetAppliedProperties();
} }
} }

View File

@ -1,5 +1,4 @@
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Navigation;
using Artemis.Models.Interfaces; using Artemis.Models.Interfaces;
using Artemis.Models.Profiles.Properties; using Artemis.Models.Profiles.Properties;
using Artemis.Utilities; using Artemis.Utilities;
@ -8,8 +7,8 @@ namespace Artemis.ViewModels.Profiles.Properties
{ {
public class MousePropertiesViewModel : LayerPropertiesViewModel public class MousePropertiesViewModel : LayerPropertiesViewModel
{ {
private LayerPropertiesModel _proposedProperties;
private Brush _brush; private Brush _brush;
private LayerPropertiesModel _proposedProperties;
public MousePropertiesViewModel(IDataModel dataModel, LayerPropertiesModel properties) public MousePropertiesViewModel(IDataModel dataModel, LayerPropertiesModel properties)
: base(dataModel) : base(dataModel)

View File

@ -1,5 +1,4 @@
using System; using System.Windows;
using System.Windows;
using Artemis.Events; using Artemis.Events;
using Artemis.Managers; using Artemis.Managers;
using Artemis.Services; using Artemis.Services;
@ -37,6 +36,7 @@ namespace Artemis.ViewModels
[Inject] [Inject]
public MetroDialogService DialogService { get; set; } public MetroDialogService DialogService { get; set; }
public MainManager MainManager { get; set; } public MainManager MainManager { get; set; }
public bool CanShowWindow => !_shellViewModel.IsActive; public bool CanShowWindow => !_shellViewModel.IsActive;

View File

@ -55,7 +55,7 @@
</StackPanel> </StackPanel>
<StackPanel Grid.Column="0" x:Name="EnumValueIsVisible" HorizontalAlignment="Left" VerticalAlignment="Top"> <StackPanel Grid.Column="0" x:Name="EnumValueIsVisible" HorizontalAlignment="Left" VerticalAlignment="Top">
<ComboBox x:Name="Enums" Width="110" MaxDropDownHeight="125" HorizontalAlignment="Center" <ComboBox x:Name="Enums" Width="110" MaxDropDownHeight="125" HorizontalAlignment="Center"
VerticalAlignment="Top"/> VerticalAlignment="Top" />
</StackPanel> </StackPanel>
<Button Grid.Column="1" x:Name="Delete" Width="26" Height="26" Style="{DynamicResource SquareButtonStyle}" <Button Grid.Column="1" x:Name="Delete" Width="26" Height="26" Style="{DynamicResource SquareButtonStyle}"
VerticalAlignment="Top" HorizontalAlignment="Right"> VerticalAlignment="Top" HorizontalAlignment="Right">

View File

@ -27,15 +27,17 @@
<!-- Preview Background="#FF232323" --> <!-- Preview Background="#FF232323" -->
<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}" <Border Grid.Column="0" Grid.Row="1" Background="#FF232323" BorderBrush="{DynamicResource HighlightBrush}"
BorderThickness="3" Width="800" Height="400"> BorderThickness="3" Width="800" Height="400">
<Border> <Border>
<Border.Effect> <Border.Effect>
<DropShadowEffect ShadowDepth="0" Color="{DynamicResource HighlightColor}" Opacity="1" <DropShadowEffect ShadowDepth="0" Color="{DynamicResource HighlightColor}" Opacity="1"
BlurRadius="{Binding Path=ProfileViewModel.BlurRadius, Mode=OneWay}" /> BlurRadius="{Binding Path=ProfileViewModel.BlurRadius, Mode=OneWay}" />
</Border.Effect> </Border.Effect>
<Grid> <Grid>
<Image Grid.Column="0" Grid.Row="0" Source="{Binding Path=ProfileViewModel.KeyboardImage}" Margin="50" /> <Image Grid.Column="0" Grid.Row="0" Source="{Binding Path=ProfileViewModel.KeyboardImage}"
<Image Grid.Column="0" Grid.Row="0" Source="{Binding Path=ProfileViewModel.KeyboardPreview}" Opacity="0.8" Margin="50" />
<Image Grid.Column="0" Grid.Row="0" Source="{Binding Path=ProfileViewModel.KeyboardPreview}"
Opacity="0.8"
Width="{Binding Path=PreviewSettings.Width}" Width="{Binding Path=PreviewSettings.Width}"
Height="{Binding Path=PreviewSettings.Height}" Height="{Binding Path=PreviewSettings.Height}"
Margin="{Binding Path=PreviewSettings.Margin}" Margin="{Binding Path=PreviewSettings.Margin}"
@ -43,22 +45,22 @@
cal:Message.Attach="[Event MouseMove] = [Action MouseMoveKeyboardPreview($eventArgs)]; cal:Message.Attach="[Event MouseMove] = [Action MouseMoveKeyboardPreview($eventArgs)];
[Event MouseDown] = [Action MouseDownKeyboardPreview($eventArgs)]; [Event MouseDown] = [Action MouseDownKeyboardPreview($eventArgs)];
[Event MouseUp] = [Action MouseUpKeyboardPreview($eventArgs)]" [Event MouseUp] = [Action MouseUpKeyboardPreview($eventArgs)]"
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"/> IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}" />
</Grid> </Grid>
</Border> </Border>
</Border> </Border>
<!-- Profile management --> <!-- Profile management -->
<StackPanel Grid.Column="0" Grid.Row="2"> <StackPanel Grid.Column="0" Grid.Row="2">
<StackPanel Orientation="Horizontal" Margin="0,5,0,0"> <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<Label Content="Active profile" /> <Label Content="Active profile" />
<ComboBox Width="145" VerticalAlignment="Top" x:Name="Profiles" DisplayMemberPath="Name" <ComboBox Width="220" VerticalAlignment="Top" x:Name="Profiles" DisplayMemberPath="Name"
Margin="5,0,0,0" /> Margin="5,0,0,0" />
<Button x:Name="AddProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" <Button x:Name="AddProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Add profile"> Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Add profile">
<Button.Content> <Button.Content>
<Rectangle <Rectangle
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
Width="12" Height="12"> Width="12" Height="12">
<Rectangle.OpacityMask> <Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_add}" Stretch="Fill" /> <VisualBrush Visual="{StaticResource appbar_add}" Stretch="Fill" />
</Rectangle.OpacityMask> </Rectangle.OpacityMask>
@ -66,12 +68,12 @@
</Button.Content> </Button.Content>
</Button> </Button>
<Button x:Name="RenameProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" <Button x:Name="RenameProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Rename profile" Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Rename profile"
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"> IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
<Button.Content> <Button.Content>
<Rectangle <Rectangle
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
Width="12" Height="12"> Width="12" Height="12">
<Rectangle.OpacityMask> <Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_edit}" Stretch="Fill" /> <VisualBrush Visual="{StaticResource appbar_edit}" Stretch="Fill" />
</Rectangle.OpacityMask> </Rectangle.OpacityMask>
@ -79,12 +81,13 @@
</Button.Content> </Button.Content>
</Button> </Button>
<Button x:Name="DuplicateProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" <Button x:Name="DuplicateProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Duplicate profile" Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0"
IsEnabled="{Binding Path=ProfileSelected, Mode=OneWay}"> ToolTip="Duplicate profile"
IsEnabled="{Binding Path=ProfileSelected, Mode=OneWay}">
<Button.Content> <Button.Content>
<Rectangle <Rectangle
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
Width="12" Height="12"> Width="12" Height="12">
<Rectangle.OpacityMask> <Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_clipboard_paste}" Stretch="Fill" /> <VisualBrush Visual="{StaticResource appbar_clipboard_paste}" Stretch="Fill" />
</Rectangle.OpacityMask> </Rectangle.OpacityMask>
@ -92,12 +95,12 @@
</Button.Content> </Button.Content>
</Button> </Button>
<Button x:Name="DeleteProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" <Button x:Name="DeleteProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Delete profile" Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Delete profile"
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"> IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
<Button.Content> <Button.Content>
<Rectangle <Rectangle
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
Width="12" Height="12"> Width="12" Height="12">
<Rectangle.OpacityMask> <Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_delete}" Stretch="Fill" /> <VisualBrush Visual="{StaticResource appbar_delete}" Stretch="Fill" />
</Rectangle.OpacityMask> </Rectangle.OpacityMask>
@ -105,7 +108,8 @@
</Button.Content> </Button.Content>
</Button> </Button>
</StackPanel> </StackPanel>
<TextBlock VerticalAlignment="Top" Foreground="{DynamicResource HighlightBrush}" HorizontalAlignment="Left" Margin="5,5,0,0" Text="Note: To edit a default profile, duplicate it first." FontWeight="Bold"/> <TextBlock VerticalAlignment="Top" Foreground="{DynamicResource HighlightBrush}" HorizontalAlignment="Left"
Margin="5,5,0,0" Text="Note: To edit a default profile, duplicate it first." FontWeight="Bold" />
</StackPanel> </StackPanel>
<StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal" Margin="0,6,0,0" HorizontalAlignment="Right"> <StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal" Margin="0,6,0,0" HorizontalAlignment="Right">
@ -152,7 +156,8 @@
ItemsSource="{Binding Path=Layers, Converter={StaticResource LayerOrderConverter}, ConverterParameter=Order}" ItemsSource="{Binding Path=Layers, Converter={StaticResource LayerOrderConverter}, ConverterParameter=Order}"
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"> IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
<i:Interaction.Behaviors> <i:Interaction.Behaviors>
<itemBehaviours:BindableSelectedItemBehavior SelectedItem="{Binding ProfileViewModel.SelectedLayer, Mode=TwoWay}" /> <itemBehaviours:BindableSelectedItemBehavior
SelectedItem="{Binding ProfileViewModel.SelectedLayer, Mode=TwoWay}" />
</i:Interaction.Behaviors> </i:Interaction.Behaviors>
<TreeView.Resources> <TreeView.Resources>
<ResourceDictionary <ResourceDictionary

View File

@ -7,8 +7,8 @@
d:DesignHeight="300" d:DesignWidth="300"> d:DesignHeight="300" d:DesignWidth="300">
<Grid> <Grid>
<TextBlock Margin="10,2,10,10" FontSize="13.333" <TextBlock Margin="10,2,10,10" FontSize="13.333"
Foreground="{DynamicResource HighlightBrush}" Foreground="{DynamicResource HighlightBrush}"
Text="Note: A folder allows you to organise layers. Layers within a folder are only drawn if both the layer's and the folder's conditions are met." Text="Note: A folder allows you to organise layers. Layers within a folder are only drawn if both the layer's and the folder's conditions are met."
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" /> VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" />
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -3,7 +3,7 @@
namespace Artemis.Views.Profiles.Properties namespace Artemis.Views.Profiles.Properties
{ {
/// <summary> /// <summary>
/// Interaction logic for FolderPropertiesView.xaml /// Interaction logic for FolderPropertiesView.xaml
/// </summary> /// </summary>
public partial class FolderPropertiesView : UserControl public partial class FolderPropertiesView : UserControl
{ {

View File

@ -27,8 +27,8 @@
</Border> </Border>
</StackPanel> </StackPanel>
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333" <TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
Foreground="{DynamicResource HighlightBrush}" 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" 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" /> VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" />
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -3,7 +3,7 @@
namespace Artemis.Views.Profiles.Properties namespace Artemis.Views.Profiles.Properties
{ {
/// <summary> /// <summary>
/// Interaction logic for HeadsetPropertiesView.xaml /// Interaction logic for HeadsetPropertiesView.xaml
/// </summary> /// </summary>
public partial class HeadsetPropertiesView : UserControl public partial class HeadsetPropertiesView : UserControl
{ {

View File

@ -39,11 +39,11 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- Animation --> <!-- Animation -->
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:" <TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
VerticalAlignment="Center" VerticalAlignment="Center"
Height="18" /> Height="18" />
<ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding Source={StaticResource AnimationEnumValues}}" <ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding Source={StaticResource AnimationEnumValues}}"
Margin="10,10,10,0" SelectedItem="{Binding Path=ProposedProperties.Animation}" Margin="10,10,10,0" SelectedItem="{Binding Path=ProposedProperties.Animation}"
VerticalAlignment="Top" Height="22"> VerticalAlignment="Top" Height="22">
<ComboBox.ItemTemplate> <ComboBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Text="{Binding Converter={StaticResource HEnumDescriptionConverter}}" /> <TextBlock Text="{Binding Converter={StaticResource HEnumDescriptionConverter}}" />
@ -53,20 +53,20 @@
<!-- Animation Speed --> <!-- Animation Speed -->
<TextBlock Grid.Row="0" Grid.Column="2" Margin="10" FontSize="13.333" Text="Animation speed:" <TextBlock Grid.Row="0" Grid.Column="2" Margin="10" FontSize="13.333" Text="Animation speed:"
VerticalAlignment="Center" Height="18" /> VerticalAlignment="Center" Height="18" />
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" <Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center"
TickPlacement="None" TickFrequency="0.05" TickPlacement="None" TickFrequency="0.05"
Value="{Binding Path=ProposedProperties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3" Value="{Binding Path=ProposedProperties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" /> SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
<!-- ClippingType --> <!-- ClippingType -->
<TextBlock Grid.Row="1" Grid.Column="0" Margin="10, 13, 10, 10" FontSize="13.333" Text="Clipping type:" <TextBlock Grid.Row="1" Grid.Column="0" Margin="10, 13, 10, 10" FontSize="13.333" Text="Clipping type:"
VerticalAlignment="Center" Height="23"/> VerticalAlignment="Center" Height="23" />
<controls:ToggleSwitch IsChecked="{Binding Path=ProposedProperties.Contain, Mode=TwoWay}" <controls:ToggleSwitch IsChecked="{Binding Path=ProposedProperties.Contain, Mode=TwoWay}"
Grid.Row="1" Grid.Row="1"
Grid.Column="1" OnLabel="Contain" OffLabel="Cut-off" Margin="10,1,5,1" Grid.Column="1" OnLabel="Contain" OffLabel="Cut-off" Margin="10,1,5,1"
VerticalAlignment="Center" VerticalAlignment="Center"
Height="36" /> Height="36" />
<!-- Colors --> <!-- Colors -->
<StackPanel Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush"> <StackPanel Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
@ -106,7 +106,7 @@
<!-- Dynamic --> <!-- Dynamic -->
<Label Grid.Row="3" Grid.Column="0" FontSize="20" HorizontalAlignment="Left" <Label Grid.Row="3" Grid.Column="0" FontSize="20" HorizontalAlignment="Left"
Content="Dynamic" Width="97" VerticalAlignment="Bottom" /> Content="Dynamic" Width="97" VerticalAlignment="Bottom" />
<!-- Dynamic property views --> <!-- Dynamic property views -->
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" x:Name="HeightProperties" /> <ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" x:Name="HeightProperties" />

View File

@ -3,7 +3,7 @@
namespace Artemis.Views.Profiles.Properties namespace Artemis.Views.Profiles.Properties
{ {
/// <summary> /// <summary>
/// Interaction logic for KeyboardPropertiesView.xaml /// Interaction logic for KeyboardPropertiesView.xaml
/// </summary> /// </summary>
public partial class KeyboardPropertiesView : UserControl public partial class KeyboardPropertiesView : UserControl
{ {

View File

@ -27,8 +27,8 @@
</Border> </Border>
</StackPanel> </StackPanel>
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333" <TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
Foreground="{DynamicResource HighlightBrush}" 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" 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" /> VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" />
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -3,7 +3,7 @@
namespace Artemis.Views.Profiles.Properties namespace Artemis.Views.Profiles.Properties
{ {
/// <summary> /// <summary>
/// Interaction logic for MousePropertiesView.xaml /// Interaction logic for MousePropertiesView.xaml
/// </summary> /// </summary>
public partial class MousePropertiesView : UserControl public partial class MousePropertiesView : UserControl
{ {

View File

@ -17,7 +17,7 @@
<DrawingImage.Drawing> <DrawingImage.Drawing>
<DrawingGroup> <DrawingGroup>
<GeometryDrawing Brush="{DynamicResource IdealForegroundColorBrush}" <GeometryDrawing Brush="{DynamicResource IdealForegroundColorBrush}"
Geometry="M1518 3378 c-48 -63 -61 -101 -66 -184 -4 -70 -1 -91 27 -170 l31 -89 -27 -20 c-32 -24 -849 -601 -981 -693 l-93 -64 -87 40 c-48 22 -91 37 -95 32 -5 -4 9 -41 29 -83 l37 -75 -28 -24 c-23 -20 -29 -35 -33 -81 l-4 -56 -82 -19 c-109 -25 -109 -41 4 -91 l85 -38 7 -64 c15 -137 90 -1279 85 -1293 -3 -7 -35 -24 -70 -35 -159 -53 -257 -168 -257 -302 0 -35 2 -38 47 -53 54 -18 185 -21 232 -5 29 10 31 14 31 58 0 26 6 56 14 66 13 18 15 18 46 -8 44 -37 78 -35 119 7 l34 35 -17 41 c-9 23 -12 39 -6 35 6 -4 43 -1 83 6 39 6 219 14 398 18 l327 6 113 57 c158 78 256 166 317 282 24 46 27 62 27 152 0 98 -1 103 -41 184 l-42 83 44 69 c24 37 51 68 59 68 9 0 44 -14 78 -32 l62 -31 -93 -44 c-58 -26 -92 -48 -90 -55 9 -27 353 -68 570 -68 108 0 108 0 108 24 0 34 -105 171 -220 286 -122 122 -238 216 -250 204 -6 -6 -1 -42 16 -98 14 -49 23 -91 19 -94 -3 -3 -36 9 -73 27 l-69 33 24 71 c13 39 23 76 23 82 0 6 28 17 63 24 279 58 399 300 314 632 -32 121 -49 155 -134 255 -37 45 -106 126 -152 180 -73 87 -241 326 -241 343 0 3 15 13 32 21 21 10 35 25 40 45 15 60 -16 103 -81 108 -43 3 -39 22 14 74 l45 43 -25 50 c-35 69 -77 114 -130 139 -63 30 -88 27 -117 -11z m215 -835 c188 -279 250 -417 250 -548 0 -133 -74 -214 -243 -265 l-55 -16 -37 -138 c-21 -76 -39 -140 -40 -141 -6 -5 -814 377 -823 390 -6 7 -19 46 -29 86 -10 41 -25 81 -33 91 -8 9 -57 35 -109 59 -52 23 -93 46 -92 51 2 4 233 169 513 366 l510 358 26 -46 c15 -25 88 -136 162 -247z m-1108 -898 c61 21 88 26 107 19 14 -5 204 -92 421 -194 l395 -185 -27 -35 c-15 -19 -53 -72 -84 -117 l-57 -81 30 -90 c39 -117 40 -179 2 -253 -45 -90 -147 -145 -347 -189 -71 -15 -435 -59 -600 -73 l-29 -2 -37 540 c-20 297 -40 581 -43 632 l-7 92 98 -46 97 -46 81 28z" /> Geometry="M1518 3378 c-48 -63 -61 -101 -66 -184 -4 -70 -1 -91 27 -170 l31 -89 -27 -20 c-32 -24 -849 -601 -981 -693 l-93 -64 -87 40 c-48 22 -91 37 -95 32 -5 -4 9 -41 29 -83 l37 -75 -28 -24 c-23 -20 -29 -35 -33 -81 l-4 -56 -82 -19 c-109 -25 -109 -41 4 -91 l85 -38 7 -64 c15 -137 90 -1279 85 -1293 -3 -7 -35 -24 -70 -35 -159 -53 -257 -168 -257 -302 0 -35 2 -38 47 -53 54 -18 185 -21 232 -5 29 10 31 14 31 58 0 26 6 56 14 66 13 18 15 18 46 -8 44 -37 78 -35 119 7 l34 35 -17 41 c-9 23 -12 39 -6 35 6 -4 43 -1 83 6 39 6 219 14 398 18 l327 6 113 57 c158 78 256 166 317 282 24 46 27 62 27 152 0 98 -1 103 -41 184 l-42 83 44 69 c24 37 51 68 59 68 9 0 44 -14 78 -32 l62 -31 -93 -44 c-58 -26 -92 -48 -90 -55 9 -27 353 -68 570 -68 108 0 108 0 108 24 0 34 -105 171 -220 286 -122 122 -238 216 -250 204 -6 -6 -1 -42 16 -98 14 -49 23 -91 19 -94 -3 -3 -36 9 -73 27 l-69 33 24 71 c13 39 23 76 23 82 0 6 28 17 63 24 279 58 399 300 314 632 -32 121 -49 155 -134 255 -37 45 -106 126 -152 180 -73 87 -241 326 -241 343 0 3 15 13 32 21 21 10 35 25 40 45 15 60 -16 103 -81 108 -43 3 -39 22 14 74 l45 43 -25 50 c-35 69 -77 114 -130 139 -63 30 -88 27 -117 -11z m215 -835 c188 -279 250 -417 250 -548 0 -133 -74 -214 -243 -265 l-55 -16 -37 -138 c-21 -76 -39 -140 -40 -141 -6 -5 -814 377 -823 390 -6 7 -19 46 -29 86 -10 41 -25 81 -33 91 -8 9 -57 35 -109 59 -52 23 -93 46 -92 51 2 4 233 169 513 366 l510 358 26 -46 c15 -25 88 -136 162 -247z m-1108 -898 c61 21 88 26 107 19 14 -5 204 -92 421 -194 l395 -185 -27 -35 c-15 -19 -53 -72 -84 -117 l-57 -81 30 -90 c39 -117 40 -179 2 -253 -45 -90 -147 -145 -347 -189 -71 -15 -435 -59 -600 -73 l-29 -2 -37 540 c-20 297 -40 581 -43 632 l-7 92 98 -46 97 -46 81 28z" />
</DrawingGroup> </DrawingGroup>
</DrawingImage.Drawing> </DrawingImage.Drawing>
</DrawingImage> </DrawingImage>

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Caliburn.Micro" version="3.0.1" targetFramework="net452" /> <package id="Caliburn.Micro" version="3.0.1" targetFramework="net452" />
<package id="Caliburn.Micro.Core" version="3.0.1" targetFramework="net452" /> <package id="Caliburn.Micro.Core" version="3.0.1" targetFramework="net452" />

View File

@ -16,133 +16,131 @@ namespace ChromaSDK
//! Razer Blackwidow Chroma device. //! Razer Blackwidow Chroma device.
// {2EA1BB63-CA28-428D-9F06-196B88330BBB} // {2EA1BB63-CA28-428D-9F06-196B88330BBB}
static const GUID BLACKWIDOW_CHROMA = static const GUID BLACKWIDOW_CHROMA =
{ 0x2ea1bb63, 0xca28, 0x428d,{ 0x9f, 0x06, 0x19, 0x6b, 0x88, 0x33, 0x0b, 0xbb } }; {0x2ea1bb63, 0xca28, 0x428d,{0x9f, 0x06, 0x19, 0x6b, 0x88, 0x33, 0x0b, 0xbb}};
//! Razer Blackwidow Chroma Tournament Edition device. //! Razer Blackwidow Chroma Tournament Edition device.
// {ED1C1B82-BFBE-418F-B49D-D03F05B149DF} // {ED1C1B82-BFBE-418F-B49D-D03F05B149DF}
static const GUID BLACKWIDOW_CHROMA_TE = static const GUID BLACKWIDOW_CHROMA_TE =
{ 0xed1c1b82, 0xbfbe, 0x418f,{ 0xb4, 0x9d, 0xd0, 0x3f, 0x5, 0xb1, 0x49, 0xdf } }; {0xed1c1b82, 0xbfbe, 0x418f,{0xb4, 0x9d, 0xd0, 0x3f, 0x5, 0xb1, 0x49, 0xdf}};
//! Razer Deathstalker device. //! Razer Deathstalker device.
// {18C5AD9B-4326-4828-92C4-2669A66D2283} // {18C5AD9B-4326-4828-92C4-2669A66D2283}
static const GUID DEATHSTALKER_CHROMA = static const GUID DEATHSTALKER_CHROMA =
{ 0x18c5ad9b, 0x4326, 0x4828,{ 0x92, 0xc4, 0x26, 0x69, 0xa6, 0x6d, 0x22, 0x83 } }; {0x18c5ad9b, 0x4326, 0x4828,{0x92, 0xc4, 0x26, 0x69, 0xa6, 0x6d, 0x22, 0x83}};
//! Overwatch Keyboard. //! Overwatch Keyboard.
// {872AB2A9-7959-4478-9FED-15F6186E72E4} // {872AB2A9-7959-4478-9FED-15F6186E72E4}
static const GUID OVERWATCH_KEYBOARD = static const GUID OVERWATCH_KEYBOARD =
{ 0x872ab2a9, 0x7959, 0x4478,{ 0x9f, 0xed, 0x15, 0xf6, 0x18, 0x6e, 0x72, 0xe4 } }; {0x872ab2a9, 0x7959, 0x4478,{0x9f, 0xed, 0x15, 0xf6, 0x18, 0x6e, 0x72, 0xe4}};
//! Razer Blackwidow X Chroma device. //! Razer Blackwidow X Chroma device.
// {5AF60076-ADE9-43D4-B574-52599293B554} // {5AF60076-ADE9-43D4-B574-52599293B554}
static const GUID BLACKWIDOW_X_CHROMA = static const GUID BLACKWIDOW_X_CHROMA =
{ 0x5af60076, 0xade9, 0x43d4,{ 0xb5, 0x74, 0x52, 0x59, 0x92, 0x93, 0xb5, 0x54 } }; {0x5af60076, 0xade9, 0x43d4,{0xb5, 0x74, 0x52, 0x59, 0x92, 0x93, 0xb5, 0x54}};
//! Razer Blackwidow X TE Chroma device. //! Razer Blackwidow X TE Chroma device.
// {2D84DD51-3290-4AAC-9A89-D8AFDE38B57C} // {2D84DD51-3290-4AAC-9A89-D8AFDE38B57C}
static const GUID BLACKWIDOW_X_TE_CHROMA = static const GUID BLACKWIDOW_X_TE_CHROMA =
{ 0x2d84dd51, 0x3290, 0x4aac,{ 0x9a, 0x89, 0xd8, 0xaf, 0xde, 0x38, 0xb5, 0x7c } }; {0x2d84dd51, 0x3290, 0x4aac,{0x9a, 0x89, 0xd8, 0xaf, 0xde, 0x38, 0xb5, 0x7c}};
//! Razer Blade Stealth. //! Razer Blade Stealth.
// {C83BDFE8-E7FC-40E0-99DB-872E23F19891} // {C83BDFE8-E7FC-40E0-99DB-872E23F19891}
static const GUID BLADE_STEALTH = static const GUID BLADE_STEALTH =
{ 0xc83bdfe8, 0xe7fc, 0x40e0,{ 0x99, 0xdb, 0x87, 0x2e, 0x23, 0xf1, 0x98, 0x91 } }; {0xc83bdfe8, 0xe7fc, 0x40e0,{0x99, 0xdb, 0x87, 0x2e, 0x23, 0xf1, 0x98, 0x91}};
//! Razer Blade //! Razer Blade
// {F2BEDFAF-A0FE-4651-9D41-B6CE603A3DDD} // {F2BEDFAF-A0FE-4651-9D41-B6CE603A3DDD}
static const GUID BLADE = static const GUID BLADE =
{ 0xf2bedfaf, 0xa0fe, 0x4651,{ 0x9d, 0x41, 0xb6, 0xce, 0x60, 0x3a, 0x3d, 0xdd } }; {0xf2bedfaf, 0xa0fe, 0x4651,{0x9d, 0x41, 0xb6, 0xce, 0x60, 0x3a, 0x3d, 0xdd}};
// Mice // Mice
//! Razer Deathadder Chroma device. //! Razer Deathadder Chroma device.
// {AEC50D91-B1F1-452F-8E16-7B73F376FDF3} // {AEC50D91-B1F1-452F-8E16-7B73F376FDF3}
static const GUID DEATHADDER_CHROMA = static const GUID DEATHADDER_CHROMA =
{ 0xaec50d91, 0xb1f1, 0x452f,{ 0x8e, 0x16, 0x7b, 0x73, 0xf3, 0x76, 0xfd, 0xf3 } }; {0xaec50d91, 0xb1f1, 0x452f,{0x8e, 0x16, 0x7b, 0x73, 0xf3, 0x76, 0xfd, 0xf3}};
//! Razer Mamba Chroma Tournament Edition device. //! Razer Mamba Chroma Tournament Edition device.
// {7EC00450-E0EE-4289-89D5-0D879C19061A} // {7EC00450-E0EE-4289-89D5-0D879C19061A}
static const GUID MAMBA_CHROMA_TE = static const GUID MAMBA_CHROMA_TE =
{ 0x7ec00450, 0xe0ee, 0x4289,{ 0x89, 0xd5, 0xd, 0x87, 0x9c, 0x19, 0x6, 0x1a } }; {0x7ec00450, 0xe0ee, 0x4289,{0x89, 0xd5, 0xd, 0x87, 0x9c, 0x19, 0x6, 0x1a}};
//! Razer Diamondback device. //! Razer Diamondback device.
// {FF8A5929-4512-4257-8D59-C647BF9935D0} // {FF8A5929-4512-4257-8D59-C647BF9935D0}
static const GUID DIAMONDBACK_CHROMA = static const GUID DIAMONDBACK_CHROMA =
{ 0xff8a5929, 0x4512, 0x4257,{ 0x8d, 0x59, 0xc6, 0x47, 0xbf, 0x99, 0x35, 0xd0 } }; {0xff8a5929, 0x4512, 0x4257,{0x8d, 0x59, 0xc6, 0x47, 0xbf, 0x99, 0x35, 0xd0}};
//! Razer Mamba device. //! Razer Mamba device.
// {D527CBDC-EB0A-483A-9E89-66D50463EC6C} // {D527CBDC-EB0A-483A-9E89-66D50463EC6C}
static const GUID MAMBA_CHROMA = static const GUID MAMBA_CHROMA =
{ 0xd527cbdc, 0xeb0a, 0x483a,{ 0x9e, 0x89, 0x66, 0xd5, 0x4, 0x63, 0xec, 0x6c } }; {0xd527cbdc, 0xeb0a, 0x483a,{0x9e, 0x89, 0x66, 0xd5, 0x4, 0x63, 0xec, 0x6c}};
//! Razer Naga Epic device. //! Razer Naga Epic device.
// {D714C50B-7158-4368-B99C-601ACB985E98} // {D714C50B-7158-4368-B99C-601ACB985E98}
static const GUID NAGA_EPIC_CHROMA = static const GUID NAGA_EPIC_CHROMA =
{ 0xd714c50b, 0x7158, 0x4368,{ 0xb9, 0x9c, 0x60, 0x1a, 0xcb, 0x98, 0x5e, 0x98 } }; {0xd714c50b, 0x7158, 0x4368,{0xb9, 0x9c, 0x60, 0x1a, 0xcb, 0x98, 0x5e, 0x98}};
//! Razer Naga device. //! Razer Naga device.
// {F1876328-6CA4-46AE-BE04-BE812B414433} // {F1876328-6CA4-46AE-BE04-BE812B414433}
static const GUID NAGA_CHROMA = static const GUID NAGA_CHROMA =
{ 0xf1876328, 0x6ca4, 0x46ae,{ 0xbe, 0x4, 0xbe, 0x81, 0x2b, 0x41, 0x44, 0x33 } }; {0xf1876328, 0x6ca4, 0x46ae,{0xbe, 0x4, 0xbe, 0x81, 0x2b, 0x41, 0x44, 0x33}};
//! Razer Orochi Chroma device. //! Razer Orochi Chroma device.
// {52C15681-4ECE-4DD9-8A52-A1418459EB34} // {52C15681-4ECE-4DD9-8A52-A1418459EB34}
static const GUID OROCHI_CHROMA = static const GUID OROCHI_CHROMA =
{ 0x52c15681, 0x4ece, 0x4dd9,{ 0x8a, 0x52, 0xa1, 0x41, 0x84, 0x59, 0xeb, 0x34 } }; {0x52c15681, 0x4ece, 0x4dd9,{0x8a, 0x52, 0xa1, 0x41, 0x84, 0x59, 0xeb, 0x34}};
//! Razer Naga Hex Chroma device. //! Razer Naga Hex Chroma device.
// {195D70F5-F285-4CFF-99F2-B8C0E9658DB4} // {195D70F5-F285-4CFF-99F2-B8C0E9658DB4}
static const GUID NAGA_HEX_CHROMA = static const GUID NAGA_HEX_CHROMA =
{ 0x195d70f5, 0xf285, 0x4cff,{ 0x99, 0xf2, 0xb8, 0xc0, 0xe9, 0x65, 0x8d, 0xb4 } }; {0x195d70f5, 0xf285, 0x4cff,{0x99, 0xf2, 0xb8, 0xc0, 0xe9, 0x65, 0x8d, 0xb4}};
// Headsets // Headsets
//! Razer Kraken 7.1 Chroma device. //! Razer Kraken 7.1 Chroma device.
// {CD1E09A5-D5E6-4A6C-A93B-E6D9BF1D2092} // {CD1E09A5-D5E6-4A6C-A93B-E6D9BF1D2092}
static const GUID KRAKEN71_CHROMA = static const GUID KRAKEN71_CHROMA =
{ 0xcd1e09a5, 0xd5e6, 0x4a6c,{ 0xa9, 0x3b, 0xe6, 0xd9, 0xbf, 0x1d, 0x20, 0x92 } }; {0xcd1e09a5, 0xd5e6, 0x4a6c,{0xa9, 0x3b, 0xe6, 0xd9, 0xbf, 0x1d, 0x20, 0x92}};
//! Razer ManO'War device. //! Razer ManO'War device.
// {DF3164D7-5408-4A0E-8A7F-A7412F26BEBF} // {DF3164D7-5408-4A0E-8A7F-A7412F26BEBF}
static const GUID MANOWAR_HEADSET = static const GUID MANOWAR_HEADSET =
{ 0xdf3164d7, 0x5408, 0x4a0e,{ 0x8a, 0x7f, 0xa7, 0x41, 0x2f, 0x26, 0xbe, 0xbf } }; {0xdf3164d7, 0x5408, 0x4a0e,{0x8a, 0x7f, 0xa7, 0x41, 0x2f, 0x26, 0xbe, 0xbf}};
// Mouse mat // Mouse mat
//! Razer Firefly device. //! Razer Firefly device.
// {80F95A94-73D2-48CA-AE9A-0986789A9AF2} // {80F95A94-73D2-48CA-AE9A-0986789A9AF2}
static const GUID FIREFLY_CHROMA = static const GUID FIREFLY_CHROMA =
{ 0x80f95a94, 0x73d2, 0x48ca,{ 0xae, 0x9a, 0x9, 0x86, 0x78, 0x9a, 0x9a, 0xf2 } }; {0x80f95a94, 0x73d2, 0x48ca,{0xae, 0x9a, 0x9, 0x86, 0x78, 0x9a, 0x9a, 0xf2}};
// Keypads // Keypads
//! Razer Tartarus device. //! Razer Tartarus device.
// {00F0545C-E180-4AD1-8E8A-419061CE505E} // {00F0545C-E180-4AD1-8E8A-419061CE505E}
static const GUID TARTARUS_CHROMA = static const GUID TARTARUS_CHROMA =
{ 0xf0545c, 0xe180, 0x4ad1,{ 0x8e, 0x8a, 0x41, 0x90, 0x61, 0xce, 0x50, 0x5e } }; {0xf0545c, 0xe180, 0x4ad1,{0x8e, 0x8a, 0x41, 0x90, 0x61, 0xce, 0x50, 0x5e}};
//! Razer Orbweaver device. //! Razer Orbweaver device.
// {9D24B0AB-0162-466C-9640-7A924AA4D9FD} // {9D24B0AB-0162-466C-9640-7A924AA4D9FD}
static const GUID ORBWEAVER_CHROMA = static const GUID ORBWEAVER_CHROMA =
{ 0x9d24b0ab, 0x162, 0x466c,{ 0x96, 0x40, 0x7a, 0x92, 0x4a, 0xa4, 0xd9, 0xfd } }; {0x9d24b0ab, 0x162, 0x466c,{0x96, 0x40, 0x7a, 0x92, 0x4a, 0xa4, 0xd9, 0xfd}};
// Systems // Systems
// {35F6F18D-1AE5-436C-A575-AB44A127903A} // {35F6F18D-1AE5-436C-A575-AB44A127903A}
static const GUID LENOVO_Y900 = static const GUID LENOVO_Y900 =
{ 0x35f6f18d, 0x1ae5, 0x436c,{ 0xa5, 0x75, 0xab, 0x44, 0xa1, 0x27, 0x90, 0x3a } }; {0x35f6f18d, 0x1ae5, 0x436c,{0xa5, 0x75, 0xab, 0x44, 0xa1, 0x27, 0x90, 0x3a}};
// {47DB1FA7-6B9B-4EE6-B6F4-4071A3B2053B} // {47DB1FA7-6B9B-4EE6-B6F4-4071A3B2053B}
static const GUID LENOVO_Y27 = static const GUID LENOVO_Y27 =
{ 0x47db1fa7, 0x6b9b, 0x4ee6,{ 0xb6, 0xf4, 0x40, 0x71, 0xa3, 0xb2, 0x5, 0x3b } }; {0x47db1fa7, 0x6b9b, 0x4ee6,{0xb6, 0xf4, 0x40, 0x71, 0xa3, 0xb2, 0x5, 0x3b}};
// Accessories // Accessories
// {0201203B-62F3-4C50-83DD-598BABD208E0} // {0201203B-62F3-4C50-83DD-598BABD208E0}
static const GUID CORE_CHROMA = static const GUID CORE_CHROMA =
{ 0x201203b, 0x62f3, 0x4c50,{ 0x83, 0xdd, 0x59, 0x8b, 0xab, 0xd2, 0x8, 0xe0 } }; {0x201203b, 0x62f3, 0x4c50,{0x83, 0xdd, 0x59, 0x8b, 0xab, 0xd2, 0x8, 0xe0}};
} }
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
//! \file RzErrors.h //! \file RzErrors.h
//! \brief Error codes for Chroma SDK. If the error is not defined here, refer to WinError.h from the Windows SDK. //! \brief Error codes for Chroma SDK. If the error is not defined here, refer to WinError.h from the Windows SDK.

View File

@ -84,7 +84,8 @@ RZRESULT CreateEffect(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPAR
RZRESULT CreateKeyboardEffect(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId) RZRESULT CreateKeyboardEffect(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID* pEffectId)
{ {
std::string res = ""; std::string res = "";
if (Effect == Keyboard::CHROMA_CUSTOM) { if (Effect == Keyboard::CHROMA_CUSTOM)
{
res += "0|"; res += "0|";
auto keys = *static_cast<struct Keyboard::CUSTOM_EFFECT_TYPE*>(pParam); auto keys = *static_cast<struct Keyboard::CUSTOM_EFFECT_TYPE*>(pParam);
@ -99,7 +100,8 @@ RZRESULT CreateKeyboardEffect(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM
} }
} }
} }
else if (Effect == Keyboard::CHROMA_CUSTOM_KEY) { else if (Effect == Keyboard::CHROMA_CUSTOM_KEY)
{
res += "1|"; res += "1|";
auto keys = *static_cast<struct Keyboard::CUSTOM_KEY_EFFECT_TYPE*>(pParam); auto keys = *static_cast<struct Keyboard::CUSTOM_KEY_EFFECT_TYPE*>(pParam);