-
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd425c9
commit 8b5ca48
Showing
20 changed files
with
219 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...Toolkit.Lib.Automation/Pipeline/Triggers/GodModePresetChangedAutomationPipelineTrigger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using LenovoLegionToolkit.Lib.Automation.Resources; | ||
using LenovoLegionToolkit.Lib.Controllers.GodMode; | ||
using Newtonsoft.Json; | ||
|
||
namespace LenovoLegionToolkit.Lib.Automation.Pipeline.Triggers; | ||
|
||
public class GodModePresetChangedAutomationPipelineTrigger : IGodModePresetChangedAutomationPipelineTrigger | ||
{ | ||
[JsonIgnore] | ||
public string DisplayName => Resource.GodModePresetChangedAutomationPipelineTrigger_DisplayName; | ||
|
||
public Guid PresetId { get; } | ||
|
||
[JsonConstructor] | ||
public GodModePresetChangedAutomationPipelineTrigger(Guid presetId) | ||
{ | ||
PresetId = presetId; | ||
} | ||
|
||
public Task<bool> IsMatchingEvent(IAutomationEvent automationEvent) | ||
{ | ||
if (automationEvent is not CustomModePresetAutomationEvent e) | ||
return Task.FromResult(false); | ||
|
||
return Task.FromResult(e.Id == PresetId); | ||
} | ||
|
||
public async Task<bool> IsMatchingState() | ||
{ | ||
var controller = IoCContainer.Resolve<GodModeController>(); | ||
return PresetId == await controller.GetActivePresetIdAsync().ConfigureAwait(false); | ||
} | ||
|
||
public void UpdateEnvironment(ref AutomationEnvironment environment) { /* Ignored */ } | ||
|
||
public IAutomationPipelineTrigger DeepCopy() => new GodModePresetChangedAutomationPipelineTrigger(PresetId); | ||
|
||
public IGodModePresetChangedAutomationPipelineTrigger DeepCopy(Guid presetId) => new GodModePresetChangedAutomationPipelineTrigger(presetId); | ||
|
||
public override bool Equals(object? obj) | ||
{ | ||
return obj is GodModePresetChangedAutomationPipelineTrigger t && PresetId == t.PresetId; | ||
} | ||
|
||
public override int GetHashCode() => HashCode.Combine(PresetId); | ||
|
||
public override string ToString() => $"{nameof(PresetId)}: {PresetId}"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
LenovoLegionToolkit.Lib.Automation/Resources/Resource.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
LenovoLegionToolkit.Lib/Controllers/GodMode/IGodModeController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.