This repository has been archived by the owner on Oct 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from scellecs/bugfix/conditional-attributes
Bugfix/conditional attributes
- Loading branch information
Showing
22 changed files
with
185 additions
and
129 deletions.
There are no files selected for viewing
File renamed without changes.
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,29 @@ | ||
namespace Frigg { | ||
using System; | ||
|
||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, | ||
Inherited = false, AllowMultiple = true)] | ||
public abstract class ConditionAttribute : Attribute, IAttribute { | ||
public EConditionType ConditionType { get; } | ||
public string MemberName { get; } | ||
public string Expression { get; } | ||
|
||
public bool ExpectedValue { get; private set; } | ||
|
||
protected ConditionAttribute(string expression) { | ||
this.Expression = expression; | ||
this.ConditionType = EConditionType.ByExpression; | ||
} | ||
|
||
protected ConditionAttribute(string memberName, bool expectedValue) { | ||
this.ConditionType = EConditionType.ByCondition; | ||
this.MemberName = memberName; | ||
this.ExpectedValue = expectedValue; | ||
} | ||
} | ||
|
||
public enum EConditionType { | ||
ByExpression = 0, | ||
ByCondition = 1 | ||
} | ||
} |
File renamed without changes.
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,9 @@ | ||
namespace Frigg { | ||
public class DisableIfAttribute : ConditionAttribute { | ||
public DisableIfAttribute(string expression) : base(expression) { | ||
} | ||
|
||
public DisableIfAttribute(string name, bool expected) : base(name, expected) { | ||
} | ||
} | ||
} |
File renamed without changes.
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,9 @@ | ||
namespace Frigg { | ||
public class EnableIfAttribute : ConditionAttribute { | ||
public EnableIfAttribute(string expression) : base(expression) { | ||
} | ||
|
||
public EnableIfAttribute(string name, bool expected) : base(name, expected) { | ||
} | ||
} | ||
} |
File renamed without changes.
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,9 @@ | ||
namespace Frigg { | ||
public class HideIfAttribute : ConditionAttribute { | ||
public HideIfAttribute(string expression) : base(expression) { | ||
} | ||
|
||
public HideIfAttribute(string name, bool expected) : base(name, expected) { | ||
} | ||
} | ||
} |
File renamed without changes.
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,9 @@ | ||
namespace Frigg { | ||
public class ShowIfAttribute : ConditionAttribute { | ||
public ShowIfAttribute(string expression) : base(expression) { | ||
} | ||
|
||
public ShowIfAttribute(string name, bool expected) : base(name, expected) { | ||
} | ||
} | ||
} |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Oops, something went wrong.