diff --git a/Artemis/Artemis/DeviceProviders/Logitech/Orion.cs b/Artemis/Artemis/DeviceProviders/Logitech/Orion.cs index 55ab6b0c3..be42e322c 100644 --- a/Artemis/Artemis/DeviceProviders/Logitech/Orion.cs +++ b/Artemis/Artemis/DeviceProviders/Logitech/Orion.cs @@ -4,6 +4,7 @@ using System.Windows; using Artemis.DeviceProviders.Logitech.Utilities; using Artemis.Properties; using Artemis.Utilities; +using Artemis.Utilities.LogitechDll; namespace Artemis.DeviceProviders.Logitech { @@ -21,10 +22,11 @@ namespace Artemis.DeviceProviders.Logitech PreviewSettings = new PreviewSettings(540, 154, new Thickness(25, -80, 0, 0), Resources.g910); } + // TODO: https://github.com/SpoinkyNL/Artemis/issues/86 public override bool CanEnable() { - //if (DllManager.RestoreDll()) - // RestoreDll(); + if (DllManager.RestoreDll()) + RestoreDll(); int majorNum = 0, minorNum = 0, buildNum = 0; LogitechGSDK.LogiLedInit(); diff --git a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs index 3f35e0d26..2358c7052 100644 --- a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs +++ b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs @@ -55,11 +55,17 @@ namespace Artemis.Modules.Games.CounterStrike public override Brush GenerateMouseBrush() { + if (Profile == null || GameDataModel == null) + return null; + return Profile.GenerateBrush(GameDataModel, LayerType.Mouse, false, true); } public override Brush GenerateHeadsetBrush() { + if (Profile == null || GameDataModel == null) + return null; + return Profile.GenerateBrush(GameDataModel, LayerType.Headset, false, true); } diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2DataModel.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2DataModel.cs index e3330e4ef..d48a028c2 100644 --- a/Artemis/Artemis/Modules/Games/Dota2/Dota2DataModel.cs +++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2DataModel.cs @@ -23,6 +23,7 @@ namespace Artemis.Modules.Games.Dota2 public class Map { + public int dayCyclePercentage; public string name { get; set; } public long matchid { get; set; } public int game_time { get; set; } diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs index ef358c266..bc383107e 100644 --- a/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs +++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs @@ -23,7 +23,6 @@ namespace Artemis.Modules.Games.Dota2 public int Scale { get; set; } public new Dota2Settings Settings { get; set; } - public Dota2DataModel D2Json { get; set; } public override void Dispose() { @@ -41,20 +40,17 @@ namespace Artemis.Modules.Games.Dota2 public override void Update() { - if (D2Json?.map == null) - return; - UpdateDay(); } private void UpdateDay() { - if (D2Json?.map?.daytime == null) + var dataModel = GameDataModel as Dota2DataModel; + if (dataModel?.map?.daytime == null) return; - var timeLeft = 240 - D2Json.map.clock_time%240; - var timePercentage = 100.00/240*timeLeft; - // TODO: Insert timePercentage into the DataModel as it will be useful when creating profiles + var timeLeft = 240 - dataModel.map.clock_time%240; + dataModel.map.dayCyclePercentage = (int) (100.00 / 240 * timeLeft); } @@ -69,11 +65,17 @@ namespace Artemis.Modules.Games.Dota2 public override Brush GenerateMouseBrush() { + if (Profile == null || GameDataModel == null) + return null; + return Profile.GenerateBrush(GameDataModel, LayerType.Mouse, false, true); } public override Brush GenerateHeadsetBrush() { + if (Profile == null || GameDataModel == null) + return null; + return Profile.GenerateBrush(GameDataModel, LayerType.Headset, false, true); } @@ -86,7 +88,7 @@ namespace Artemis.Modules.Games.Dota2 return; // Parse the JSON - D2Json = JsonConvert.DeserializeObject(jsonString); + GameDataModel = JsonConvert.DeserializeObject(jsonString); } } } \ No newline at end of file diff --git a/Artemis/Artemis/Modules/Games/Overwatch/OverwatchModel.cs b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchModel.cs index c874a487c..ac03eb17c 100644 --- a/Artemis/Artemis/Modules/Games/Overwatch/OverwatchModel.cs +++ b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchModel.cs @@ -139,12 +139,18 @@ namespace Artemis.Modules.Games.Overwatch public override Brush GenerateMouseBrush() { - return Profile?.GenerateBrush(GameDataModel, LayerType.Mouse, false, true); + if (Profile == null || GameDataModel == null) + return null; + + return Profile.GenerateBrush(GameDataModel, LayerType.Mouse, false, true); } public override Brush GenerateHeadsetBrush() { - return Profile?.GenerateBrush(GameDataModel, LayerType.Headset, false, true); + if (Profile == null || GameDataModel == null) + return null; + + return Profile.GenerateBrush(GameDataModel, LayerType.Headset, false, true); } } diff --git a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueModel.cs b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueModel.cs index 97b1e4fac..0aeee17b3 100644 --- a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueModel.cs +++ b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueModel.cs @@ -80,11 +80,17 @@ namespace Artemis.Modules.Games.RocketLeague public override Brush GenerateMouseBrush() { + if (Profile == null || GameDataModel == null) + return null; + return Profile.GenerateBrush(GameDataModel, LayerType.Mouse, false, true); } public override Brush GenerateHeadsetBrush() { + if (Profile == null || GameDataModel == null) + return null; + return Profile.GenerateBrush(GameDataModel, LayerType.Headset, false, true); } } diff --git a/Artemis/Artemis/Modules/Games/TheDivision/TheDivisionModel.cs b/Artemis/Artemis/Modules/Games/TheDivision/TheDivisionModel.cs index 57f31896b..9e788568e 100644 --- a/Artemis/Artemis/Modules/Games/TheDivision/TheDivisionModel.cs +++ b/Artemis/Artemis/Modules/Games/TheDivision/TheDivisionModel.cs @@ -244,11 +244,17 @@ namespace Artemis.Modules.Games.TheDivision public override Brush GenerateMouseBrush() { + if (Profile == null || GameDataModel == null) + return null; + return Profile.GenerateBrush(GameDataModel, LayerType.Mouse, false, true); } public override Brush GenerateHeadsetBrush() { + if (Profile == null || GameDataModel == null) + return null; + return Profile.GenerateBrush(GameDataModel, LayerType.Headset, false, true); } } diff --git a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Model.cs b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Model.cs index 4eacbe008..b5d282c06 100644 --- a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Model.cs +++ b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Model.cs @@ -117,11 +117,17 @@ namespace Artemis.Modules.Games.Witcher3 public override Brush GenerateMouseBrush() { + if (Profile == null || GameDataModel == null) + return null; + return Profile.GenerateBrush(GameDataModel, LayerType.Mouse, false, true); } public override Brush GenerateHeadsetBrush() { + if (Profile == null || GameDataModel == null) + return null; + return Profile.GenerateBrush(GameDataModel, LayerType.Headset, false, true); } }