public InlineProperty(IOMemoryStream ms)
 {
     startPos = ms.position;
     name     = ms.ReadInlineArkClassname();
     type     = ms.ReadInlineArkClassname();
     length   = ms.ReadInt();
     index    = ms.ReadInt();
 }
Exemple #2
0
        public byte byteValue;         //Use ONLY if the above boolean is true

        public InlineByteProperty(IOMemoryStream ms) : base(ms)
        {
            //Read in the enum name
            enumName = ms.ReadInlineArkClassname();

            //That can be None, but cannot be null.
            if (enumName == null)
            {
                throw new Exception("Tried to read enum type, but got null!");
            }

            isNormalByte = enumName.IsNone();

            //If that type is a None, this is not an enum. If it is, this is an enum. Read the name.
            if (isNormalByte)
            {
                byteValue = ms.ReadByte();
            }
            else
            {
                enumValue = ms.ReadInlineArkClassname();
            }
        }
Exemple #3
0
        public InlineStructProperty(IOMemoryStream ms) : base(ms)
        {
            //Determine the type.
            structType = ms.ReadInlineArkClassname();


            //First, we check known types for the struct property list. There could be other data, but it could fail.
            if (structType.classname == "ItemNetID" || structType.classname == "ItemNetInfo" || structType.classname == "Transform" || structType.classname == "PrimalPlayerDataStruct" || structType.classname == "PrimalPlayerCharacterConfigStruct" || structType.classname == "PrimalPersistentCharacterStatsStruct" || structType.classname == "TribeData" || structType.classname == "TribeGovernment" || structType.classname == "TerrainInfo" || structType.classname == "ArkInventoryData" || structType.classname == "DinoOrderGroup" || structType.classname == "ARKDinoData")
            {
                //Open this as a struct property list.
                data = new ArkStructInlineProps(ms);
            }
            else if (structType.classname == "Vector" || structType.classname == "Rotator")
            {
                //3d vector or rotor
                data = new ArkStructVector3(ms, structType);
            }
            else if (structType.classname == "Vector2D")
            {
                //2d vector
                data = new ArkStructVector2(ms, structType);
            }
            else if (structType.classname == "Quat")
            {
                //Quat
                data = new ArkStructQuat(ms, structType);
            }
            else if (structType.classname == "Color")
            {
                //Color
                data = new ArkStructColor(ms, structType);
            }
            else if (structType.classname == "LinearColor")
            {
                //Linear color
                data = new ArkStructLinearColor(ms, structType);
            }
            else if (structType.classname == "UniqueNetIdRepl")
            {
                //Some net stuff
                data = new ArkStructUniqueNetId(ms, structType);
            }
            else
            {
                //Interpet this as a struct property list. Maybe raise a warning later?
                throw new Exception("Unknown struct type.");
            }
        }
        public InlineArrayProperty(IOMemoryStream ms) : base(ms)
        {
            //Read type
            arrayType = ms.ReadInlineArkClassname();

            if (arrayType.classname == "StrProperty")
            {
                //Read string array
                int count = ms.ReadInt();
                data = new string[count];
                for (int i = 0; i < count; i += 1)
                {
                    data[i] = ms.ReadUEString();
                }
            }
            else
            {
                //Skip
                ms.position += length;
            }
        }
        public static InlineProperty ReadProperty(IOMemoryStream ms)
        {
            //Read type
            long         startPos = ms.position;
            ArkClassName name     = ms.ReadInlineArkClassname();

            if (name.IsNone())
            {
                return(null);
            }

            ArkClassName type = ms.ReadInlineArkClassname();

            //Rewind
            ms.position = startPos;

            //Based on the name of the prop, compare.
            InlineProperty p;

            switch (type.classname)
            {
            case "IntProperty":
                p = new InlineIntProperty(ms);
                break;

            case "StructProperty":
                p = new InlineStructProperty(ms);
                break;

            case "UInt64Property":
                p = new InlineUInt64Property(ms);
                break;

            case "StrProperty":
                p = new InlineStrProperty(ms);
                break;

            case "BoolProperty":
                p = new InlineBoolProperty(ms);
                break;

            case "ArrayProperty":
                p = new InlineArrayProperty(ms);
                break;

            case "ByteProperty":
                p = new InlineByteProperty(ms);
                break;

            case "UInt16Property":
                p = new InlineUInt16Property(ms);
                break;

            case "FloatProperty":
                p = new InlineFloatProperty(ms);
                break;

            case "DoubleProperty":
                p = new InlineDoubleProperty(ms);
                break;

            case "ObjectProperty":
                p = new InlineObjectProperty(ms);
                break;

            case "UInt32Property":
                p = new InlineUInt32Property(ms);
                break;

            default:
                //Default and read a base one, then skip
                p = new InlineProperty(ms);
                Console.WriteLine($"Unknown property {p.name.classname} ({p.type.classname}) at {p.startPos}. Attempting to skip; this will probably cause a crash.");
                ms.position += p.length;
                break;
            }
            return(p);
        }