/// <summary> /// Adds the elements of an array to the end of this ConditionExpressionCollection. /// </summary> /// <param name="items"> /// The array whose elements are to be added to the end of this ConditionExpressionCollection. /// </param> public virtual void AddRange(ConditionExpression[]items) { foreach (ConditionExpression item in items) { this.List.Add(item); } }
public PushoverPriorityRule(ConditionExpression condition, Priority priority, Sounds sound, int retryIntervalSeconds, int retryPeriodSeconds) { this.Condition = condition; this.Priority = priority; this.Sound = sound; this.RetryIntervalSeconds = retryIntervalSeconds; this.RetryPeriodSeconds = retryPeriodSeconds; }
/// <summary> /// Adds an instance of type ConditionExpression to the end of this ConditionExpressionCollection. /// </summary> /// <param name="value"> /// The ConditionExpression to be added to the end of this ConditionExpressionCollection. /// </param> public virtual void Add(ConditionExpression value) { this.List.Add(value); }
public ConditionRelationalExpression(ConditionExpression par1, ConditionExpression par2, ConditionRelationalOperator op) { this.par1 = par1; this.par2 = par2; this.op = op; }
/// <summary> /// Creates a new instance of <see cref="ConditionAndExpression"/> and assigns /// its Left and Right properties; /// </summary> /// <param name="left">Left hand side of the AND expression.</param> /// <param name="right">Right hand side of the AND expression.</param> public ConditionAndExpression(ConditionExpression left, ConditionExpression right) { this.Left = left; this.Right = right; }
/// <summary> /// Inserts an element into the ConditionExpressionCollection at the specified index /// </summary> /// <param name="index"> /// The index at which the ConditionExpression is to be inserted. /// </param> /// <param name="value"> /// The ConditionExpression to insert. /// </param> public virtual void Insert(int index, ConditionExpression value) { this.List.Insert(index, value); }
/// <summary> /// Determines whether a specfic ConditionExpression value is in this ConditionExpressionCollection. /// </summary> /// <param name="value"> /// The ConditionExpression value to locate in this ConditionExpressionCollection. /// </param> /// <returns> /// true if value is found in this ConditionExpressionCollection; /// false otherwise. /// </returns> public virtual bool Contains(ConditionExpression value) { return(this.List.Contains(value)); }
/// <summary> /// Initializes a new instance of the ConditionExpressionCollection class, containing elements /// copied from an array. /// </summary> /// <param name="items"> /// The array whose elements are to be added to the new ConditionExpressionCollection. /// </param> public ConditionExpressionCollection(ConditionExpression[]items) { this.AddRange(items); }
/// <summary> /// Initializes a new instance of the <see cref="ConditionRelationalExpression" /> class. /// </summary> /// <param name="leftExpression">The left expression.</param> /// <param name="rightExpression">The right expression.</param> /// <param name="relationalOperator">The relational operator.</param> public ConditionRelationalExpression(ConditionExpression leftExpression, ConditionExpression rightExpression, ConditionRelationalOperator relationalOperator) { LeftExpression = leftExpression; RightExpression = rightExpression; RelationalOperator = relationalOperator; }
public PushoverPriorityRule(ConditionExpression condition, Priority priority) : this(condition, priority, Sounds.Pushover) { }
private ConditionExpression ParseLiteralExpression() { if (this.tokenizer.IsToken(ConditionTokenType.LeftParen)) { this.tokenizer.GetNextToken(); ConditionExpression e = this.ParseExpression(); this.tokenizer.Expect(ConditionTokenType.RightParen); return(e); } if (this.tokenizer.IsToken(ConditionTokenType.Minus)) { this.tokenizer.GetNextToken(); if (!this.tokenizer.IsNumber()) { throw new ConditionParseException("Number expected, got " + this.tokenizer.TokenType); } string numberString = this.tokenizer.TokenValue; this.tokenizer.GetNextToken(); if (numberString.IndexOf('.') >= 0) { return(new ConditionLiteralExpression(-double.Parse(numberString, CultureInfo.InvariantCulture))); } return(new ConditionLiteralExpression(-int.Parse(numberString, CultureInfo.InvariantCulture))); } if (this.tokenizer.IsNumber()) { string numberString = this.tokenizer.TokenValue; this.tokenizer.GetNextToken(); if (numberString.IndexOf('.') >= 0) { return(new ConditionLiteralExpression(double.Parse(numberString, CultureInfo.InvariantCulture))); } return(new ConditionLiteralExpression(int.Parse(numberString, CultureInfo.InvariantCulture))); } if (this.tokenizer.TokenType == ConditionTokenType.String) { ConditionExpression e = new ConditionLayoutExpression(Layout.FromString(this.tokenizer.StringTokenValue, this.configurationItemFactory)); this.tokenizer.GetNextToken(); return(e); } if (this.tokenizer.TokenType == ConditionTokenType.Keyword) { string keyword = this.tokenizer.EatKeyword(); if (0 == string.Compare(keyword, "level", StringComparison.OrdinalIgnoreCase)) { return(new ConditionLevelExpression()); } if (0 == string.Compare(keyword, "logger", StringComparison.OrdinalIgnoreCase)) { return(new ConditionLoggerNameExpression()); } if (0 == string.Compare(keyword, "message", StringComparison.OrdinalIgnoreCase)) { return(new ConditionMessageExpression()); } if (0 == string.Compare(keyword, "loglevel", StringComparison.OrdinalIgnoreCase)) { this.tokenizer.Expect(ConditionTokenType.Dot); return(new ConditionLiteralExpression(LogLevel.FromString(this.tokenizer.EatKeyword()))); } if (0 == string.Compare(keyword, "true", StringComparison.OrdinalIgnoreCase)) { return(new ConditionLiteralExpression(true)); } if (0 == string.Compare(keyword, "false", StringComparison.OrdinalIgnoreCase)) { return(new ConditionLiteralExpression(false)); } if (0 == string.Compare(keyword, "null", StringComparison.OrdinalIgnoreCase)) { return(new ConditionLiteralExpression(null)); } if (this.tokenizer.TokenType == ConditionTokenType.LeftParen) { this.tokenizer.GetNextToken(); ConditionMethodExpression predicateExpression = this.ParsePredicate(keyword); return(predicateExpression); } } throw new ConditionParseException("Unexpected token: " + this.tokenizer.TokenValue); }
public ConditionNotExpression(ConditionExpression expr) { this.expr = expr; }
/// <summary> /// Try stringed keyword to <see cref="ConditionExpression"/> /// </summary> /// <param name="keyword"></param> /// <param name="expression"></param> /// <returns>success?</returns> private bool TryPlainKeywordToExpression(string keyword, out ConditionExpression expression) { if (0 == string.Compare(keyword, "level", StringComparison.OrdinalIgnoreCase)) { { expression = new ConditionLevelExpression(); return(true); } } if (0 == string.Compare(keyword, "logger", StringComparison.OrdinalIgnoreCase)) { { expression = new ConditionLoggerNameExpression(); return(true); } } if (0 == string.Compare(keyword, "message", StringComparison.OrdinalIgnoreCase)) { { expression = new ConditionMessageExpression(); return(true); } } if (0 == string.Compare(keyword, "loglevel", StringComparison.OrdinalIgnoreCase)) { _tokenizer.Expect(ConditionTokenType.Dot); { expression = new ConditionLiteralExpression(LogLevel.FromString(_tokenizer.EatKeyword())); return(true); } } if (0 == string.Compare(keyword, "true", StringComparison.OrdinalIgnoreCase)) { { expression = new ConditionLiteralExpression(ConditionExpression.BoxedTrue); return(true); } } if (0 == string.Compare(keyword, "false", StringComparison.OrdinalIgnoreCase)) { { expression = new ConditionLiteralExpression(ConditionExpression.BoxedFalse); return(true); } } if (0 == string.Compare(keyword, "null", StringComparison.OrdinalIgnoreCase)) { { expression = new ConditionLiteralExpression(null); return(true); } } expression = null; return(false); }
/// <summary> /// Removes the first occurrence of a specific ConditionExpression from this ConditionExpressionCollection. /// </summary> /// <param name="value"> /// The ConditionExpression value to remove from this ConditionExpressionCollection. /// </param> public virtual void Remove(ConditionExpression value) { this.List.Remove(value); }
/// <summary> /// Determines whether a specfic ConditionExpression value is in this ConditionExpressionCollection. /// </summary> /// <param name="value"> /// The ConditionExpression value to locate in this ConditionExpressionCollection. /// </param> /// <returns> /// true if value is found in this ConditionExpressionCollection; /// false otherwise. /// </returns> public virtual bool Contains(ConditionExpression value) { return this.List.Contains(value); }
public PushoverPriorityRule(ConditionExpression condition, Priority priority, Sounds sound) : this(condition, priority, sound, 0, 0) { }
/// <summary> /// Return the zero-based index of the first occurrence of a specific value /// in this ConditionExpressionCollection /// </summary> /// <param name="value"> /// The ConditionExpression value to locate in the ConditionExpressionCollection. /// </param> /// <returns> /// The zero-based index of the first occurrence of the _ELEMENT value if found; /// -1 otherwise. /// </returns> public virtual int IndexOf(ConditionExpression value) { return this.List.IndexOf(value); }
/// <summary> /// Initializes a new instance of the FilteringRule class. /// </summary> /// <param name="whenExistsExpression">Condition to be tested against all events.</param> /// <param name="filterToApply">Filter to apply to all log events when the first condition matches any of them.</param> public FilteringRule(ConditionExpression whenExistsExpression, ConditionExpression filterToApply) { this.Exists = whenExistsExpression; this.Filter = filterToApply; }
/// <summary> /// Initializes a new instance of the <see cref="FilteringTargetWrapper" /> class. /// </summary> /// <param name="wrappedTarget">The wrapped target.</param> /// <param name="condition">The condition.</param> public FilteringTargetWrapper(Target wrappedTarget, ConditionExpression condition) { this.WrappedTarget = wrappedTarget; this.Condition = condition; }
/// <summary> /// Initializes a new instance of the <see cref="FilteringTargetWrapper" /> class. /// </summary> /// <param name="name">Name of the target.</param> /// <param name="wrappedTarget">The wrapped target.</param> /// <param name="condition">The condition.</param> public FilteringTargetWrapper(string name, Target wrappedTarget, ConditionExpression condition) : this(wrappedTarget, condition) { this.Name = name; }
/// <summary> /// Return the zero-based index of the first occurrence of a specific value /// in this ConditionExpressionCollection /// </summary> /// <param name="value"> /// The ConditionExpression value to locate in the ConditionExpressionCollection. /// </param> /// <returns> /// The zero-based index of the first occurrence of the _ELEMENT value if found; /// -1 otherwise. /// </returns> public virtual int IndexOf(ConditionExpression value) { return(this.List.IndexOf(value)); }
/// <summary> /// Initializes a new instance of the <see cref="ConditionRelationalExpression" /> class. /// </summary> /// <param name="leftExpression">The left expression.</param> /// <param name="rightExpression">The right expression.</param> /// <param name="relationalOperator">The relational operator.</param> public ConditionRelationalExpression(ConditionExpression leftExpression, ConditionExpression rightExpression, ConditionRelationalOperator relationalOperator) { this.LeftExpression = leftExpression; this.RightExpression = rightExpression; this.RelationalOperator = relationalOperator; }
/// <summary> /// Initializes a new instance of the <see cref="ConsoleRowHighlightingRule" /> class. /// </summary> /// <param name="condition">The condition.</param> /// <param name="foregroundColor">Color of the foreground.</param> /// <param name="backgroundColor">Color of the background.</param> public ConsoleRowHighlightingRule(ConditionExpression condition, ConsoleOutputColor foregroundColor, ConsoleOutputColor backgroundColor) { this.Condition = condition; this.ForegroundColor = foregroundColor; this.BackgroundColor = backgroundColor; }