Ejemplo n.º 1
0
        internal static string GetEnumNamesOfField(string className, string fieldName)
        {
            string typeName = Managed.GetFieldOfClass(className, fieldName).FieldType.FullName;
            string str      = typeName.Substring(0, typeName.IndexOf('.'));

            if (str != null && str != "" && str != Assembly.GetExecutingAssembly().GetName().Name)
            {
                typeName = typeName + ", " + str;
            }
            Type type = Type.GetType(typeName);

            if (type == (Type)null)
            {
                int    startIndex = typeName.IndexOf(',');
                string name       = typeName.Remove(startIndex);
                foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    type = assembly.GetType(name);
                    if (type != (Type)null)
                    {
                        break;
                    }
                }
            }
            type.GetEnumValues();
            return(string.Join(" ", type.GetEnumNames()));
        }
Ejemplo n.º 2
0
        internal static bool IsFieldClass(string className, string fieldName)
        {
            Type fieldType = Managed.GetFieldOfClass(className, fieldName).FieldType;

            if (fieldType.IsClass)
            {
                return(true);
            }
            return(fieldType.IsValueType && !fieldType.IsPrimitive);
        }
Ejemplo n.º 3
0
        internal static int GetClassFieldSize(string className, string fieldName)
        {
            Type fieldType = Managed.GetFieldOfClass(className, fieldName).FieldType;
            int  num       = -1;

            if (fieldType == typeof(byte))
            {
                num = 1;
            }
            else if (fieldType == typeof(sbyte))
            {
                num = 1;
            }
            else if (fieldType == typeof(short))
            {
                num = 2;
            }
            else if (fieldType == typeof(ushort))
            {
                num = 2;
            }
            else if (fieldType == typeof(int))
            {
                num = 4;
            }
            else if (fieldType == typeof(uint))
            {
                num = 4;
            }
            else if (fieldType == typeof(long))
            {
                num = 8;
            }
            else if (fieldType == typeof(ulong))
            {
                num = 8;
            }
            else if (fieldType == typeof(float))
            {
                num = 4;
            }
            else if (fieldType == typeof(double))
            {
                num = 4;
            }
            else if (fieldType == typeof(long))
            {
                num = 4;
            }
            else if (fieldType == typeof(bool))
            {
                num = 1;
            }
            return(num);
        }
Ejemplo n.º 4
0
 internal static bool IsFieldEnum(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName).FieldType.IsEnum;
Ejemplo n.º 5
0
 internal static bool IsFieldBoolean(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName).FieldType == typeof(bool);
Ejemplo n.º 6
0
        internal static bool IsFieldFloatingPoint(string className, string fieldName)
        {
            FieldInfo fieldOfClass = Managed.GetFieldOfClass(className, fieldName);

            return(fieldOfClass.FieldType == typeof(float) || fieldOfClass.FieldType == typeof(double));
        }
Ejemplo n.º 7
0
 internal static string GetFieldClassName(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName).FieldType.Name;
Ejemplo n.º 8
0
        internal static bool IsFieldUnsigned(string className, string fieldName)
        {
            Type fieldType = Managed.GetFieldOfClass(className, fieldName).FieldType;

            return(fieldType == typeof(byte) || fieldType == typeof(ushort) || fieldType == typeof(uint) || fieldType == typeof(ulong));
        }
Ejemplo n.º 9
0
        internal static bool IsFieldFixedPoint(string className, string fieldName)
        {
            Type fieldType = Managed.GetFieldOfClass(className, fieldName).FieldType;

            return(fieldType == typeof(byte) || fieldType == typeof(sbyte) || (fieldType == typeof(short) || fieldType == typeof(ushort)) || (fieldType == typeof(int) || fieldType == typeof(uint) || fieldType == typeof(long)) || fieldType == typeof(ulong));
        }
Ejemplo n.º 10
0
 internal static bool IsClassFieldExists(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName) != (FieldInfo)null;