MCPcopy Create free account
hub / github.com/Tencent/xLua / FindType

Method FindType

Assets/XLua/Src/ObjectTranslator.cs:718–751  ·  view source on GitHub ↗
(string className, bool isQualifiedName = false)

Source from the content-addressed store, hash-verified

716 }
717
718 internal Type FindType(string className, bool isQualifiedName = false)
719 {
720 foreach (Assembly assembly in assemblies)
721 {
722 Type klass = assembly.GetType(className);
723
724 if (klass!=null)
725 {
726 return klass;
727 }
728 }
729 int p1 = className.IndexOf('[');
730 if (p1 > 0 && !isQualifiedName)
731 {
732 string qualified_name = className.Substring(0, p1 + 1);
733 string[] generic_params = className.Substring(p1 + 1, className.Length - qualified_name.Length - 1).Split(',');
734 for(int i = 0; i < generic_params.Length; i++)
735 {
736 Type generic_param = FindType(generic_params[i].Trim());
737 if (generic_param == null)
738 {
739 return null;
740 }
741 if (i != 0 )
742 {
743 qualified_name += ", ";
744 }
745 qualified_name = qualified_name + "[" + generic_param.AssemblyQualifiedName + "]";
746 }
747 qualified_name += "]";
748 return FindType(qualified_name, true);
749 }
750 return null;
751 }
752
753 bool hasMethod(Type type, string methodName)
754 {

Callers 3

ImportTypeFunction · 0.80
ImportGenericTypeFunction · 0.80
getTypeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected