1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00
Improved profile loading performance
Updated packages
Added default GIF for UT
Added default profiles for UT
Bumped version number
This commit is contained in:
SpoinkyNL 2016-08-13 22:58:02 +02:00
parent 841979098c
commit 8a0fc47514
19 changed files with 196 additions and 160 deletions

View File

@ -2,65 +2,26 @@
<configuration> <configuration>
<configSections> <configSections>
<sectionGroup name="userSettings" <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <section name="Artemis.Modules.Games.UnrealTournament.UnrealTournament" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Games.UnrealTournament.UnrealTournament" <section name="Artemis.Modules.Games.WoW.WoW" 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.Effects.Bubbles.Bubbles" 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.WindowsProfile.WindowsProfile" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Games.WoW.WoW" <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.ClientSettingsSection, 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" />
allowExeDefinition="MachineToLocalUser" requirePermission="false" /> <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" />
<section name="Artemis.Modules.Effects.Bubbles.Bubbles" <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" />
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" <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" />
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.Effects.WindowsProfile.WindowsProfile" <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" />
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" <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" />
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.Modules.Games.Overwatch.Overwatch" <section name="Artemis.Settings.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.AudioVisualization" 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.RocketLeague" 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.Properties.Settings" 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.TypeWave" 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.General" 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"
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"
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 />
@ -330,7 +291,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" /> <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />

View File

@ -40,7 +40,7 @@
<ProductName>Artemis</ProductName> <ProductName>Artemis</ProductName>
<PublisherName>Artemis</PublisherName> <PublisherName>Artemis</PublisherName>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.2.2.0</ApplicationVersion> <ApplicationVersion>1.2.3.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut> <CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>
@ -141,8 +141,8 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>lib\ColorBox.dll</HintPath> <HintPath>lib\ColorBox.dll</HintPath>
</Reference> </Reference>
<Reference Include="Corale.Colore, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Corale.Colore, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Colore.4.0.0\lib\net35\Corale.Colore.dll</HintPath> <HintPath>..\packages\Colore.5.0.0\lib\net35\Corale.Colore.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="CUE.NET, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="CUE.NET, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL">
@ -176,8 +176,8 @@
<HintPath>..\packages\NAudio.1.7.3\lib\net35\NAudio.dll</HintPath> <HintPath>..\packages\NAudio.1.7.3\lib\net35\NAudio.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Ninject, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL"> <Reference Include="Ninject, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
@ -197,7 +197,7 @@
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.3.4\lib\net45\NLog.dll</HintPath> <HintPath>..\packages\NLog.4.3.7\lib\net45\NLog.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Process.NET, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Process.NET, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
@ -205,7 +205,7 @@
<HintPath>D:\Downloads\Chome Downloads\Process.NET-master\Process.NET-master\src\Process.NET\bin\Release\Process.NET.dll</HintPath> <HintPath>D:\Downloads\Chome Downloads\Process.NET-master\Process.NET-master\src\Process.NET\bin\Release\Process.NET.dll</HintPath>
</Reference> </Reference>
<Reference Include="SpotifyAPI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="SpotifyAPI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SpotifyAPI-NET.2.9.0\lib\SpotifyAPI.dll</HintPath> <HintPath>..\packages\SpotifyAPI-NET.2.11.0\lib\SpotifyAPI.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
@ -639,6 +639,9 @@
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>WoW.Designer.cs</LastGenOutput> <LastGenOutput>WoW.Designer.cs</LastGenOutput>
</None> </None>
<None Include="NLog.xsd">
<SubType>Designer</SubType>
</None>
<None Include="Resources\generic.png" /> <None Include="Resources\generic.png" />
<None Include="Resources\Keyboards\g810.png" /> <None Include="Resources\Keyboards\g810.png" />
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
@ -686,9 +689,6 @@
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>VolumeDisplay.Designer.cs</LastGenOutput> <LastGenOutput>VolumeDisplay.Designer.cs</LastGenOutput>
</None> </None>
<None Include="NLog.xsd">
<SubType>Designer</SubType>
</None>
<None Include="packages.config"> <None Include="packages.config">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
@ -878,6 +878,7 @@
<Content Include="LogitechLedEnginesWrapper.dll"> <Content Include="LogitechLedEnginesWrapper.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<None Include="Modules\Games\UnrealTournament\Resources\redeemer.gif" />
<Content Include="Resources\CounterStrike\csgoGamestateConfiguration.txt" /> <Content Include="Resources\CounterStrike\csgoGamestateConfiguration.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq; using System.Linq;
@ -19,9 +20,10 @@ namespace Artemis.DAL
{ {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private static readonly string ProfileFolder = Environment private static readonly string ProfileFolder =
.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis\profiles"; Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis\profiles";
private static readonly List<ProfileModel> Profiles = new List<ProfileModel>();
private static bool _installedDefaults; private static bool _installedDefaults;
/// <summary> /// <summary>
@ -30,7 +32,15 @@ namespace Artemis.DAL
/// <returns>All profiles</returns> /// <returns>All profiles</returns>
public static List<ProfileModel> GetAll() public static List<ProfileModel> GetAll()
{ {
return ReadProfiles(); lock (Profiles)
{
if (!Profiles.Any())
ReadProfiles();
// Return a new list, this'll make sure removing/updating the retrieved list doesn't
// affect the datastore
return Profiles.ToList();
}
} }
/// <summary> /// <summary>
@ -59,8 +69,15 @@ namespace Artemis.DAL
if (prof == null) if (prof == null)
throw new ArgumentNullException(nameof(prof)); throw new ArgumentNullException(nameof(prof));
lock (Profiles)
{
if (!Profiles.Contains(prof))
Profiles.Add(prof);
}
lock (prof) lock (prof)
{ {
// Store the file
if (!(prof.GameName?.Length > 1) || !(prof.KeyboardSlug?.Length > 1) || !(prof.Name?.Length > 1)) if (!(prof.GameName?.Length > 1) || !(prof.KeyboardSlug?.Length > 1) || !(prof.Name?.Length > 1))
throw new ArgumentException("Profile is invalid. Name, GameName and KeyboardSlug are required"); throw new ArgumentException("Profile is invalid. Name, GameName and KeyboardSlug are required");
@ -86,31 +103,43 @@ namespace Artemis.DAL
} }
} }
private static List<ProfileModel> ReadProfiles() private static void ReadProfiles()
{ {
CheckProfiles(); CheckProfiles();
InstallDefaults(); lock (Profiles)
var profiles = new List<ProfileModel>();
// Create the directory structure
var profilePaths = Directory.GetFiles(ProfileFolder, "*.json", SearchOption.AllDirectories);
// Parse the JSON files into objects and add them if they are valid
foreach (var path in profilePaths)
{ {
try Profiles.Clear();
// Create the directory structure
var profilePaths = Directory.GetFiles(ProfileFolder, "*.json", SearchOption.AllDirectories);
// Parse the JSON files into objects and add them if they are valid
foreach (var path in profilePaths)
{ {
var prof = LoadProfileIfValid(path); try
if (prof != null) {
profiles.Add(prof); var prof = LoadProfileIfValid(path);
} if (prof == null)
catch (Exception e) continue;
{
Logger.Error("Failed to load profile: {0} - {1}", path, e.InnerException.Message); // Only add unique profiles
if (Profiles.Any(p => p.GameName == prof.GameName && p.Name == prof.Name &&
p.KeyboardSlug == prof.KeyboardSlug))
{
Logger.Error("Didn't load duplicate profile: {0}", path);
}
else
{
Profiles.Add(prof);
}
}
catch (Exception e)
{
Logger.Error("Failed to load profile: {0} - {1}", path, e.InnerException.Message);
}
} }
} }
InstallDefaults();
return profiles;
} }
/// <summary> /// <summary>
@ -133,23 +162,27 @@ namespace Artemis.DAL
var archive = new ZipArchive(stream); var archive = new ZipArchive(stream);
archive.ExtractToDirectory(ProfileFolder, true); archive.ExtractToDirectory(ProfileFolder, true);
// Extract the demo GIF file var demoProfiles = Profiles.Where(d => d.Name == "Demo (duplicate to keep changes)");
var gifPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis\demo-gif.gif"; InsertGif(demoProfiles, "GIF", Resources.demo_gif, "demo-gif");
Resources.demo_gif.Save(gifPath); }
// Set the GIF path on each demo profile public static void InsertGif(IEnumerable<ProfileModel> profileModels, string layerName, Bitmap gifFile,
var demoProfiles = GetAll().Where(d => d.Name == "Demo (Duplicate to keep changes)"); string fileName)
foreach (var demoProfile in demoProfiles) {
// Extract the GIF file
var gifDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis\gifs";
Directory.CreateDirectory(gifDir);
var gifPath = gifDir + $"\\{fileName}.gif";
gifFile.Save(gifPath);
foreach (var profile in profileModels)
{ {
var gifLayer = demoProfile var gifLayer = profile.GetLayers().FirstOrDefault(l => l.Name == layerName);
.Layers.FirstOrDefault(l => l.Name == "Demo - GIFs")?
.Children.FirstOrDefault(c => c.Name == "GIF");
if (gifLayer == null) if (gifLayer == null)
continue; continue;
((KeyboardPropertiesModel) gifLayer.Properties).GifFile = gifPath; ((KeyboardPropertiesModel) gifLayer.Properties).GifFile = gifPath;
AddOrUpdate(demoProfile); AddOrUpdate(profile);
} }
} }
@ -208,20 +241,29 @@ namespace Artemis.DAL
if (string.IsNullOrEmpty(name)) if (string.IsNullOrEmpty(name))
return; return;
// Remove the old file // Remove the old profile
var path = ProfileFolder + $@"\{profile.KeyboardSlug}\{profile.GameName}\{profile.Name}.json"; DeleteProfile(profile);
if (File.Exists(path))
File.Delete(path);
// Update the profile, creating a new file // Update the profile, creating a new file
profile.Name = name; profile.Name = name;
AddOrUpdate(profile); AddOrUpdate(profile);
} }
public static void DeleteProfile(ProfileModel profile) public static void DeleteProfile(ProfileModel prof)
{ {
// Remove from datastore
lock (Profiles)
{
// Get the profile from the datastore instead of just the provided value, to be certain it is removed
var dsProfile = Profiles.FirstOrDefault(p => p.GameName == prof.GameName &&
p.Name == prof.Name &&
p.KeyboardSlug == prof.KeyboardSlug);
if (dsProfile != null)
Profiles.Remove(dsProfile);
}
// Remove the file // Remove the file
var path = ProfileFolder + $@"\{profile.KeyboardSlug}\{profile.GameName}\{profile.Name}.json"; var path = ProfileFolder + $@"\{prof.KeyboardSlug}\{prof.GameName}\{prof.Name}.json";
if (File.Exists(path)) if (File.Exists(path))
File.Delete(path); File.Delete(path);
} }

View File

@ -28,7 +28,7 @@ namespace Artemis.DeviceProviders.Razer
public override bool CanEnable() public override bool CanEnable()
{ {
if (!Chroma.IsSdkAvailable()) if (!Chroma.SdkAvailable)
return false; return false;
// Some people have Synapse installed, but not a Chroma keyboard, deal with this // Some people have Synapse installed, but not a Chroma keyboard, deal with this

View File

@ -1,6 +1,7 @@
using System.Drawing; using System.Drawing;
using Artemis.Utilities; using Artemis.Utilities;
using Corale.Colore.Razer.Keyboard.Effects; using Corale.Colore.Razer.Keyboard.Effects;
using Color = Corale.Colore.Core.Color;
namespace Artemis.DeviceProviders.Razer.Utilities namespace Artemis.DeviceProviders.Razer.Utilities
{ {
@ -13,8 +14,13 @@ namespace Artemis.DeviceProviders.Razer.Utilities
b = ImageUtilities.ResizeImage(b, width, height); b = ImageUtilities.ResizeImage(b, width, height);
for (var y = 0; y < b.Height; y++) for (var y = 0; y < b.Height; y++)
{
for (var x = 0; x < b.Width; x++) for (var x = 0; x < b.Width; x++)
keyboardGrid[y, x] = b.GetPixel(x, y); {
var pixel = b.GetPixel(x, y);
keyboardGrid[y, x] = new Color(pixel.R, pixel.G, pixel.B);
}
}
return keyboardGrid; return keyboardGrid;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@ -76,8 +76,8 @@ namespace Artemis.Modules.Games.UnrealTournament
{ {
Unzoomed = 0, Unzoomed = 0,
Zoomed = 3, Zoomed = 3,
ZoomingIn = 2, ZoomingIn = 1,
ZoomingOut = 1 ZoomingOut = 2
} }
public class Environment public class Environment

View File

@ -3,16 +3,12 @@ using System.Collections.Generic;
using Artemis.Managers; using Artemis.Managers;
using Artemis.Models; using Artemis.Models;
using Artemis.Profiles.Layers.Models; using Artemis.Profiles.Layers.Models;
using Artemis.Utilities.Memory;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Artemis.Modules.Games.UnrealTournament namespace Artemis.Modules.Games.UnrealTournament
{ {
public class UnrealTournamentModel : GameModel public class UnrealTournamentModel : GameModel
{ {
private Memory _memory;
private GamePointersCollection _pointer;
public UnrealTournamentModel(MainManager mainManager, UnrealTournamentSettings settings) public UnrealTournamentModel(MainManager mainManager, UnrealTournamentSettings settings)
: base(mainManager, settings, new UnrealTournamentDataModel()) : base(mainManager, settings, new UnrealTournamentDataModel())
{ {

View File

@ -4,8 +4,10 @@ using System.IO.Compression;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Windows.Forms; using System.Windows.Forms;
using Artemis.DAL;
using Artemis.InjectionFactories; using Artemis.InjectionFactories;
using Artemis.Managers; using Artemis.Managers;
using Artemis.Properties;
using Artemis.Utilities; using Artemis.Utilities;
using Artemis.ViewModels.Abstract; using Artemis.ViewModels.Abstract;
using Caliburn.Micro; using Caliburn.Micro;
@ -22,6 +24,7 @@ namespace Artemis.Modules.Games.UnrealTournament
DisplayName = "Unreal Tournament"; DisplayName = "Unreal Tournament";
MainManager.EffectManager.EffectModels.Add(GameModel); MainManager.EffectManager.EffectModels.Add(GameModel);
FindGame(); FindGame();
InstallGif();
} }
public UnrealTournamentModel UnrealTournamentModel { get; set; } public UnrealTournamentModel UnrealTournamentModel { get; set; }
@ -112,5 +115,12 @@ namespace Artemis.Modules.Games.UnrealTournament
MainManager.Logger.Info("Installed Unreal Tournament plugin in '{0}'", path); MainManager.Logger.Info("Installed Unreal Tournament plugin in '{0}'", path);
} }
private void InstallGif()
{
var gif = Resources.redeemer;
ProfileProvider.InsertGif(ProfileProvider.GetAll()
.Where(p => p.GameName == "UnrealTournament" && p.Name == "Default"), "Redeemer GIF", gif, "redeemer");
}
} }
} }

View File

@ -232,7 +232,6 @@
</xs:extension> </xs:extension>
</xs:complexContent> </xs:complexContent>
</xs:complexType> </xs:complexType>
<xs:complexType name="Layout"></xs:complexType>
<xs:complexType name="Filter" abstract="true"></xs:complexType> <xs:complexType name="Filter" abstract="true"></xs:complexType>
<xs:complexType name="TimeSource" abstract="true"></xs:complexType> <xs:complexType name="TimeSource" abstract="true"></xs:complexType>
<xs:simpleType name="SimpleLayoutAttribute"> <xs:simpleType name="SimpleLayoutAttribute">
@ -1020,8 +1019,8 @@
<xs:element name="archiveFileName" minOccurs="0" maxOccurs="1" type="Layout" /> <xs:element name="archiveFileName" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="archiveEvery" minOccurs="0" maxOccurs="1" type="NLog.Targets.FileArchivePeriod" /> <xs:element name="archiveEvery" minOccurs="0" maxOccurs="1" type="NLog.Targets.FileArchivePeriod" />
<xs:element name="archiveAboveSize" minOccurs="0" maxOccurs="1" type="xs:long" /> <xs:element name="archiveAboveSize" minOccurs="0" maxOccurs="1" type="xs:long" />
<xs:element name="maxArchiveFiles" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="enableArchiveFileCompression" minOccurs="0" maxOccurs="1" type="xs:boolean" /> <xs:element name="enableArchiveFileCompression" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="maxArchiveFiles" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="forceManaged" minOccurs="0" maxOccurs="1" type="xs:boolean" /> <xs:element name="forceManaged" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="cleanupFileName" minOccurs="0" maxOccurs="1" type="xs:boolean" /> <xs:element name="cleanupFileName" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="fileName" minOccurs="0" maxOccurs="1" type="Layout" /> <xs:element name="fileName" minOccurs="0" maxOccurs="1" type="Layout" />
@ -1093,16 +1092,16 @@
<xs:documentation>Size in bytes above which log files will be automatically archived. Warning: combining this with isn't supported. We cannot create multiple archive files, if they should have the same name. Choose: </xs:documentation> <xs:documentation>Size in bytes above which log files will be automatically archived. Warning: combining this with isn't supported. We cannot create multiple archive files, if they should have the same name. Choose: </xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="maxArchiveFiles" type="xs:integer">
<xs:annotation>
<xs:documentation>Maximum number of archive files that should be kept.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="enableArchiveFileCompression" type="xs:boolean"> <xs:attribute name="enableArchiveFileCompression" type="xs:boolean">
<xs:annotation> <xs:annotation>
<xs:documentation>Indicates whether to compress archive files into the zip archive format.</xs:documentation> <xs:documentation>Indicates whether to compress archive files into the zip archive format.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="maxArchiveFiles" type="xs:integer">
<xs:annotation>
<xs:documentation>Maximum number of archive files that should be kept.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="forceManaged" type="xs:boolean"> <xs:attribute name="forceManaged" type="xs:boolean">
<xs:annotation> <xs:annotation>
<xs:documentation>Gets or set a value indicating whether a managed file stream is forced, instead of used the native implementation.</xs:documentation> <xs:documentation>Gets or set a value indicating whether a managed file stream is forced, instead of used the native implementation.</xs:documentation>
@ -2238,6 +2237,18 @@
<xs:enumeration value="HttpGet" /> <xs:enumeration value="HttpGet" />
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:complexType name="CompoundLayout">
<xs:complexContent>
<xs:extension base="Layout">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="layout" minOccurs="0" maxOccurs="unbounded" type="Layout" />
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Layout">
<xs:choice minOccurs="0" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="CsvLayout"> <xs:complexType name="CsvLayout">
<xs:complexContent> <xs:complexContent>
<xs:extension base="Layout"> <xs:extension base="Layout">
@ -2334,8 +2345,14 @@
<xs:extension base="Layout"> <xs:extension base="Layout">
<xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="attribute" minOccurs="0" maxOccurs="unbounded" type="NLog.Layouts.JsonAttribute" /> <xs:element name="attribute" minOccurs="0" maxOccurs="unbounded" type="NLog.Layouts.JsonAttribute" />
<xs:element name="renderEmptyObject" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="suppressSpaces" minOccurs="0" maxOccurs="1" type="xs:boolean" /> <xs:element name="suppressSpaces" minOccurs="0" maxOccurs="1" type="xs:boolean" />
</xs:choice> </xs:choice>
<xs:attribute name="renderEmptyObject" type="xs:boolean">
<xs:annotation>
<xs:documentation>Option to render the empty object value {}</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="suppressSpaces" type="xs:boolean"> <xs:attribute name="suppressSpaces" type="xs:boolean">
<xs:annotation> <xs:annotation>
<xs:documentation>Option to suppress the extra spaces in the output json</xs:documentation> <xs:documentation>Option to suppress the extra spaces in the output json</xs:documentation>

View File

@ -22,16 +22,13 @@ namespace Artemis.Profiles.Layers.Types.Audio
{ {
private readonly List<LayerModel> _audioLayers = new List<LayerModel>(); private readonly List<LayerModel> _audioLayers = new List<LayerModel>();
private readonly MMDevice _device; private readonly MMDevice _device;
private readonly MainManager _mainManager;
private readonly SampleAggregator _sampleAggregator = new SampleAggregator(2048); private readonly SampleAggregator _sampleAggregator = new SampleAggregator(2048);
private readonly WasapiLoopbackCapture _waveIn; private readonly WasapiLoopbackCapture _waveIn;
private int _lines; private int _lines;
private AudioPropertiesModel _previousSettings; private AudioPropertiesModel _previousSettings;
private AudioPropertiesModel _properties;
public AudioType(MainManager mainManager) public AudioType(MainManager mainManager)
{ {
_mainManager = mainManager;
_device = _device =
new MMDeviceEnumerator().EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active).FirstOrDefault(); new MMDeviceEnumerator().EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active).FirstOrDefault();

View File

@ -288,6 +288,16 @@ namespace Artemis.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap redeemer {
get {
object obj = ResourceManager.GetObject("redeemer", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Byte[]. /// Looks up a localized resource of type System.Byte[].
/// </summary> /// </summary>

View File

@ -190,4 +190,7 @@
<data name="witcher3_mod" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="witcher3_mod" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Modules\Games\Witcher3\Resources\witcher3-mod.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>..\Modules\Games\Witcher3\Resources\witcher3-mod.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="redeemer" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Modules\Games\UnrealTournament\Resources\redeemer.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

View File

@ -15,12 +15,12 @@ namespace Artemis.Utilities
{ {
public static class Updater public static class Updater
{ {
public static int CurrentVersion = 1220; public static int CurrentVersion = 1230;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public static async Task<Action> CheckForUpdate(MetroDialogService dialogService) public static async Task<Action> CheckForUpdate(MetroDialogService dialogService)
{ {
Logger.Info("Checking for updates - Current version: 1.2.2.0"); Logger.Info("Checking for updates - Current version: 1.2.3.0");
if (!General.Default.CheckForUpdates) if (!General.Default.CheckForUpdates)
return null; return null;

View File

@ -518,38 +518,30 @@ namespace Artemis.ViewModels.Profiles
{ {
if (SelectedProfile == null) if (SelectedProfile == null)
return; return;
var oldName = SelectedProfile.Name; var name = await DialogService.ShowInputDialog("Rename profile", "Please enter a unique new profile name");
SelectedProfile.Name = await DialogService
.ShowInputDialog("Rename profile", "Please enter a unique new profile name");
// Null when the user cancelled // Null when the user cancelled
if (string.IsNullOrEmpty(SelectedProfile.Name) || SelectedProfile.Name.Length < 2) if (string.IsNullOrEmpty(name) || name.Length < 2)
{
SelectedProfile.Name = oldName;
return; return;
}
// Verify the name // Verify the name
while (ProfileProvider.GetAll().Contains(SelectedProfile)) while (ProfileProvider.GetAll().Any(p => p.Name == name && p.GameName == SelectedProfile.GameName &&
p.KeyboardSlug == SelectedProfile.KeyboardSlug))
{ {
SelectedProfile.Name = await DialogService. name = await DialogService.ShowInputDialog("Name already in use", "Please enter a unique new profile name");
ShowInputDialog("Name already in use", "Please enter a unique new profile name");
// Null when the user cancelled // Null when the user cancelled
if (string.IsNullOrEmpty(SelectedProfile.Name) || SelectedProfile.Name.Length < 2) if (string.IsNullOrEmpty(name) || name.Length < 2)
{
SelectedProfile.Name = oldName;
return; return;
}
} }
var newName = SelectedProfile.Name; var profile = SelectedProfile;
SelectedProfile.Name = oldName; SelectedProfile = null;
ProfileProvider.RenameProfile(SelectedProfile, newName); ProfileProvider.RenameProfile(profile, name);
LastProfile = name;
LoadProfiles(); LoadProfiles();
SelectedProfile = Profiles.FirstOrDefault(p => p.Name == newName);
} }
public async void DuplicateProfile() public async void DuplicateProfile()

View File

@ -113,7 +113,7 @@
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.ColumnSpan="2" x:Name="ActiveEffectName" /> <TextBlock Grid.Row="0" Grid.ColumnSpan="2" x:Name="ActiveEffectName" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="Artemis 1.2.2.0" VerticalAlignment="Center" <TextBlock Grid.Row="1" Grid.Column="0" Text="Artemis 1.2.3.0" VerticalAlignment="Center"
HorizontalAlignment="Left" /> HorizontalAlignment="Left" />
<Button Grid.Row="1" Grid.Column="1" Focusable="False" <Button Grid.Row="1" Grid.Column="1" Focusable="False"
Style="{StaticResource AccentedSquareButtonStyle}" Style="{StaticResource AccentedSquareButtonStyle}"

View File

@ -151,10 +151,12 @@
<!-- Layer list --> <!-- Layer list -->
<StackPanel Grid.Column="1" Grid.Row="0" Orientation="Horizontal"> <StackPanel Grid.Column="1" Grid.Row="0" Orientation="Horizontal">
<Label FontSize="20" HorizontalAlignment="Left" Content="Layers" Margin="10,0,0,0" /> <Label FontSize="20" HorizontalAlignment="Left" Content="Layers" Margin="10,0,0,0" />
<Label HorizontalAlignment="Right" Content="Show all" Margin="88,0,0,0" VerticalAlignment="Center" /> <Label HorizontalAlignment="Right" ToolTip="Show all layers instead of just the one you have selected"
<ToggleButton x:Name="ShowAll" Margin="0 3 0 0" Width="25" Height="25" Content="Show all" Margin="88,0,0,0" VerticalAlignment="Center" />
IsChecked="{Binding Path=ProfileViewModel.ShowAll, Mode=TwoWay}" <ToggleButton x:Name="ShowAll" ToolTip="Show all layers instead of just the one you have selected"
Style="{DynamicResource MetroCircleToggleButtonStyle}" HorizontalAlignment="Right" /> Margin="0 3 0 0" Width="25" Height="25"
IsChecked="{Binding Path=ProfileViewModel.ShowAll, Mode=TwoWay}"
Style="{DynamicResource MetroCircleToggleButtonStyle}" HorizontalAlignment="Right" />
</StackPanel> </StackPanel>
<Border Grid.Column="1" Grid.Row="1" Background="#FF232323" BorderBrush="{DynamicResource HighlightBrush}" <Border Grid.Column="1" Grid.Row="1" Background="#FF232323" BorderBrush="{DynamicResource HighlightBrush}"

View File

@ -1,10 +1,9 @@
<?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" />
<package id="Castle.Core" version="3.3.3" targetFramework="net452" /> <package id="Castle.Core" version="3.3.3" targetFramework="net452" />
<package id="Colore" version="4.0.0" targetFramework="net452" /> <package id="Colore" version="5.0.0" targetFramework="net461" />
<package id="CUE.NET" version="1.0.3" targetFramework="net452" /> <package id="CUE.NET" version="1.0.3" targetFramework="net452" />
<package id="DynamicExpresso.Core" version="1.3.1.0" targetFramework="net452" /> <package id="DynamicExpresso.Core" version="1.3.1.0" targetFramework="net452" />
<package id="Extended.Wpf.Toolkit" version="2.7" targetFramework="net452" /> <package id="Extended.Wpf.Toolkit" version="2.7" targetFramework="net452" />
@ -14,14 +13,14 @@
<package id="MahApps.Metro" version="1.2.4.0" targetFramework="net452" /> <package id="MahApps.Metro" version="1.2.4.0" targetFramework="net452" />
<package id="MahApps.Metro.Resources" version="0.6.1.0" targetFramework="net452" /> <package id="MahApps.Metro.Resources" version="0.6.1.0" targetFramework="net452" />
<package id="NAudio" version="1.7.3" targetFramework="net452" /> <package id="NAudio" version="1.7.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" /> <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
<package id="Ninject" version="3.2.2.0" targetFramework="net452" /> <package id="Ninject" version="3.2.2.0" targetFramework="net452" />
<package id="Ninject.Extensions.Factory" version="3.2.1.0" targetFramework="net452" /> <package id="Ninject.Extensions.Factory" version="3.2.1.0" targetFramework="net452" />
<package id="Ninject.Extensions.Logging" version="3.2.3.0" targetFramework="net452" /> <package id="Ninject.Extensions.Logging" version="3.2.3.0" targetFramework="net452" />
<package id="Ninject.Extensions.Logging.nlog4" version="3.2.3.0" targetFramework="net452" /> <package id="Ninject.Extensions.Logging.nlog4" version="3.2.3.0" targetFramework="net452" />
<package id="NLog" version="4.3.4" targetFramework="net452" /> <package id="NLog" version="4.3.7" targetFramework="net461" />
<package id="NLog.Schema" version="4.3.4" targetFramework="net452" /> <package id="NLog.Schema" version="4.3.7" targetFramework="net461" />
<package id="SpotifyAPI-NET" version="2.9.0" targetFramework="net452" /> <package id="SpotifyAPI-NET" version="2.11.0" targetFramework="net461" />
<package id="VirtualInput" version="1.0.1" targetFramework="net452" /> <package id="VirtualInput" version="1.0.1" targetFramework="net452" />
<package id="WpfExceptionViewer" version="1.0.0.0" targetFramework="net452" /> <package id="WpfExceptionViewer" version="1.0.0.0" targetFramework="net452" />
</packages> </packages>