mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Cleaned up Nuget packages, fixed crash with Windows Profile, UI improvements
This commit is contained in:
parent
208c5efb9c
commit
ddb0b5474e
@ -2,56 +2,23 @@
|
||||
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings"
|
||||
type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<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.Overwatch.Overwatch"
|
||||
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"
|
||||
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 name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<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.Overwatch.Overwatch" 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" 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>
|
||||
</configSections>
|
||||
<connectionStrings />
|
||||
|
||||
@ -156,10 +156,6 @@
|
||||
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Kaliko.ImageLibrary, Version=2.0.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ImageLibrary.2.0.5\lib\net45\Kaliko.ImageLibrary.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.5\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -199,18 +195,6 @@
|
||||
<HintPath>..\packages\NLog.4.3.4\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SharpDX, Version=3.0.2.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpDX.3.0.2\lib\net45\SharpDX.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SharpDX.Direct3D11, Version=3.0.2.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpDX.Direct3D11.3.0.2\lib\net45\SharpDX.Direct3D11.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SharpDX.DXGI, Version=3.0.2.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpDX.DXGI.3.0.2\lib\net45\SharpDX.DXGI.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SpotifyAPI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SpotifyAPI-NET.2.9.0\lib\SpotifyAPI.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -326,13 +310,6 @@
|
||||
<Compile Include="Models\Profiles\Properties\LayerPropertiesModel.cs" />
|
||||
<Compile Include="Models\Profiles\Properties\FolderPropertiesModel.cs" />
|
||||
<Compile Include="Models\Profiles\Properties\MousePropertiesModel.cs" />
|
||||
<Compile Include="Modules\Effects\AmbientLightning\AmbientLightningEffectModel.cs" />
|
||||
<Compile Include="Modules\Effects\AmbientLightning\AmbientLightningEffectSettings.cs" />
|
||||
<Compile Include="Modules\Effects\AmbientLightning\AmbientLightningEffectView.xaml.cs">
|
||||
<DependentUpon>AmbientLightningEffectView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Effects\AmbientLightning\AmbientLightningEffectViewModel.cs" />
|
||||
<Compile Include="Modules\Effects\AmbientLightning\ScreenCapture.cs" />
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualization.Designer.cs">
|
||||
<DependentUpon>AudioVisualization.settings</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
@ -673,10 +650,6 @@
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="Modules\Effects\AmbientLightning\AmbientLightningEffectView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Modules\Effects\WindowsProfile\WindowsProfileView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@ -27,7 +27,6 @@ namespace Artemis.InjectionModules
|
||||
Bind<EffectViewModel>().To<AudioVisualizerViewModel>().InSingletonScope();
|
||||
Bind<EffectViewModel>().To<TypeWaveViewModel>().InSingletonScope();
|
||||
Bind<EffectViewModel>().To<WindowsProfileViewModel>().InSingletonScope();
|
||||
//Bind<EffectViewModel>().To<AmbientLightningEffectViewModel>().InSingletonScope();
|
||||
|
||||
// Games
|
||||
Bind<GameViewModel>().To<CounterStrikeViewModel>().InSingletonScope();
|
||||
|
||||
@ -1,120 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Models.Profiles;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
|
||||
namespace Artemis.Modules.Effects.AmbientLightning
|
||||
{
|
||||
internal class AmbientLightningEffectModel : EffectModel
|
||||
{
|
||||
private KeyboardRectangle _botRect;
|
||||
private List<Color> _colors;
|
||||
private List<Rectangle> _rectangles;
|
||||
private ScreenCapture _screenCapturer;
|
||||
private KeyboardRectangle _topRect;
|
||||
|
||||
public AmbientLightningEffectModel(MainManager mainManager, AmbientLightningEffectSettings settings)
|
||||
: base(mainManager, null)
|
||||
{
|
||||
Name = "Ambient Lightning";
|
||||
Settings = settings;
|
||||
Scale = 4;
|
||||
Initialized = false;
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
|
||||
public AmbientLightningEffectSettings Settings { get; set; }
|
||||
|
||||
public KeyboardRectangle KeyboardRectangle { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
|
||||
_screenCapturer.Dispose();
|
||||
_screenCapturer = null;
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
Initialized = false;
|
||||
|
||||
_colors = new List<Color>();
|
||||
_screenCapturer = new ScreenCapture();
|
||||
_topRect = new KeyboardRectangle(MainManager.DeviceManager.ActiveKeyboard, 0, 0, new List<Color>(),
|
||||
LinearGradientMode.Horizontal) {Height = MainManager.DeviceManager.ActiveKeyboard.Height*Scale/2};
|
||||
_botRect = new KeyboardRectangle(MainManager.DeviceManager.ActiveKeyboard, 0, 0, new List<Color>(),
|
||||
LinearGradientMode.Horizontal);
|
||||
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
var capture = _screenCapturer.Capture();
|
||||
if (capture == null)
|
||||
return;
|
||||
|
||||
_rectangles = new List<Rectangle>();
|
||||
// Analise the result
|
||||
// Chop the screen into 2 rows and 3 columns
|
||||
var resolution = Screen.PrimaryScreen.Bounds;
|
||||
var blockWidth = resolution.Width/3;
|
||||
var blockHeight = resolution.Height/2;
|
||||
var colorIndex = 0;
|
||||
for (var row = 0; row < 2; row++)
|
||||
{
|
||||
for (var column = 0; column < 3; column++)
|
||||
{
|
||||
var blockBase = new Point(blockWidth*column, blockHeight*row);
|
||||
var samples = new List<Color>();
|
||||
// For each block, take samples
|
||||
for (var blockRow = 0; blockRow < 6; blockRow++)
|
||||
{
|
||||
for (var blockColumn = 0; blockColumn < 6; blockColumn++)
|
||||
{
|
||||
var x = blockWidth/6*blockColumn + blockWidth/6/4 + blockBase.X;
|
||||
var y = blockHeight/6*blockRow + blockHeight/6/4 + blockBase.Y;
|
||||
samples.Add(_screenCapturer.GetColor(capture, new Point(x, y)));
|
||||
}
|
||||
}
|
||||
|
||||
// Take the average of the samples
|
||||
var averageR = samples.Sum(s => s.R)/samples.Count;
|
||||
var averageG = samples.Sum(s => s.G)/samples.Count;
|
||||
var averageB = samples.Sum(s => s.B)/samples.Count;
|
||||
|
||||
if (_colors.Count <= colorIndex)
|
||||
_colors.Add(Color.FromArgb(255, averageR, averageG, averageB));
|
||||
else
|
||||
_colors[colorIndex] = Color.FromArgb(255, (averageR + _colors[colorIndex].R*5)/6,
|
||||
(averageG + _colors[colorIndex].G*5)/6, (averageB + _colors[colorIndex].B*5)/6);
|
||||
colorIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
// Put the resulting colors in 6 rectangles, their size differs per keyboard
|
||||
var rectWidth = MainManager.DeviceManager.ActiveKeyboard.Width/3*Scale;
|
||||
var rectHeight = MainManager.DeviceManager.ActiveKeyboard.Height/2*Scale;
|
||||
for (var row = 0; row < 2; row++)
|
||||
{
|
||||
for (var column = 0; column < 3; column++)
|
||||
{
|
||||
var rectBase = new Point(rectWidth*column, rectHeight*row);
|
||||
_rectangles.Add(new Rectangle(rectBase.X, rectBase.Y, rectWidth, rectHeight));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
using System.Drawing.Drawing2D;
|
||||
using Artemis.Models;
|
||||
|
||||
namespace Artemis.Modules.Effects.AmbientLightning
|
||||
{
|
||||
internal class AmbientLightningEffectSettings : EffectSettings
|
||||
{
|
||||
public AmbientLightningEffectSettings()
|
||||
{
|
||||
Load();
|
||||
}
|
||||
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public bool Rotate { get; set; }
|
||||
public int Scale { get; set; }
|
||||
public LinearGradientMode Type { get; set; }
|
||||
|
||||
public sealed override void Load()
|
||||
{
|
||||
ToDefault();
|
||||
}
|
||||
|
||||
public sealed override void Save()
|
||||
{
|
||||
}
|
||||
|
||||
public sealed override void ToDefault()
|
||||
{
|
||||
Width = 84;
|
||||
Height = 24;
|
||||
Scale = 4;
|
||||
Type = LinearGradientMode.Horizontal;
|
||||
Rotate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,55 +0,0 @@
|
||||
<UserControl x:Class="Artemis.Modules.Effects.AmbientLightning.AmbientLightningEffectView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Artemis.Modules.Effects.AmbientLightning"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="475.392" d:DesignWidth="583.577">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15, 5, 15, 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" MaxWidth="500" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="Colors the keyboard according to what is on screen" />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleEffect]"
|
||||
ToolTip="Note: You can't enable an effect when Artemis is disabled"
|
||||
ToolTipService.ShowOnDisabled="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="8" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@ -1,15 +0,0 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Artemis.Modules.Effects.AmbientLightning
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for AmbientLightningEffectView.xaml
|
||||
/// </summary>
|
||||
public partial class AmbientLightningEffectView : UserControl
|
||||
{
|
||||
public AmbientLightningEffectView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
using Artemis.Events;
|
||||
using Artemis.Managers;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Effects.AmbientLightning
|
||||
{
|
||||
public sealed class AmbientLightningEffectViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
||||
{
|
||||
public AmbientLightningEffectViewModel(MainManager main, IEventAggregator events)
|
||||
: base(main, new AmbientLightningEffectModel(main, new AmbientLightningEffectSettings()))
|
||||
{
|
||||
DisplayName = "Ambient Lightning";
|
||||
|
||||
events.Subscribe(this);
|
||||
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
||||
}
|
||||
|
||||
public void Handle(ActiveEffectChanged message)
|
||||
{
|
||||
NotifyOfPropertyChange(() => EffectEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,125 +0,0 @@
|
||||
// Original code by Florian Schnell
|
||||
// http://www.floschnell.de/computer-science/super-fast-screen-capture-with-windows-8.html
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using SharpDX;
|
||||
using SharpDX.Direct3D;
|
||||
using SharpDX.Direct3D11;
|
||||
using SharpDX.DXGI;
|
||||
using Device = SharpDX.Direct3D11.Device;
|
||||
using MapFlags = SharpDX.DXGI.MapFlags;
|
||||
using Resource = SharpDX.DXGI.Resource;
|
||||
using ResultCode = SharpDX.DXGI.ResultCode;
|
||||
|
||||
namespace Artemis.Modules.Effects.AmbientLightning
|
||||
{
|
||||
internal class ScreenCapture : IDisposable
|
||||
{
|
||||
private readonly Device _device;
|
||||
private readonly OutputDuplication _duplicatedOutput;
|
||||
private readonly Factory1 _factory;
|
||||
private readonly Texture2D _screenTexture;
|
||||
private DataStream _dataStream;
|
||||
private Resource _screenResource;
|
||||
private Surface _screenSurface;
|
||||
|
||||
public ScreenCapture()
|
||||
{
|
||||
// Create device and factory
|
||||
_device = new Device(DriverType.Hardware);
|
||||
_factory = new Factory1();
|
||||
|
||||
// Creating CPU-accessible texture resource
|
||||
var texdes = new Texture2DDescription
|
||||
{
|
||||
CpuAccessFlags = CpuAccessFlags.Read,
|
||||
BindFlags = BindFlags.None,
|
||||
Format = Format.B8G8R8A8_UNorm,
|
||||
Height = _factory.Adapters1[0].Outputs[0].Description.DesktopBounds.Bottom,
|
||||
Width = _factory.Adapters1[0].Outputs[0].Description.DesktopBounds.Right,
|
||||
OptionFlags = ResourceOptionFlags.None,
|
||||
MipLevels = 1,
|
||||
ArraySize = 1,
|
||||
SampleDescription =
|
||||
{
|
||||
Count = 1,
|
||||
Quality = 0
|
||||
},
|
||||
Usage = ResourceUsage.Staging
|
||||
};
|
||||
_screenTexture = new Texture2D(_device, texdes);
|
||||
|
||||
// duplicate output stuff
|
||||
var output = new Output1(_factory.Adapters1[0].Outputs[0].NativePointer);
|
||||
_duplicatedOutput = output.DuplicateOutput(_device);
|
||||
_screenResource = null;
|
||||
_dataStream = null;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_duplicatedOutput.Dispose();
|
||||
_screenResource.Dispose();
|
||||
_dataStream.Dispose();
|
||||
_factory.Dispose();
|
||||
}
|
||||
|
||||
public DataStream Capture()
|
||||
{
|
||||
try
|
||||
{
|
||||
OutputDuplicateFrameInformation duplicateFrameInformation;
|
||||
_duplicatedOutput.AcquireNextFrame(1000, out duplicateFrameInformation, out _screenResource);
|
||||
}
|
||||
catch (SharpDXException e)
|
||||
{
|
||||
if (e.ResultCode.Code == ResultCode.WaitTimeout.Result.Code ||
|
||||
e.ResultCode.Code == ResultCode.AccessDenied.Result.Code ||
|
||||
e.ResultCode.Code == ResultCode.AccessLost.Result.Code)
|
||||
return null;
|
||||
throw;
|
||||
}
|
||||
|
||||
// copy resource into memory that can be accessed by the CPU
|
||||
_device.ImmediateContext.CopyResource(_screenResource.QueryInterface<SharpDX.Direct3D11.Resource>(),
|
||||
_screenTexture);
|
||||
|
||||
// cast from texture to surface, so we can access its bytes
|
||||
_screenSurface = _screenTexture.QueryInterface<Surface>();
|
||||
|
||||
// map the resource to access it
|
||||
_screenSurface.Map(MapFlags.Read, out _dataStream);
|
||||
|
||||
// seek within the stream and read one byte
|
||||
_dataStream.Position = 4;
|
||||
_dataStream.ReadByte();
|
||||
|
||||
// free resources
|
||||
_dataStream.Close();
|
||||
_screenSurface.Unmap();
|
||||
_screenSurface.Dispose();
|
||||
_screenResource.Dispose();
|
||||
_duplicatedOutput.ReleaseFrame();
|
||||
|
||||
return _dataStream;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a specific pixel out of the data stream.
|
||||
/// </summary>
|
||||
/// <param name="surfaceDataStream"></param>
|
||||
/// <param name="position">Given point on the screen.</param>
|
||||
/// <returns></returns>
|
||||
public Color GetColor(DataStream surfaceDataStream, Point position)
|
||||
{
|
||||
var data = new byte[4];
|
||||
surfaceDataStream.Seek(
|
||||
position.Y*_factory.Adapters1[0].Outputs[0].Description.DesktopBounds.Right*4 + position.X*4,
|
||||
SeekOrigin.Begin);
|
||||
surfaceDataStream.Read(data, 0, 4);
|
||||
return Color.FromArgb(255, data[2], data[1], data[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,20 +6,24 @@ using System.Threading.Tasks;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Models.Profiles;
|
||||
using Ninject.Extensions.Logging;
|
||||
using SpotifyAPI.Local;
|
||||
|
||||
namespace Artemis.Modules.Effects.WindowsProfile
|
||||
{
|
||||
public class WindowsProfileModel : EffectModel
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private List<PerformanceCounter> _cores;
|
||||
private int _cpuFrames;
|
||||
private SpotifyLocalAPI _spotify;
|
||||
private bool _spotifySetupBusy;
|
||||
private bool _triedCpuFix;
|
||||
|
||||
public WindowsProfileModel(MainManager mainManager, WindowsProfileSettings settings)
|
||||
public WindowsProfileModel(ILogger logger, MainManager mainManager, WindowsProfileSettings settings)
|
||||
: base(mainManager, new WindowsProfileDataModel())
|
||||
{
|
||||
_logger = logger;
|
||||
Name = "WindowsProfile";
|
||||
Settings = settings;
|
||||
}
|
||||
@ -50,17 +54,28 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
||||
|
||||
private void SetupCpu()
|
||||
{
|
||||
_cores = GetPerformanceCounters();
|
||||
var coreCount = _cores.Count;
|
||||
while (coreCount < 8)
|
||||
try
|
||||
{
|
||||
_cores.Add(null);
|
||||
coreCount++;
|
||||
_cores = GetPerformanceCounters();
|
||||
var coreCount = _cores.Count;
|
||||
while (coreCount < 8)
|
||||
{
|
||||
_cores.Add(null);
|
||||
coreCount++;
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
_logger.Warn("Failed to setup CPU information, try running \"lodctr /R\" as administrator.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void UpdateCpu(WindowsProfileDataModel dataModel)
|
||||
{
|
||||
if (_cores == null)
|
||||
return;
|
||||
|
||||
// CPU is only updated every 15 frames, the performance counter gives 0 if updated too often
|
||||
_cpuFrames++;
|
||||
if (_cpuFrames < 16)
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
<ControlTemplate TargetType="Thumb">
|
||||
<Grid>
|
||||
<Path Data="M0,3 L5,3 L7,0 L9,3 L14,3 L14,16 L0,16 Z" Height="16" Width="14"
|
||||
Fill="{DynamicResource BaseBorderBrush}" />
|
||||
Fill="White" />
|
||||
|
||||
<Path Data="M1,4 L5,4 L7,1 L9,4 L13,4 L13,15 L1,15 Z" Height="16" Width="14"
|
||||
Fill="{TemplateBinding Background}" />
|
||||
@ -82,8 +82,9 @@
|
||||
<ControlTemplate TargetType="Slider">
|
||||
<Track x:Name="PART_Track">
|
||||
<Track.Thumb>
|
||||
<Thumb Style="{StaticResource SliderThumbStyle}" Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}" />
|
||||
<Thumb Style="{StaticResource SliderThumbStyle}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"/>
|
||||
</Track.Thumb>
|
||||
</Track>
|
||||
</ControlTemplate>
|
||||
@ -490,11 +491,9 @@
|
||||
SelectedGradient="{Binding}"
|
||||
Margin="0,0,0,2">
|
||||
<nc:GradientStopSlider.Background>
|
||||
<SolidColorBrush
|
||||
Color="{Binding Color}" />
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</nc:GradientStopSlider.Background>
|
||||
</nc:GradientStopSlider>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
|
||||
@ -255,6 +255,14 @@ namespace Artemis.ViewModels.Profiles
|
||||
SelectedProfile = lastProfileModel ?? Profiles.FirstOrDefault();
|
||||
}
|
||||
|
||||
public void EditLayerFromDoubleClick()
|
||||
{
|
||||
if (ProfileViewModel.SelectedLayer?.LayerType == LayerType.Folder)
|
||||
return;
|
||||
|
||||
EditLayer();
|
||||
}
|
||||
|
||||
public void EditLayer()
|
||||
{
|
||||
if (ProfileViewModel.SelectedLayer == null)
|
||||
|
||||
@ -154,7 +154,8 @@
|
||||
dragDrop:DragDrop.IsDropTarget="True"
|
||||
dragDrop:DragDrop.DropHandler="{Binding}"
|
||||
ItemsSource="{Binding Path=Layers, Converter={StaticResource LayerOrderConverter}, ConverterParameter=Order}"
|
||||
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
|
||||
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event MouseDoubleClick] = [Action EditLayerFromDoubleClick]">
|
||||
<i:Interaction.Behaviors>
|
||||
<itemBehaviours:BindableSelectedItemBehavior
|
||||
SelectedItem="{Binding ProfileViewModel.SelectedLayer, Mode=TwoWay}" />
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="Caliburn.Micro" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="3.0.1" targetFramework="net452" />
|
||||
@ -9,7 +8,6 @@
|
||||
<package id="Extended.Wpf.Toolkit" version="2.7" targetFramework="net452" />
|
||||
<package id="gong-wpf-dragdrop" version="0.1.4.3" targetFramework="net452" />
|
||||
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net452" />
|
||||
<package id="ImageLibrary" version="2.0.5" targetFramework="net452" />
|
||||
<package id="log4net" version="2.0.5" 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" />
|
||||
@ -21,9 +19,6 @@
|
||||
<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.Schema" version="4.3.4" targetFramework="net452" />
|
||||
<package id="SharpDX" version="3.0.2" targetFramework="net452" />
|
||||
<package id="SharpDX.Direct3D11" version="3.0.2" targetFramework="net452" />
|
||||
<package id="SharpDX.DXGI" version="3.0.2" targetFramework="net452" />
|
||||
<package id="SpotifyAPI-NET" version="2.9.0" targetFramework="net452" />
|
||||
<package id="System.Linq.Dynamic" version="1.0.6" targetFramework="net452" />
|
||||
<package id="VirtualInput" version="1.0.1" targetFramework="net452" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user