예제 #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()));
        }
예제 #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);
        }
예제 #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);
        }
예제 #4
0
 internal static bool IsFieldEnum(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName).FieldType.IsEnum;
예제 #5
0
 internal static bool IsFieldBoolean(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName).FieldType == typeof(bool);
예제 #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));
        }
예제 #7
0
 internal static string GetFieldClassName(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName).FieldType.Name;
예제 #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));
        }
예제 #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));
        }
예제 #10
0
 internal static bool IsClassFieldExists(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName) != (FieldInfo)null;