GetTypeStr() public static method

public static GetTypeStr ( Type t ) : string
t Type
return string
    static string GetTypeStr(Type type)
    {
        Type trueType = GetType(type);

        if (trueType == typeof(void))
        {
            return("void");
        }
        else
        {
            return(ToLuaExport.GetTypeStr(trueType));
        }
    }
Beispiel #2
0
		public DelegateType(Type t)
		{
			this.type = t;
			this.strType = ToLuaExport.GetTypeStr(t);
			if (t.get_IsGenericType())
			{
				this.name = ToLuaExport.GetGenericLibName(t);
			}
			else
			{
				this.name = ToLuaExport.GetTypeStr(t);
				this.name = this.name.Replace(".", "_");
			}
		}
Beispiel #3
0
        private static string[] GetGenericName(Type[] types)
        {
            string[] results = new string[types.Length];

            for (int i = 0; i < types.Length; i++)
            {
                if (types[i].IsGenericType)
                {
                    results[i] = GetGenericName(types[i]);
                }
                else
                {
                    results[i] = ToLuaExport.GetTypeStr(types[i]);
                }
            }

            return(results);
        }
Beispiel #4
0
    static string GetNameSpace(Type t, out string libName)
    {
        if (t.IsGenericType)
        {
            string space = t.Namespace;

            if (t.FullName.Contains("+"))
            {
                space = ToLuaExport.GetTypeStr(t);
                int len = t.Namespace == null ? 0 : t.Namespace.Length;
                space = space.Remove(0, len);
                space = RemoveTemplateSign(space);
                int index = space.LastIndexOf('.');
                libName = space.Substring(index + 1);
                space   = space.Substring(0, index);
                space   = t.Namespace + space;
            }
            else
            {
                libName = ToLuaExport.GetTypeStr(t);
                libName = space == null ? libName : libName.Substring(space.Length + 1);
                libName = RemoveTemplateSign(libName);
            }

            return(space);
        }
        else
        {
            string space = t.FullName;

            if (space.Contains("+"))
            {
                space = space.Replace('+', '.');
                int index = space.LastIndexOf('.');
                libName = space.Substring(index + 1);
                return(space.Substring(0, index));
            }
            else
            {
                libName = t.Namespace == null ? space : space.Substring(t.Namespace.Length + 1);
                return(t.Namespace);
            }
        }
    }
Beispiel #5
0
        public BindType(Type t)
        {
            type = t;

            name = ToLuaExport.GetTypeStr(t);

            if (t.IsGenericType)
            {
                libName  = ToLuaExport.GetGenericLibName(t);
                wrapName = ToLuaExport.GetGenericLibName(t);
            }
            else
            {
                libName  = t.FullName.Replace("+", ".");
                wrapName = name.Replace('.', '_');

                if (name == "object")
                {
                    wrapName = "System_Object";
                }
            }

            if (t.BaseType != null)
            {
                baseName = ToLuaExport.GetTypeStr(t.BaseType);

                if (baseName == "ValueType")
                {
                    baseName = null;
                }
            }

            if (t.GetConstructor(Type.EmptyTypes) == null && t.IsAbstract && t.IsSealed)
            {
                baseName = null;
                IsStatic = true;
            }
        }
 public DelegateType(Type t)
 {
     type    = t;
     strType = ToLuaExport.GetTypeStr(t);
     name    = ToLuaExport.ConvertToLibSign(strType);
 }