IfBlock.cs 824 B

1234567891011121314151617181920212223242526272829303132333435
  1. using Ryujinx.HLE.HOS.Tamper.Conditions;
  2. using System.Collections.Generic;
  3. namespace Ryujinx.HLE.HOS.Tamper.Operations
  4. {
  5. class IfBlock : IOperation
  6. {
  7. private ICondition _condition;
  8. private IEnumerable<IOperation> _operations;
  9. public IfBlock(ICondition condition, IEnumerable<IOperation> operations)
  10. {
  11. _condition = condition;
  12. _operations = operations;
  13. }
  14. public IfBlock(ICondition condition, params IOperation[] operations)
  15. {
  16. _operations = operations;
  17. }
  18. public void Execute()
  19. {
  20. if (!_condition.Evaluate())
  21. {
  22. return;
  23. }
  24. foreach (IOperation op in _operations)
  25. {
  26. op.Execute();
  27. }
  28. }
  29. }
  30. }