/// <summary>
        /// Gets the type of an array
        /// </summary>
        /// <param name="game">What game we are looking info for</param>
        /// <param name="propName">Name of the array property</param>
        /// <param name="className">Name of the class that should contain the information. If contained in a struct, this will be the name of the struct type</param>
        /// <param name="parsingEntry">Entry that is being parsed. Used for dynamic lookup if it's not in the DB</param>
        /// <returns></returns>
        public static ArrayType GetArrayType(Mod.MEGame game, string propName, string className, IEntry parsingEntry = null)
        {
            switch (game)
            {
            case Mod.MEGame.ME1:
                return(ME1UnrealObjectInfo.getArrayType(className, propName, export: parsingEntry as ExportEntry));

            case Mod.MEGame.ME2:
                var res2 = ME2UnrealObjectInfo.getArrayType(className, propName, export: parsingEntry as ExportEntry);
#if DEBUG
                //For debugging only!
                if (res2 == ArrayType.Int && ME2UnrealObjectInfo.ArrayTypeLookupJustFailed)
                {
                    ME2UnrealObjectInfo.ArrayTypeLookupJustFailed = false;
                    Debug.WriteLine("[ME2] Array type lookup failed for " + propName + " in class " + className + " in export " + parsingEntry.FileRef.GetEntryString(parsingEntry.UIndex));
                }
#endif
                return(res2);

            case Mod.MEGame.ME3:
                var res = ME3UnrealObjectInfo.getArrayType(className, propName, export: parsingEntry as ExportEntry);
#if DEBUG
                //For debugging only!
                if (res == ArrayType.Int && ME3UnrealObjectInfo.ArrayTypeLookupJustFailed)
                {
                    Debug.WriteLine("[ME3] Array type lookup failed for " + propName + " in class " + className + " in export " + parsingEntry.FileRef.GetEntryString(parsingEntry.UIndex));
                    ME3UnrealObjectInfo.ArrayTypeLookupJustFailed = false;
                }
#endif
                return(res);
            }
            return(ArrayType.Int);
        }
        /// <summary>
        /// Gets property information for a property by name & containing class or struct name
        /// </summary>
        /// <param name="game">Game to lookup informatino from</param>
        /// <param name="propname">Name of property information to look up</param>
        /// <param name="containingClassOrStructName">Name of containing class or struct name</param>
        /// <param name="nonVanillaClassInfo">Dynamically built property info</param>
        /// <returns></returns>
        public static PropertyInfo GetPropertyInfo(MEGame game, string propname, string containingClassOrStructName, ClassInfo nonVanillaClassInfo = null)
        {
            bool         inStruct = false;
            PropertyInfo p        = null;

            switch (game)
            {
            case MEGame.ME1:
                p = ME1UnrealObjectInfo.getPropertyInfo(containingClassOrStructName, propname, inStruct, nonVanillaClassInfo);
                break;

            case MEGame.ME2:
                p = ME2UnrealObjectInfo.getPropertyInfo(containingClassOrStructName, propname, inStruct, nonVanillaClassInfo);
                break;

            case MEGame.ME3:
            case MEGame.UDK:
                p = ME3UnrealObjectInfo.getPropertyInfo(containingClassOrStructName, propname, inStruct, nonVanillaClassInfo);
                if (p == null && game == MEGame.UDK)
                {
                    p = UDKUnrealObjectInfo.getPropertyInfo(containingClassOrStructName, propname, inStruct, nonVanillaClassInfo);
                }
                break;
            }
            if (p == null)
            {
                inStruct = true;
                switch (game)
                {
                case MEGame.ME1:
                    p = ME1UnrealObjectInfo.getPropertyInfo(containingClassOrStructName, propname, inStruct);
                    break;

                case MEGame.ME2:
                    p = ME2UnrealObjectInfo.getPropertyInfo(containingClassOrStructName, propname, inStruct);
                    break;

                case MEGame.ME3:
                    p = ME3UnrealObjectInfo.getPropertyInfo(containingClassOrStructName, propname, inStruct);
                    break;

                case MEGame.UDK:
                    p = ME3UnrealObjectInfo.getPropertyInfo(containingClassOrStructName, propname, inStruct);
                    if (p == null && game == MEGame.UDK)
                    {
                        p = UDKUnrealObjectInfo.getPropertyInfo(containingClassOrStructName, propname, inStruct, nonVanillaClassInfo);
                    }
                    break;
                }
            }
            return(p);
        }
        public static ArrayType GetArrayType(MEGame game, string propName, string typeName)
        {
            switch (game)
            {
            case MEGame.ME1:
                return(ME1UnrealObjectInfo.getArrayType(typeName, propName));

            case MEGame.ME2:
                return(ME2UnrealObjectInfo.getArrayType(typeName, propName));

            case MEGame.ME3:
                return(ME3UnrealObjectInfo.getArrayType(typeName, propName));
            }
            return(ArrayType.Int);
        }
        public static string GetEnumType(MEGame game, string propName, string typeName)
        {
            switch (game)
            {
            case MEGame.ME1:
                return(ME1UnrealObjectInfo.getEnumTypefromProp(typeName, propName));

            case MEGame.ME2:
                return(ME2UnrealObjectInfo.getEnumTypefromProp(typeName, propName));

            case MEGame.ME3:
                return(ME3UnrealObjectInfo.getEnumTypefromProp(typeName, propName));
            }
            return(null);
        }
        public static List <NameReference> GetEnumValues(Mod.MEGame game, string enumName, bool includeNone = false)
        {
            switch (game)
            {
            case Mod.MEGame.ME1:
                return(ME1UnrealObjectInfo.getEnumValues(enumName, includeNone));

            case Mod.MEGame.ME2:
                return(ME2UnrealObjectInfo.getEnumValues(enumName, includeNone));

            case Mod.MEGame.ME3:
                return(ME3UnrealObjectInfo.getEnumValues(enumName, includeNone));
            }
            return(null);
        }
        /// <summary>
        /// Gets the default values for a struct
        /// </summary>
        /// <param name="game">Game to pull info from</param>
        /// <param name="typeName">Struct type name</param>
        /// <param name="stripTransients">Strip transients from the struct</param>
        /// <returns></returns>
        internal static PropertyCollection getDefaultStructValue(Mod.MEGame game, string typeName, bool stripTransients)
        {
            switch (game)
            {
            case Mod.MEGame.ME1:
                return(ME1UnrealObjectInfo.getDefaultStructValue(typeName, stripTransients));

            case Mod.MEGame.ME2:
                return(ME2UnrealObjectInfo.getDefaultStructValue(typeName, stripTransients));

            case Mod.MEGame.ME3:
                return(ME3UnrealObjectInfo.getDefaultStructValue(typeName, stripTransients));
            }
            return(null);
        }
 public static bool inheritsFrom(this IExportEntry entry, string baseClass)
 {
     if (entry.FileRef.Game == MEGame.ME1)
     {
         return(ME1UnrealObjectInfo.inheritsFrom(entry as ME1ExportEntry, baseClass));
     }
     else if (entry.FileRef.Game == MEGame.ME2)
     {
         return(ME2UnrealObjectInfo.inheritsFrom(entry as ME2ExportEntry, baseClass));
     }
     else if (entry.FileRef.Game == MEGame.ME3)
     {
         return(ME3UnrealObjectInfo.inheritsFrom(entry as ME3ExportEntry, baseClass));
     }
     return(false);
 }
        public static string GetEnumType(Mod.MEGame game, string propName, string typeName, ClassInfo nonVanillaClassInfo = null)
        {
            switch (game)
            {
            case Mod.MEGame.ME1:
                return(ME1UnrealObjectInfo.getEnumTypefromProp(typeName, propName, nonVanillaClassInfo: nonVanillaClassInfo));

            case Mod.MEGame.ME2:
                return(ME2UnrealObjectInfo.getEnumTypefromProp(typeName, propName, nonVanillaClassInfo: nonVanillaClassInfo));

            case Mod.MEGame.ME3:
                var enumType = ME3UnrealObjectInfo.getEnumTypefromProp(typeName, propName);
                return(enumType);
            }
            return(null);
        }
        public static UProperty getDefaultProperty(Mod.MEGame game, string propName, PropertyInfo propInfo, bool stripTransients = true, bool isImmutable = false)
        {
            switch (game)
            {
            case Mod.MEGame.ME1:
                return(ME1UnrealObjectInfo.getDefaultProperty(propName, propInfo, stripTransients, isImmutable));

            case Mod.MEGame.ME2:
                return(ME2UnrealObjectInfo.getDefaultProperty(propName, propInfo, stripTransients, isImmutable));

            case Mod.MEGame.ME3:
                return(ME3UnrealObjectInfo.getDefaultProperty(propName, propInfo, stripTransients, isImmutable));
            }

            return(null);
        }
        public static ClassInfo generateClassInfo(ExportEntry export, bool isStruct = false)
        {
            switch (export.FileRef.Game)
            {
            case Mod.MEGame.ME1:
                return(ME1UnrealObjectInfo.generateClassInfo(export, isStruct));

            case Mod.MEGame.ME2:
                return(ME2UnrealObjectInfo.generateClassInfo(export, isStruct));

            case Mod.MEGame.ME3:
                return(ME3UnrealObjectInfo.generateClassInfo(export, isStruct));
            }

            return(null);
        }
Example #11
0
        public static bool InheritsFrom(this IEntry entry, string baseClass)
        {
            switch (entry.FileRef.Game)
            {
            case Mod.MEGame.ME1:
                return(ME1UnrealObjectInfo.InheritsFrom(entry.ClassName, baseClass));

            case Mod.MEGame.ME2:
                return(ME2UnrealObjectInfo.InheritsFrom(entry.ClassName, baseClass));

            case Mod.MEGame.ME3:
                return(ME3UnrealObjectInfo.InheritsFrom(entry.ClassName, baseClass));

            default:
                return(false);
            }
        }
Example #12
0
        public static bool IsImmutable(string structType, Mod.MEGame game)
        {
            switch (game)
            {
            case Mod.MEGame.ME1:
                return(ME1UnrealObjectInfo.IsImmutableStruct(structType));

            case Mod.MEGame.ME2:
                return(ME2UnrealObjectInfo.IsImmutableStruct(structType));

            case Mod.MEGame.ME3:
                return(ME3UnrealObjectInfo.IsImmutableStruct(structType));

            default:
                return(false);
            }
        }
        public static bool inheritsFrom(this IEntry entry, string baseClass)
        {
            switch (entry.FileRef.Game)
            {
            case MEGame.ME1:
                return(ME1UnrealObjectInfo.inheritsFrom(entry, baseClass));

            case MEGame.ME2:
                return(ME2UnrealObjectInfo.inheritsFrom(entry, baseClass));

            case MEGame.ME3:
            case MEGame.UDK:     //use me3?
                return(ME3UnrealObjectInfo.inheritsFrom(entry, baseClass));

            default:
                return(false);
            }
        }
        public static PropertyInfo GetPropertyInfo(MEGame game, string propname, string typeName)
        {
            bool         inStruct = false;
            PropertyInfo p        = null;

            switch (game)
            {
            case MEGame.ME1:
                p = ME1UnrealObjectInfo.getPropertyInfo(typeName, propname, inStruct);
                break;

            case MEGame.ME2:
                p = ME2UnrealObjectInfo.getPropertyInfo(typeName, propname, inStruct);
                break;

            case MEGame.ME3:
                p = ME3UnrealObjectInfo.getPropertyInfo(typeName, propname, inStruct);
                break;
            }
            if (p == null)
            {
                inStruct = true;
                switch (game)
                {
                case MEGame.ME1:
                    p = ME1UnrealObjectInfo.getPropertyInfo(typeName, propname, inStruct);
                    break;

                case MEGame.ME2:
                    p = ME2UnrealObjectInfo.getPropertyInfo(typeName, propname, inStruct);
                    break;

                case MEGame.ME3:
                    p = ME3UnrealObjectInfo.getPropertyInfo(typeName, propname, inStruct);
                    break;
                }
            }
            return(p);
        }