|
|
|
@ -13,6 +13,9 @@ namespace ICSharpCode.Core
@@ -13,6 +13,9 @@ namespace ICSharpCode.Core
|
|
|
|
|
string name; |
|
|
|
|
Properties properties; |
|
|
|
|
ConditionFailedAction action; |
|
|
|
|
|
|
|
|
|
public AddIn AddIn { get; private set; } |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns the action which occurs, when this condition fails.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -24,6 +27,7 @@ namespace ICSharpCode.Core
@@ -24,6 +27,7 @@ namespace ICSharpCode.Core
|
|
|
|
|
action = value; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public string Name { |
|
|
|
|
get { |
|
|
|
|
return name; |
|
|
|
@ -42,8 +46,9 @@ namespace ICSharpCode.Core
@@ -42,8 +46,9 @@ namespace ICSharpCode.Core
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Condition(string name, Properties properties) |
|
|
|
|
public Condition(string name, Properties properties, AddIn addIn) |
|
|
|
|
{ |
|
|
|
|
this.AddIn = addIn; |
|
|
|
|
this.name = name; |
|
|
|
|
this.properties = properties; |
|
|
|
|
action = properties.Get("action", ConditionFailedAction.Exclude); |
|
|
|
@ -59,14 +64,14 @@ namespace ICSharpCode.Core
@@ -59,14 +64,14 @@ namespace ICSharpCode.Core
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static ICondition Read(XmlReader reader) |
|
|
|
|
public static ICondition Read(XmlReader reader, AddIn addIn) |
|
|
|
|
{ |
|
|
|
|
Properties properties = Properties.ReadFromAttributes(reader); |
|
|
|
|
string conditionName = properties["name"]; |
|
|
|
|
return new Condition(conditionName, properties); |
|
|
|
|
return new Condition(conditionName, properties, addIn); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static ICondition ReadComplexCondition(XmlReader reader) |
|
|
|
|
public static ICondition ReadComplexCondition(XmlReader reader, AddIn addIn) |
|
|
|
|
{ |
|
|
|
|
Properties properties = Properties.ReadFromAttributes(reader); |
|
|
|
|
reader.Read(); |
|
|
|
@ -76,13 +81,13 @@ namespace ICSharpCode.Core
@@ -76,13 +81,13 @@ namespace ICSharpCode.Core
|
|
|
|
|
case XmlNodeType.Element: |
|
|
|
|
switch (reader.LocalName) { |
|
|
|
|
case "And": |
|
|
|
|
condition = AndCondition.Read(reader); |
|
|
|
|
condition = AndCondition.Read(reader, addIn); |
|
|
|
|
goto exit; |
|
|
|
|
case "Or": |
|
|
|
|
condition = OrCondition.Read(reader); |
|
|
|
|
condition = OrCondition.Read(reader, addIn); |
|
|
|
|
goto exit; |
|
|
|
|
case "Not": |
|
|
|
|
condition = NegatedCondition.Read(reader); |
|
|
|
|
condition = NegatedCondition.Read(reader, addIn); |
|
|
|
|
goto exit; |
|
|
|
|
default: |
|
|
|
|
throw new AddInLoadException("Invalid element name '" + reader.LocalName |
|
|
|
@ -99,7 +104,7 @@ namespace ICSharpCode.Core
@@ -99,7 +104,7 @@ namespace ICSharpCode.Core
|
|
|
|
|
return condition; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static ICondition[] ReadConditionList(XmlReader reader, string endElement) |
|
|
|
|
public static ICondition[] ReadConditionList(XmlReader reader, string endElement, AddIn addIn) |
|
|
|
|
{ |
|
|
|
|
List<ICondition> conditions = new List<ICondition>(); |
|
|
|
|
while (reader.Read()) { |
|
|
|
@ -112,16 +117,16 @@ namespace ICSharpCode.Core
@@ -112,16 +117,16 @@ namespace ICSharpCode.Core
|
|
|
|
|
case XmlNodeType.Element: |
|
|
|
|
switch (reader.LocalName) { |
|
|
|
|
case "And": |
|
|
|
|
conditions.Add(AndCondition.Read(reader)); |
|
|
|
|
conditions.Add(AndCondition.Read(reader, addIn)); |
|
|
|
|
break; |
|
|
|
|
case "Or": |
|
|
|
|
conditions.Add(OrCondition.Read(reader)); |
|
|
|
|
conditions.Add(OrCondition.Read(reader, addIn)); |
|
|
|
|
break; |
|
|
|
|
case "Not": |
|
|
|
|
conditions.Add(NegatedCondition.Read(reader)); |
|
|
|
|
conditions.Add(NegatedCondition.Read(reader, addIn)); |
|
|
|
|
break; |
|
|
|
|
case "Condition": |
|
|
|
|
conditions.Add(Condition.Read(reader)); |
|
|
|
|
conditions.Add(Condition.Read(reader, addIn)); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
throw new AddInLoadException("Invalid element name '" + reader.LocalName |
|
|
|
|