void Add(string @namespace, string typeName, string baseTypeNamespace, string baseType, string methodName) { if (_items.ContainsKey(@namespace)) { if (_items[@namespace].ContainsKey(typeName)) { if (methodName != null) { _items[@namespace][typeName].Add(methodName); } } else { CoreSupportedMethodTypeItem item = new CoreSupportedMethodTypeItem(typeName, baseType, @namespace, baseTypeNamespace); if (methodName != null) { item.Add(methodName); } _items[@namespace].Add(typeName, item); } } else { Dictionary <string, CoreSupportedMethodTypeItem> methods = new Dictionary <string, CoreSupportedMethodTypeItem>(); CoreSupportedMethodTypeItem item = new CoreSupportedMethodTypeItem(typeName, baseType, @namespace, baseTypeNamespace); if (methodName != null) { item.Add(methodName); } methods.Add(typeName, item); _items.Add(@namespace, methods); } }
private bool CheckIfMethodIsSupportedWithoutKnowingNamespace(string typeName, string methodName) { foreach (Dictionary <string, CoreSupportedMethodTypeItem> @namespace in _items.Values) { if (@namespace.ContainsKey(typeName)) { string baseTypeName = typeName; string namespaceName = @namespace[typeName]._namespace; while (baseTypeName != null) { if (_items[namespaceName].ContainsKey(baseTypeName)) { CoreSupportedMethodTypeItem item = _items[namespaceName][baseTypeName]; if (item.Contains(methodName)) { return(true); } else { baseTypeName = item._baseTypeName; namespaceName = item._baseTypeNamespace; } } else { return(false); } } } } return(false); }
public bool Contains(string @namespace, string typeName, string methodName) { if (string.IsNullOrEmpty(methodName)) { return(ContainsType(typeName, @namespace)); } else { if (string.IsNullOrEmpty(@namespace)) { return(CheckIfMethodIsSupportedWithoutKnowingNamespace(typeName, methodName)); } else { string fixedNamespace = ResolveNamespaceName(@namespace, typeName); string baseTypeName = typeName; string baseTypeNamespace = fixedNamespace; while (baseTypeName != null) { if (_items.ContainsKey(baseTypeNamespace)) { if (_items[baseTypeNamespace].ContainsKey(baseTypeName)) { CoreSupportedMethodTypeItem item = _items[baseTypeNamespace][baseTypeName]; if (item.Contains(methodName)) { return(true); } else { baseTypeName = item._baseTypeName; baseTypeNamespace = item._baseTypeNamespace; } } else { return(false); } } else { return(false); } } return(false); } } }
public bool Contains(string methodFullName) { //the methodFullName is Type.Method for now int dotIndex = methodFullName.LastIndexOf('.'); string fullTypeName = methodFullName.Substring(0, dotIndex); string methodName = methodFullName.Substring(dotIndex + 1); dotIndex = fullTypeName.LastIndexOf('.'); string typeName = fullTypeName.Substring(dotIndex + 1); string @namespace = fullTypeName.Substring(0, dotIndex); if (String.IsNullOrEmpty(@namespace)) { return(CheckIfMethodIsSupportedWithoutKnowingNamespace(typeName, methodName)); } else { while (typeName != null) { if (_items.ContainsKey(@namespace)) { if (_items.ContainsKey(typeName)) { CoreSupportedMethodTypeItem item = _items[@namespace][typeName]; if (item.Contains(methodName)) { return(true); } else { typeName = item._baseTypeName; @namespace = item._baseTypeNamespace; } } else { return(false); } } else { return(false); } } return(false); } }