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())); }
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); }
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); }
internal static bool IsFieldEnum(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName).FieldType.IsEnum;
internal static bool IsFieldBoolean(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName).FieldType == typeof(bool);
internal static bool IsFieldFloatingPoint(string className, string fieldName) { FieldInfo fieldOfClass = Managed.GetFieldOfClass(className, fieldName); return(fieldOfClass.FieldType == typeof(float) || fieldOfClass.FieldType == typeof(double)); }
internal static string GetFieldClassName(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName).FieldType.Name;
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)); }
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)); }
internal static bool IsClassFieldExists(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName) != (FieldInfo)null;