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

@ -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,7 +28,9 @@ 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" +

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

@ -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

@ -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

@ -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;

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
@ -86,7 +89,7 @@ namespace Artemis.Modules.Effects.WindowsProfile
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 = SpotifyLocalAPI.IsSpotifyRunning();
}
private void UpdateSpotifyPlayState(object sender, PlayStateEventArgs e)
{ {
dataModel.Spotify.Running = false; ((WindowsProfileDataModel) DataModel).Spotify.Playing = e.Playing;
return;
} }
dataModel.Spotify.Running = true; private void UpdateSpotifyTrack(object sender, TrackChangeEventArgs e)
dataModel.Spotify.SpotifyVolume = (int)(status.Volume * 100); {
dataModel.Spotify.Repeat = status.Repeat; var dataModel = (WindowsProfileDataModel) DataModel;
dataModel.Spotify.Shuffle = status.Shuffle; dataModel.Spotify.Artist = e.NewTrack.ArtistResource?.Name;
dataModel.Spotify.Playing = status.Playing; dataModel.Spotify.SongName = e.NewTrack.TrackResource?.Name;
dataModel.Spotify.Album = e.NewTrack.AlbumResource?.Name;
dataModel.Spotify.SongLength = e.NewTrack.Length;
}
// Only update track info if not null private void UpdateSpotifyTrackTime(object sender, TrackTimeChangeEventArgs e)
if (status.Track == null) {
return; var dataModel = (WindowsProfileDataModel) DataModel;
if (dataModel.Spotify.SongLength > 0)
dataModel.Spotify.SongPercentCompleted = (int) (e.TrackTime/dataModel.Spotify.SongLength*100.0);
}
dataModel.Spotify.Artist = status.Track.ArtistResource?.Name; #endregion
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;
}
} }
} }

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;
@ -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)
@ -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

@ -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

@ -1,4 +1,5 @@
<?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"

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

@ -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

@ -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,7 +145,6 @@ 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();

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

@ -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; }

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

@ -34,8 +34,10 @@
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}"
@ -51,7 +53,7 @@
<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">
@ -79,7 +81,8 @@
</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"
ToolTip="Duplicate profile"
IsEnabled="{Binding Path=ProfileSelected, Mode=OneWay}"> IsEnabled="{Binding Path=ProfileSelected, Mode=OneWay}">
<Button.Content> <Button.Content>
<Rectangle <Rectangle
@ -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

@ -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

@ -141,8 +141,6 @@ namespace ChromaSDK
// {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

View File

@ -148,7 +148,6 @@ namespace ChromaSDK
DURATION_MEDIUM, //!< Medium duration. DURATION_MEDIUM, //!< Medium duration.
DURATION_LONG //!< Long duration. DURATION_LONG //!< Long duration.
} Duration; //!< The time taken for the effect to fade away. } Duration; //!< The time taken for the effect to fade away.
} STARLIGHT_EFFECT_TYPE; } STARLIGHT_EFFECT_TYPE;
//! Static effect. //! Static effect.
@ -355,6 +354,7 @@ namespace ChromaSDK
RANDOM_COLORS, //!< Random colors RANDOM_COLORS, //!< Random colors
INVALID //!< Invalid type INVALID //!< Invalid type
} Type; } Type;
COLORREF Color1; //!< First color. COLORREF Color1; //!< First color.
COLORREF Color2; //!< Second color. COLORREF Color2; //!< Second color.
} BREATHING_EFFECT_TYPE; } BREATHING_EFFECT_TYPE;
@ -408,7 +408,6 @@ namespace ChromaSDK
DURATION_MEDIUM, //!< Medium duration. DURATION_MEDIUM, //!< Medium duration.
DURATION_LONG //!< Long duration. DURATION_LONG //!< Long duration.
} Duration; //!< The time taken for the effect to fade away. } Duration; //!< The time taken for the effect to fade away.
} STARLIGHT_EFFECT_TYPE; } STARLIGHT_EFFECT_TYPE;
//! Static effect type //! Static effect type
@ -669,6 +668,7 @@ namespace ChromaSDK
RANDOM_COLORS, //!< Random colors RANDOM_COLORS, //!< Random colors
INVALID INVALID
} Type; } Type;
COLORREF Color1; //!< First color. COLORREF Color1; //!< First color.
COLORREF Color2; //!< Second color. COLORREF Color2; //!< Second color.
} BREATHING_EFFECT_TYPE; } BREATHING_EFFECT_TYPE;
@ -736,6 +736,7 @@ namespace ChromaSDK
RANDOM_COLORS, //!< Random colors RANDOM_COLORS, //!< Random colors
INVALID //!< Invalid type INVALID //!< Invalid type
} Type; } Type;
COLORREF Color1; //!< First color. COLORREF Color1; //!< First color.
COLORREF Color2; //!< Second color. COLORREF Color2; //!< Second color.
} BREATHING_EFFECT_TYPE; } BREATHING_EFFECT_TYPE;

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);