private void ReadCustom(AssetBinaryReader reader, bool includeHeader, long leng1, long leng2, bool canRepeat) { if (includeHeader) { EnumType = (int)reader.ReadInt64(); PropertyGuid = reader.ReadPropertyGuid(); } switch (leng1) { case 1: ByteType = BytePropertyType.Byte; Value = (int)reader.ReadByte(); break; case 0: // Should be only seen in maps case 8: ByteType = BytePropertyType.Long; Value = (int)reader.ReadInt64(); break; default: if (canRepeat) { ReadCustom(reader, false, leng2, 0, false); return; } throw new FormatException("Invalid length " + leng1 + " for ByteProperty"); } }
public override void Read(AssetBinaryReader reader, bool includeHeader, long leng1, long leng2 = 0) { if (includeHeader) { PropertyGuid = reader.ReadPropertyGuid(); } Value = new TimeSpan(reader.ReadInt64()); // number of ticks }
public override void Read(AssetBinaryReader reader, bool includeHeader, long leng1, long leng2 = 0) { if (includeHeader) { PropertyGuid = reader.ReadPropertyGuid(); } Value = reader.ReadInt64(); }
public override void Read(AssetBinaryReader reader, bool includeHeader, long leng1, long leng2 = 0) { if (includeHeader) { ArrayType = reader.ReadFName(); PropertyGuid = reader.ReadPropertyGuid(); } int numEntries = reader.ReadInt32(); if (ArrayType.Value.Value == "StructProperty" && ShouldSerializeStructsDifferently) { var results = new PropertyData[numEntries]; FName name = this.Name; long structLength = 1; FName fullType = new FName("Generic"); Guid structGUID = new Guid(); if (reader.Asset.EngineVersion >= UE4Version.VER_UE4_INNER_ARRAY_TAG_INFO) { name = reader.ReadFName(); if (name.Value.Value.Equals("None")) { Value = results; return; } FName thisArrayType = reader.ReadFName(); if (thisArrayType.Value.Value.Equals("None")) { Value = results; return; } if (thisArrayType.Value.Value != ArrayType.Value.Value) { throw new FormatException("Invalid array type: " + thisArrayType.ToString() + " vs " + ArrayType.ToString()); } structLength = reader.ReadInt64(); // length value fullType = reader.ReadFName(); structGUID = new Guid(reader.ReadBytes(16)); reader.ReadPropertyGuid(); } if (numEntries == 0) { DummyStruct = new StructPropertyData(name, fullType) { StructGUID = structGUID }; } else { for (int i = 0; i < numEntries; i++) { var data = new StructPropertyData(name, fullType); data.Offset = reader.BaseStream.Position; data.Read(reader, false, structLength); data.StructGUID = structGUID; results[i] = data; } DummyStruct = (StructPropertyData)results[0]; } Value = results; } else { var results = new PropertyData[numEntries]; if (numEntries > 0) { int averageSizeEstimate1 = (int)(leng1 / numEntries); int averageSizeEstimate2 = (int)((leng1 - 4) / numEntries); for (int i = 0; i < numEntries; i++) { results[i] = MainSerializer.TypeToClass(ArrayType, new FName(i.ToString(), int.MinValue), reader.Asset); results[i].Offset = reader.BaseStream.Position; if (results[i] is StructPropertyData) { ((StructPropertyData)results[i]).StructType = new FName("Generic"); } results[i].Read(reader, false, averageSizeEstimate1, averageSizeEstimate2); } } Value = results; } }
/// <summary> /// Reads out the expression from a BinaryReader. /// </summary> /// <param name="reader">The BinaryReader to read from.</param> public override void Read(AssetBinaryReader reader) { Value = reader.ReadInt64(); }