-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathNotCondition.cs
More file actions
50 lines (44 loc) · 1.36 KB
/
NotCondition.cs
File metadata and controls
50 lines (44 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System.Xml;
using JetBrains.Annotations;
using Godot.Serialization;
namespace Godot.Modding.Patching.Conditions
{
/// <summary>
/// An <see cref="ICondition"/> that succeeds if a specified condition fails.
/// </summary>
[PublicAPI]
public class NotCondition : ICondition
{
/// <summary>
/// Initialises a new <see cref="NotCondition"/> with the specified parameters.
/// </summary>
/// <param name="condition">The <see cref="ICondition"/> to check.</param>
public NotCondition(ICondition condition)
{
this.Condition = condition;
}
[UsedImplicitly]
private NotCondition()
{
}
/// <summary>
/// The condition to check.
/// </summary>
[Serialize]
public ICondition Condition
{
get;
[UsedImplicitly]
private set;
} = null!;
/// <summary>
/// Succeeds if <see cref="Condition"/> fails.
/// </summary>
/// <param name="data">The <see cref="XmlNode"/> to apply the patch on.</param>
/// <returns><see langword="true"/> if <see cref="Condition"/> fails, else <see langword="false"/>.</returns>
public bool Check(XmlNode data)
{
return !this.Condition.Check(data);
}
}
}