public bool Build() { if (string.IsNullOrEmpty(eventName)) { return(false); } if (string.IsNullOrEmpty(appsflyerEventName)) { return(false); } if (string.IsNullOrEmpty(paramName)) { callbackMethod = ProcessEventNameOnly; return(true); } if (string.IsNullOrEmpty(paramValue)) { callbackMethod = ProcessEventNameAndParamName; return(true); } if (string.IsNullOrEmpty(comparisonMethod)) { //paramValue valid but comparisonMethod not valid return(false); } switch (comparisonMethod) { case "=": compareType = eCompareType.Equal; break; case ">": compareType = eCompareType.More; break; case "<": compareType = eCompareType.Less; break; case ">=": compareType = eCompareType.Equal_More; break; case "<=": compareType = eCompareType.Equal_Less; break; case "><": compareType = eCompareType.Inside; break; case "<>": compareType = eCompareType.Outside; break; default: //not support comparison type return(false); } stringValueList = paramValue.Split(';'); if (stringValueList == null || stringValueList.Length == 0) { return(false); } if (compareType != eCompareType.Equal)//should be compare number { intValueList = new int[stringValueList.Length]; for (int i = 0; i < stringValueList.Length; ++i) { int parsedValue; if (int.TryParse(stringValueList[i], out parsedValue)) { intValueList[i] = parsedValue; } else { return(false);//invalid number } } if (compareType == eCompareType.Inside || compareType == eCompareType.Outside) { if (intValueList.Length != 2) { return(false);//invalid data for Inside and Outside check method } if (intValueList[0] > intValueList[1]) { var temp = intValueList[0]; intValueList[0] = intValueList[1]; intValueList[1] = temp; } } } callbackMethod = ProcessEventNameAndParamNameAndValue; return(true); }
public static bool CompareWithoutSleshSensitivity(string string1, string string2, eCompareType compareType) { int counter = 0; while (counter <= 1) { if (counter == 0) { string1 = string1.Replace('\\', '/'); string2 = string2.Replace('\\', '/'); } else { string1 = string1.Replace('/', '\\'); string2 = string2.Replace('/', '\\'); } if (compareType == eCompareType.Equal) { if (string1 == string2) { return(true); } } else { if (string1.Contains(string2)) { return(true); } } counter++; } return(false); }