Exemplo n.º 1
0
        SDKClass ProcessClass(UClass @class)
        {
            var sdkc = new SDKClass();

            sdkc.ClassName = SDKUtilities.CleanupName(@class.NameWithPrefix);
            if (@class.SuperField != null)
            {
                sdkc.SuperClass = SDKUtilities.CleanupName(@class.SuperField.NameWithPrefix);
                var scNamespace = SDKUtilities.GetPackageName(@class.SuperField.Cast <UClass>());
                if (!sdkc.UsedNamespaces.Contains(scNamespace))
                {
                    sdkc.UsedNamespaces.Add(scNamespace);
                }
            }
            sdkc.ClassSize = @class.PropertySize;
            sdkc.Namespace = SDKUtilities.GetPackageName(@class);
            var child = @class.Children;

            while (child != null)
            {
                if (child.IsA <UProperty>())
                {
                    sdkc.AddProperty(child.Cast <UProperty>());
                }
                child = child.Next;
            }
            return(sdkc);
        }
Exemplo n.º 2
0
        public void AddProperty(UProperty property, string classname = null, string name = null)
        {
            string propname = name;

            if (propname == null)
            {
                propname = SDKUtilities.CleanupName(property.Name);
            }
            if (classname == null)
            {
                classname = property.Class.Name;
            }
            if (Properties.ContainsKey(propname))
            {
                int counter = 1;
                while (Properties.ContainsKey(propname + counter))
                {
                    counter++;
                }
                propname += counter;
            }
            bool supported = true;
            var  prop      = new SDKProperty()
            {
                Name        = propname,
                ElementSize = property.ElementSize,
                IsTArray    = classname == "ArrayProperty",
                Offset      = property.Offset,
                Type        = classname,
            };

            switch (classname)
            {
            case "AssetObjectProperty":
            case "WeakObjectProperty":
            case "MulticastDelegateProperty":
            {
                supported = false;
                break;
            }

            case "ArrayProperty":
            {
                var arrayProp = property.Cast <UArrayProperty>();
                prop.SubType = property.Cast <UArrayProperty>().Inner.Class.Name;
                switch (prop.SubType)
                {
                case "NameProperty":
                {
                    prop.ArraySubType = "FName";
                    break;
                }

                case "ObjectProperty":
                {
                    prop.SubElementSize = arrayProp.Inner.Cast <UObjectProperty>().PropertyClass.PropertySize;
                    prop.ArraySubType   = arrayProp.Inner.Cast <UObjectProperty>().PropertyClass.NameWithPrefix;
                    var nsProp = SDKUtilities.GetPackageName(arrayProp.Inner.Cast <UObjectProperty>().PropertyClass);
                    if (!UsedNamespaces.Contains(nsProp))
                    {
                        UsedNamespaces.Add(nsProp);
                    }
                    break;
                }

                case "StructProperty":
                {
                    prop.ArraySubType   = arrayProp.Inner.Cast <UStructProperty>().Struct.NameWithPrefix;
                    prop.SubElementSize = arrayProp.Inner.Cast <UStructProperty>().Struct.PropertySize;
                    var nsProp = SDKUtilities.GetPackageName(arrayProp.Inner.Cast <UStructProperty>().Struct.Cast <UClass>());
                    if (!UsedNamespaces.Contains(nsProp))
                    {
                        UsedNamespaces.Add(nsProp);
                    }
                    break;
                }
                }
                break;
            }

            case "BoolProperty":
            {
                var p = property.Cast <UBoolProperty>();
                prop.BoolFieldMask = p.FieldMask;
                prop.BoolByteMask  = p.ByteMask;
                prop.BitMask       = p.BitMask;
                prop.BoolOffset    = p.ByteOffset;
                break;
            }

            case "ObjectProperty":
            {
                prop.SubType        = property.Cast <UObjectProperty>().PropertyClass.NameWithPrefix;
                prop.SubElementSize = property.Cast <UObjectProperty>().PropertyClass.PropertySize;
                var nsProp = SDKUtilities.GetPackageName(property.Cast <UObjectProperty>().PropertyClass);
                if (!UsedNamespaces.Contains(nsProp))
                {
                    UsedNamespaces.Add(nsProp);
                }
                break;
            }

            case "StructProperty":
            {
                prop.SubType        = property.Cast <UStructProperty>().Struct.NameWithPrefix;
                prop.SubElementSize = property.Cast <UStructProperty>().Struct.PropertySize;
                var nsProp = SDKUtilities.GetPackageName(property.Cast <UStructProperty>().Struct.Cast <UClass>());
                if (!UsedNamespaces.Contains(nsProp))
                {
                    UsedNamespaces.Add(nsProp);
                }
                break;
            }
            }
            if (supported)
            {
                Properties.Add(propname, prop);
            }
        }