/// <summary> /// Called when reading XML. /// </summary> /// <param name="reader">The reader.</param> protected override void OnReadXml(XmlReader reader) { string str; base.OnReadXml(reader); if (((str = reader.Name) != null) && (str == "Type")) { this.compareType = (GeneralCompareType)Serializer.DeserializeObj(typeof(GeneralCompareType), reader); } }
/// <summary> /// Called when reading XML. /// </summary> /// <param name="reader">The reader.</param> protected override void OnReadXml(XmlReader reader) { base.OnReadXml(reader); string name = reader.Name; if (name != null) { if (name != "Type") { if (name != "TreatNullValueAsZero") { return; } } else { this.compareType = (GeneralCompareType)Serializer.DeserializeObj(typeof(GeneralCompareType), reader); return; } this.treatNullValueAsZero = (bool)((bool)Serializer.DeserializeObj(typeof(bool), reader)); } }
/// <summary> /// Creates a new number condition with the specified type for the specified cell range. /// </summary> /// <param name="compareType">Type of the compare</param> /// <param name="expected">The expected value</param> /// <param name="formula">The expected formula</param> internal CellValueCondition(GeneralCompareType compareType, object expected, string formula) : base(expected, formula) { this.compareType = compareType; }
/// <summary> /// Creates a new number condition of the specified type with the specified expected value. /// </summary> /// <param name="compareType">The number comparison type.</param> /// <param name="expected">The expected number.</param> /// <param name="formula">The expected formula.</param> internal TextLengthCondition(GeneralCompareType compareType, object expected, string formula) : base(expected, formula) { this.compareType = compareType; }
/// <summary> /// Resets this instance. /// </summary> protected override void Reset() { base.Reset(); this.compareType = GeneralCompareType.EqualsTo; }
/// <summary> /// Creates a TextLengthCondition object from the formula. /// </summary> /// <param name="compareType">The compare type.</param> /// <param name="formula">The formula.</param> /// <returns>The TextLengthCondition object.</returns> public static TextLengthCondition FromFormula(GeneralCompareType compareType, string formula) { return(new TextLengthCondition(compareType, (int)0, formula)); }
/// <summary> /// Creates a TextLengthCondition object from an integer value. /// </summary> /// <param name="compareType">The comparison type.</param> /// <param name="expected">The expected value.</param> /// <returns>The TextLengthCondition object.</returns> public static TextLengthCondition FromInt(GeneralCompareType compareType, int expected) { return(new TextLengthCondition(compareType, (int)expected, null)); }
/// <summary> /// Resets this instance. /// </summary> protected override void Reset() { base.Reset(); this.compareType = GeneralCompareType.EqualsTo; this.integerValue = false; }
/// <summary> /// Creates a number condition from an integer value. /// </summary> /// <param name="compareType">The compare type.</param> /// <param name="expected">The expected value.</param> /// <returns>The NumberCondition object.</returns> public static NumberCondition FromInt(GeneralCompareType compareType, int expected) { return(new NumberCondition(compareType, (int)expected, null)); }
/// <summary> /// Creates a number condition from a formula. /// </summary> /// <param name="compareType">The compare type.</param> /// <param name="formula">The formula.</param> /// <returns>The NumberCondition object.</returns> public static NumberCondition FromFormula(GeneralCompareType compareType, string formula) { return(new NumberCondition(compareType, (int)0, formula)); }
/// <summary> /// Creates a number condition from a double value. /// </summary> /// <param name="compareType">The compare type.</param> /// <param name="expected">The expected value.</param> /// <returns>The NumberCondition object.</returns> public static NumberCondition FromDouble(GeneralCompareType compareType, double expected) { return(new NumberCondition(compareType, (double)expected, null)); }
/// <summary> /// Creates a new condition format with the specified string expression. /// </summary> /// <param name="token">The string expression for this format.</param> /// <remarks>Examples of conditional string expressions are "[>10]" and "[>=0]".</remarks> public ConditionFormatPart(string token) : base(token) { string str = DefaultTokens.TrimSquareBracket(token); if (string.IsNullOrEmpty(str)) { throw new ArgumentException(ResourceStrings.FormatterIllegaTokenError); } StringBuilder builder = null; int num = 0; while (num < str.Length) { char c = str[num]; if (!DefaultTokens.IsOperator(c)) { break; } if (builder == null) { builder = new StringBuilder(); } builder.Append(c); num++; } if (builder == null) { throw new ArgumentException(ResourceStrings.FormatterIllegaTokenError); } string str2 = builder.ToString(); builder = null; switch (str2) { case "<": this.compareOperator = GeneralCompareType.LessThan; break; case "<=": this.compareOperator = GeneralCompareType.LessThanOrEqualsTo; break; case "=": this.compareOperator = GeneralCompareType.EqualsTo; break; case ">=": this.compareOperator = GeneralCompareType.GreaterThanOrEqualsTo; break; case ">": this.compareOperator = GeneralCompareType.GreaterThan; break; case "<>": this.compareOperator = GeneralCompareType.NotEqualsTo; break; default: throw new ArgumentException(ResourceStrings.FormatterIllegaTokenError); } while (num < str.Length) { char ch2 = str[num]; if (DefaultTokens.IsOperator(ch2)) { throw new ArgumentException(ResourceStrings.FormatterIllegaTokenError); } if (builder == null) { builder = new StringBuilder(); } builder.Append(ch2); num++; } if (builder == null) { throw new ArgumentException(ResourceStrings.FormatterIllegaTokenError); } if (!double.TryParse(builder.ToString(), out this.value)) { throw new ArgumentException(ResourceStrings.FormatterIllegaTokenError); } }