aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs')
-rw-r--r--Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs b/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs
new file mode 100644
index 00000000..0ba0f8c3
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs
@@ -0,0 +1,35 @@
+using Ryujinx.HLE.HOS.Tamper.Conditions;
+using System.Collections.Generic;
+
+namespace Ryujinx.HLE.HOS.Tamper.Operations
+{
+ class IfBlock : IOperation
+ {
+ private ICondition _condition;
+ private IEnumerable<IOperation> _operations;
+
+ public IfBlock(ICondition condition, IEnumerable<IOperation> operations)
+ {
+ _condition = condition;
+ _operations = operations;
+ }
+
+ public IfBlock(ICondition condition, params IOperation[] operations)
+ {
+ _operations = operations;
+ }
+
+ public void Execute()
+ {
+ if (!_condition.Evaluate())
+ {
+ return;
+ }
+
+ foreach (IOperation op in _operations)
+ {
+ op.Execute();
+ }
+ }
+ }
+}