Esempio n. 1
0
        public static string GetTypeName(Type t)
        {
            if (t.get_IsArray())
            {
                t = t.GetElementType();
                string typeName = LuaMisc.GetTypeName(t);
                return(typeName + "[]");
            }
            if (t.get_IsByRef())
            {
                t = t.GetElementType();
                return(LuaMisc.GetTypeName(t));
            }
            if (t.get_IsGenericType())
            {
                return(LuaMisc.GetGenericName(t));
            }
            if (t == typeof(void))
            {
                return("void");
            }
            string primitiveStr = LuaMisc.GetPrimitiveStr(t);

            return(primitiveStr.Replace('+', '.'));
        }
Esempio n. 2
0
 public static string[] GetGenericName(Type[] types, int offset, int count)
 {
     string[] array = new string[count];
     for (int i = 0; i < count; i++)
     {
         int num = i + offset;
         if (types[num].get_IsGenericType())
         {
             array[i] = LuaMisc.GetGenericName(types[num]);
         }
         else
         {
             array[i] = LuaMisc.GetTypeName(types[num]);
         }
     }
     return(array);
 }
Esempio n. 3
0
        private static string GetGenericName(Type t)
        {
            Type[] genericArguments = t.GetGenericArguments();
            string text             = t.FullName;
            int    num = genericArguments.Length;
            int    i   = text.IndexOf("[");

            if (i > 0)
            {
                text = text.Substring(0, i);
            }
            string space = null;
            int    num2  = 0;
            string text2;

            for (i = text.IndexOf("+"); i > 0; i = text.IndexOf("+"))
            {
                text2 = text.Substring(0, i);
                text  = text.Substring(i + 1);
                i     = text2.IndexOf('`');
                if (i > 0)
                {
                    num   = (int)(text2[i + 1] - '0');
                    text2 = text2.Substring(0, i);
                    text2 = text2 + "<" + string.Join(",", LuaMisc.GetGenericName(genericArguments, num2, num)) + ">";
                    num2 += num;
                }
                space = LuaMisc.CombineTypeStr(space, text2);
            }
            text2 = text;
            if (num2 < genericArguments.Length)
            {
                i     = text2.IndexOf('`');
                num   = (int)(text2[i + 1] - '0');
                text2 = text2.Substring(0, i);
                text2 = text2 + "<" + string.Join(",", LuaMisc.GetGenericName(genericArguments, num2, num)) + ">";
            }
            return(LuaMisc.CombineTypeStr(space, text2));
        }