public bool GetBool(CsvVLine line) { if (!line.HasHeader(Key)) { throw new Exception(string.Format("The key: {0} is not a legal header", Key)); } return(false); }
public bool GetBool(CsvVLine line) { if (!line.HasHeader(Key)) { throw new Exception(string.Format("The key: {0} is not a legal header", Key)); } var v1 = line.GetValue(Key); var v2 = Value; switch (Operator) { case TernaryOperator.Equal: return(string.Compare(v1, v2) == 0); case TernaryOperator.NotEqual: return(string.Compare(v1, v2) != 0); case TernaryOperator.Greater: return(string.Compare(v1, v2) > 0); case TernaryOperator.Less: return(string.Compare(v1, v2) < 0); case TernaryOperator.GreaterOrEqual: return(string.Compare(v1, v2) >= 0); case TernaryOperator.LessOrEqual: return(string.Compare(v1, v2) <= 0); case TernaryOperator.Has: return(new Regex(v2).IsMatch(v1)); case TernaryOperator.Hasnot: return(!new Regex(v2).IsMatch(v1)); default: throw new Exception("Unsupported ternary operator"); } }