コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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(MEGame game, string propName, string className, IEntry parsingEntry = null)
        {
            switch (game)
            {
            case MEGame.ME1:
                return(ME1UnrealObjectInfo.getArrayType(className, propName, export: parsingEntry as IExportEntry));

            case MEGame.ME2:
                var res2 = ME2UnrealObjectInfo.getArrayType(className, propName, export: parsingEntry as IExportEntry);
#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 MEGame.ME3:
            case MEGame.UDK:
                var res = ME3UnrealObjectInfo.getArrayType(className, propName, export: parsingEntry as IExportEntry);
#if DEBUG
                //For debugging only!
                if (res == ArrayType.Int && ME3UnrealObjectInfo.ArrayTypeLookupJustFailed)
                {
                    if (game == MEGame.UDK)
                    {
                        var ures = UDKUnrealObjectInfo.getArrayType(className, propName: propName, export: parsingEntry as IExportEntry);
                        if (ures == ArrayType.Int && UDKUnrealObjectInfo.ArrayTypeLookupJustFailed)
                        {
                            Debug.WriteLine("[UDK] Array type lookup failed for " + propName + " in class " + className + " in export " + parsingEntry.FileRef.GetEntryString(parsingEntry.UIndex));
                            UDKUnrealObjectInfo.ArrayTypeLookupJustFailed = false;
                        }
                        else
                        {
                            return(ures);
                        }
                    }
                    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);
        }
コード例 #3
0
        public static string GetEnumType(MEGame game, string propName, string typeName, ClassInfo nonVanillaClassInfo = null)
        {
            switch (game)
            {
            case MEGame.ME1:
                return(ME1UnrealObjectInfo.getEnumTypefromProp(typeName, propName, nonVanillaClassInfo: nonVanillaClassInfo));

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

            case MEGame.ME3:
            case MEGame.UDK:
                var enumType = ME3UnrealObjectInfo.getEnumTypefromProp(typeName, propName);
                if (enumType == null && game == MEGame.UDK)
                {
                    enumType = UDKUnrealObjectInfo.getEnumTypefromProp(typeName, propName);
                }

                return(enumType);
            }
            return(null);
        }