Exemple #1
0
        static bool HasCustomAttributes(System.Type type, System.Type customAtt)
        {
            if (type == null)
            {
                return(false);
            }

            bool has = type.GetCustomAttributes(customAtt, true).Length == 0 ? false : true;

#if USE_HOT
            if (has)
            {
                return(true);
            }

            ILRuntimeType rt = type as ILRuntimeType;
            if (rt == null)
            {
                return(false);
            }

            try
            {
                return(HasCustomAttributes(type.BaseType, customAtt));
            }
            catch (System.Exception ex)
            {
                wxb.L.LogException(ex);
                return(false);
            }
#else
            return(has);
#endif
        }
Exemple #2
0
Fichier : Help.cs Projet : qq21/XIL
 public static System.Collections.IList CreateArray(System.Type elementType, int arrayCount, int count)
 {
     if (arrayCount == 1)
     {
         ILRuntimeType ilrt = elementType as ILRuntimeType;
         if (elementType.IsEnum)
         {
             int[] list = new int[count];
             return(list);
         }
         else
         {
             ILTypeInstance[] list = new ILTypeInstance[count];
             for (int i = 0; i < count; ++i)
             {
                 list[i] = new ILTypeInstance(ilrt.ILType);
             }
             return(list);
         }
     }
     else
     {
         return(CreateArray(arrayCount, count));
     }
 }
Exemple #3
0
Fichier : Help.cs Projet : qq21/XIL
 public static System.Collections.IList CreateIList(System.Type elementType, int arrayCount, int count)
 {
     if (arrayCount == 1)
     {
         ILRuntimeType ilrt = elementType as ILRuntimeType;
         if (elementType.IsEnum)
         {
             List <int> list = new List <int>(count);
             for (int i = 0; i < count; ++i)
             {
                 list.Add(0);
             }
             return(list);
         }
         else
         {
             List <ILTypeInstance> list = new List <ILTypeInstance>(count);
             for (int i = 0; i < count; ++i)
             {
                 list.Add(new ILTypeInstance(ilrt.ILType));
             }
             return(list);
         }
     }
     else
     {
         return(CreateIList(arrayCount, count));
     }
 }
Exemple #4
0
Fichier : Help.cs Projet : qq21/XIL
        public static string GetTypeFullName(System.Type type)
        {
#if USE_HOT
            if (type.GetType() == typeof(ILRuntimeType))
            {
                ILRuntimeType ilrt = type as ILRuntimeType;
                if (ilrt.ILType.TypeReference.IsNested)
                {
                    return(type.FullName.Replace('/', '+'));
                }
            }
#endif
            return(type.FullName);
        }