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; }
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)); }
public StructProperty(string structType, PropertyCollection props, NameReference?name = null, bool isImmutable = false) : base(name) { StructType = structType; Properties = props; IsImmutable = isImmutable; PropType = PropertyType.StructProperty; }
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)); }
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)); }
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; }
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; }
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)); }
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; }
public BoolProperty(bool val, NameReference?name = null) : base(name) { Value = val; PropType = PropertyType.BoolProperty; }
public static StructProperty Vector3(Vector3 vec, NameReference?name = null) => Vector3(vec.X, vec.Y, vec.Z, name);
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; }
public ObjectProperty(MemoryStream stream, NameReference?name = null) : base(name) { Offset = stream.Position; Value = stream.ReadValueS32(); PropType = PropertyType.ObjectProperty; }
public ObjectProperty(int val, NameReference?name = null) : base(name) { Value = val; PropType = PropertyType.ObjectProperty; }
public static StructProperty Vector2Prop(Vector2 vec, NameReference?name = null) => Vector2Prop(vec.X, vec.Y, name);
public FloatProperty(float val, NameReference?name = null) : base(name) { Value = val; PropType = PropertyType.FloatProperty; }
public NoneProperty(NameReference?name = null) : base(name) { PropType = PropertyType.None; }
public NoneProperty(MemoryStream stream, NameReference?name = null) : base(name) { Offset = stream.Position; PropType = PropertyType.None; }
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; }
protected UProperty(NameReference?name) { _name = name ?? new NameReference(); }
public static StructProperty RotatorProp(Rotator rot, NameReference?name = null) => RotatorProp(rot.Pitch, rot.Yaw, rot.Roll, name);
public ByteProperty(byte val, NameReference?name = null) : base(name) { Value = val; PropType = PropertyType.ByteProperty; }
protected ArrayPropertyBase(NameReference?name) : base(name) { }
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; }
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; }
public ByteProperty(MemoryStream stream, NameReference?name = null) : base(name) { Offset = stream.Position; Value = stream.ReadValueU8(); PropType = PropertyType.ByteProperty; }
public StrProperty(string val, NameReference?name = null) : base(name) { Value = val ?? string.Empty; PropType = PropertyType.StrProperty; }