Пример #1
0
        public StrProperty(MemoryStream stream, NameReference?name = null) : base(name)
        {
            Offset = stream.Position;
            int count     = stream.ReadValueS32();
            var streamPos = stream.Position;

            if (count < -1) // originally 0
            {
                count *= -2;
                Value  = stream.ReadString(count, true, Encoding.Unicode);
            }
            else if (count > 0)
            {
                Value = stream.ReadString(count, true, Encoding.ASCII);
            }
            else
            {
                Value = string.Empty;
                //ME3Explroer 3.0.2 and below wrote a null terminator character when writing an empty string.
                //The game however does not write an empty string if the length is 0 - it just happened to still work but not 100% of the time
                //This is for backwards compatibility with that as it will have a count of 0 instead of -1
                if (count == -1)
                {
                    stream.Position += 2;
                }
            }

            //for when the end of the string has multiple nulls at the end
            if (stream.Position < streamPos + count)
            {
                stream.Seek(streamPos + count, SeekOrigin.Begin);
            }

            PropType = PropertyType.StrProperty;
        }
Пример #2
0
 public StructProperty ToStructProperty(MEGame game, NameReference?name = null)
 {
     return(new StructProperty(VectorType <T>(), new PropertyCollection
     {
         new ArrayProperty <StructProperty>(Points.Select(p => p.ToStructProperty(game)), "Points"),
     }, name));
 }
Пример #3
0
 public StructProperty(string structType, PropertyCollection props, NameReference?name = null, bool isImmutable = false) : base(name)
 {
     StructType  = structType;
     Properties  = props;
     IsImmutable = isImmutable;
     PropType    = PropertyType.StructProperty;
 }
Пример #4
0
 public static StructProperty MatrixProp(Matrix m, NameReference?name = null)
 {
     return(new StructProperty("Matrix", new PropertyCollection
     {
         new StructProperty("Plane", new PropertyCollection
         {
             new FloatProperty(m.M14, "W"),
             new FloatProperty(m.M11, "X"),
             new FloatProperty(m.M12, "Y"),
             new FloatProperty(m.M13, "Z")
         }, "X", true),
         new StructProperty("Plane", new PropertyCollection
         {
             new FloatProperty(m.M24, "W"),
             new FloatProperty(m.M21, "X"),
             new FloatProperty(m.M22, "Y"),
             new FloatProperty(m.M23, "Z")
         }, "Y", true),
         new StructProperty("Plane", new PropertyCollection
         {
             new FloatProperty(m.M34, "W"),
             new FloatProperty(m.M31, "X"),
             new FloatProperty(m.M32, "Y"),
             new FloatProperty(m.M33, "Z")
         }, "Z", true),
         new StructProperty("Plane", new PropertyCollection
         {
             new FloatProperty(m.M44, "W"),
             new FloatProperty(m.M41, "X"),
             new FloatProperty(m.M42, "Y"),
             new FloatProperty(m.M43, "Z")
         }, "W", true)
     }, name, true));
 }
Пример #5
0
 public static StructProperty Vector2Prop(float x, float y, NameReference?name = null)
 {
     return(new StructProperty("Vector2D", new PropertyCollection
     {
         new FloatProperty(x, "X"),
         new FloatProperty(y, "Y")
     }, name, true));
 }
Пример #6
0
 public static StructProperty RotatorProp(int pitch, int yaw, int roll, NameReference?name = null)
 {
     return(new StructProperty("Rotator", new PropertyCollection
     {
         new IntProperty(pitch, "Pitch"),
         new IntProperty(yaw, "Yaw"),
         new IntProperty(roll, "Roll")
     }, name, true));
 }
        public NameProperty(MemoryStream stream, IMEPackage pcc, NameReference?name = null) : base(name)
        {
            NameReference nameRef = new NameReference();

            nameRef.Name  = pcc.getNameEntry(stream.ReadValueS32());
            nameRef.count = stream.ReadValueS32();
            Value         = nameRef;
            PropType      = PropertyType.NameProperty;
        }
Пример #8
0
 public static StructProperty ColorProp(System.Drawing.Color color, NameReference?name = null)
 {
     return(new StructProperty("Color", new PropertyCollection
     {
         new ByteProperty(color.B, "B"),
         new ByteProperty(color.G, "G"),
         new ByteProperty(color.R, "R"),
         new ByteProperty(color.A, "A"),
     }, name, true));
 }
        public DelegateProperty(MemoryStream stream, IMEPackage pcc, NameReference?name = null) : base(name)
        {
            unk = stream.ReadValueS32();
            NameReference val = new NameReference();

            val.Name  = pcc.getNameEntry(stream.ReadValueS32());
            val.count = stream.ReadValueS32();
            Value     = val;
            PropType  = PropertyType.DelegateProperty;
        }
Пример #10
0
 public static StructProperty GuidProp(Guid guid, NameReference?name = null)
 {
     byte[] guidBytes = guid.ToByteArray();
     return(new StructProperty("Guid", new PropertyCollection
     {
         new IntProperty(BitConverter.ToInt32(guidBytes, 0), "A"),
         new IntProperty(BitConverter.ToInt32(guidBytes, 4), "B"),
         new IntProperty(BitConverter.ToInt32(guidBytes, 8), "C"),
         new IntProperty(BitConverter.ToInt32(guidBytes, 12), "D")
     }, name, true));
 }
Пример #11
0
        public NameProperty(MemoryStream stream, IMEPackage pcc, NameReference?name = null) : base(name)
        {
            Offset         = stream.Position;
            NameTableIndex = stream.ReadValueS32();
            NameReference nameRef = new NameReference
            {
                Name   = pcc.getNameEntry(NameTableIndex),
                Number = stream.ReadValueS32()
            };

            Value    = nameRef;
            PropType = PropertyType.NameProperty;
        }
        public StrProperty(MemoryStream stream, NameReference?name = null) : base(name)
        {
            int count = stream.ReadValueS32();

            if (count < 0)
            {
                Value = stream.ReadString(-count * 2, true, Encoding.Unicode);
            }
            else if (count > 0)
            {
                Value = stream.ReadString(count, true, Encoding.ASCII);
            }
            else
            {
                Value = string.Empty;
            }
            PropType = PropertyType.StrProperty;
        }
Пример #13
0
 public BoolProperty(bool val, NameReference?name = null) : base(name)
 {
     Value    = val;
     PropType = PropertyType.BoolProperty;
 }
Пример #14
0
 public static StructProperty Vector3(Vector3 vec, NameReference?name = null) => Vector3(vec.X, vec.Y, vec.Z, name);
Пример #15
0
 public BoolProperty(MemoryStream stream, MEGame game, NameReference?name = null) : base(name)
 {
     Offset   = stream.Position;
     Value    = game == MEGame.ME3 ? stream.ReadValueB8() : stream.ReadValueB32();
     PropType = PropertyType.BoolProperty;
 }
Пример #16
0
 public ObjectProperty(MemoryStream stream, NameReference?name = null) : base(name)
 {
     Offset   = stream.Position;
     Value    = stream.ReadValueS32();
     PropType = PropertyType.ObjectProperty;
 }
Пример #17
0
 public ObjectProperty(int val, NameReference?name = null) : base(name)
 {
     Value    = val;
     PropType = PropertyType.ObjectProperty;
 }
Пример #18
0
 public static StructProperty Vector2Prop(Vector2 vec, NameReference?name = null) => Vector2Prop(vec.X, vec.Y, name);
Пример #19
0
 public FloatProperty(float val, NameReference?name = null) : base(name)
 {
     Value    = val;
     PropType = PropertyType.FloatProperty;
 }
Пример #20
0
 public NoneProperty(NameReference?name = null) : base(name)
 {
     PropType = PropertyType.None;
 }
Пример #21
0
 public NoneProperty(MemoryStream stream, NameReference?name = null) : base(name)
 {
     Offset   = stream.Position;
     PropType = PropertyType.None;
 }
Пример #22
0
 public UnknownProperty(MemoryStream stream, int size, string typeName = null, NameReference?name = null) : base(name)
 {
     Offset   = stream.Position;
     TypeName = typeName;
     raw      = stream.ReadBytes(size);
     PropType = PropertyType.Unknown;
 }
Пример #23
0
 protected UProperty(NameReference?name)
 {
     _name = name ?? new NameReference();
 }
Пример #24
0
 public static StructProperty RotatorProp(Rotator rot, NameReference?name = null) => RotatorProp(rot.Pitch, rot.Yaw, rot.Roll, name);
Пример #25
0
 public ByteProperty(byte val, NameReference?name = null) : base(name)
 {
     Value    = val;
     PropType = PropertyType.ByteProperty;
 }
Пример #26
0
 protected ArrayPropertyBase(NameReference?name) : base(name)
 {
 }
Пример #27
0
        public EnumProperty(NameReference value, NameReference enumType, IMEPackage pcc, NameReference?name = null) : base(name)
        {
            EnumType = enumType;
            NameReference enumVal = value;

            Value      = enumVal;
            EnumValues = UnrealObjectInfo.GetEnumValues(pcc.Game, enumType, true);
            PropType   = PropertyType.ByteProperty;
        }
Пример #28
0
        public EnumProperty(MemoryStream stream, IMEPackage pcc, NameReference enumType, NameReference?name = null) : base(name)
        {
            Offset   = stream.Position;
            EnumType = enumType;
            NameReference enumVal = new NameReference
            {
                Name   = pcc.getNameEntry(stream.ReadValueS32()),
                Number = stream.ReadValueS32()
            };

            Value      = enumVal;
            EnumValues = UnrealObjectInfo.GetEnumValues(pcc.Game, enumType, true);
            PropType   = PropertyType.ByteProperty;
        }
Пример #29
0
 public ByteProperty(MemoryStream stream, NameReference?name = null) : base(name)
 {
     Offset   = stream.Position;
     Value    = stream.ReadValueU8();
     PropType = PropertyType.ByteProperty;
 }
Пример #30
0
 public StrProperty(string val, NameReference?name = null) : base(name)
 {
     Value    = val ?? string.Empty;
     PropType = PropertyType.StrProperty;
 }