public static bool IsValidCall(object insOperand, ICallRules callRules) { string operandMethodName = string.Empty; string declaringTypeName = string.Empty; KeyValuePair<string, string> operandMethodAndDeclaringType = callRules.DetermineOperandAndDeclaringType(insOperand); operandMethodName = operandMethodAndDeclaringType.Key; declaringTypeName = operandMethodAndDeclaringType.Value; // must not be true if (operandMethodName.Length == 0 || declaringTypeName.Length == 0) { return false; } // check if the method we are calling is valid if (!IsValidMethod(operandMethodName)) { return false; } // now check in ignored classes var query = from ignoredType in Settings.IgnoredTypeList() where declaringTypeName.StartsWith(ignoredType, StringComparison.OrdinalIgnoreCase) select ignoredType; return query.Count() == 0; }
/// <summary> /// Check if the callee method and declaring type is valid /// </summary> /// <param name="insOperand"></param> /// <param name="typeName"></param> /// <returns></returns> public static bool IsValidCall(object insOperand, string typeName, ICallRules callRules) { if (!IsValidType(typeName)) { return false; } return IsValidCall(insOperand, callRules); }