/// <summary> /// try to call the static method marked with <see cref="CreateLoadInstance"/> /// return the instance if the methid was there, null otherwise /// </summary> /// <param name="typeString"></param> /// <param name="parent"></param> /// <returns></returns> private static object TryCallCreateLoadInstance(string typeString, object parent) { if (provider?.IsTypeStringValid(typeString) == true) { ICreatable creatableNode = provider.CreateFromTypeString(typeString); if (creatableNode == null) { #if LOGGER Logger.WriteLine("coudln't create CreatableNode python object"); #endif return(null); } if (creatableNode.HasCreateLoadInstance()) { return(creatableNode.CreateInstanceWithCreateLoadInstance(parent, typeString)); } else { return(null); } } else { Type type = Type.GetType(typeString); if (type != null) { return(TryCallCreateLoadInstance(type, parent)); } else { #if LOGGER Logger.WriteLine("couldn't create type from string:" + typeString); #endif return(null); } } }