Class encapsulates the parameters of a RightScale API filter and overrides the ToString() method to build a formatted string filter
示例#1
0
 /// <summary>
 /// Private method handles parsing filter from string based on inputs
 /// </summary>
 /// <param name="filterString">full filter string</param>
 /// <param name="workingString">working string pared down from filter string</param>
 /// <param name="opVal">operator value - equals or not equals</param>
 /// <returns></returns>
 private static Filter parseFilterFromString(string workingString, FilterOperator filterOp)
 {
     Filter retVal = null;
     string opVal = getOpSign(filterOp);
     workingString = workingString.Replace(opVal, "Þ");
     string[] filterTestSplit = workingString.Split('Þ');
     if (filterTestSplit.Length == 2)
     {
         retVal = new Filter(filterTestSplit[0], filterOp, filterTestSplit[1]);
     }
     else if (filterTestSplit.Length > 2)
     {
         throw new ArgumentException("Cannot parse filter'" + workingString + "'. There are too many " + opVal + " symbols");
     }
     return retVal;
 }