private UEStringProperty ReadUEStringProperty(JObject o) { UEStringProperty value = new UEStringProperty(); value.Value = o["Value"].ToString(); return(value); }
internal static UEProperty Deserialize(string name, string type, long valueLength, BinaryReader reader) { UEProperty result; var itemOffset = reader.BaseStream.Position; switch (type) { case "BoolProperty": result = new UEBoolProperty(reader, valueLength); break; case "IntProperty": result = new UEIntProperty(reader, valueLength); break; case "FloatProperty": result = new UEFloatProperty(reader, valueLength); break; case "NameProperty": case "StrProperty": case "SoftObjectProperty": case "ObjectProperty": result = new UEStringProperty(reader, valueLength); break; case "TextProperty": result = new UETextProperty(reader, valueLength); break; case "EnumProperty": result = new UEEnumProperty(reader, valueLength); break; case "StructProperty": result = UEStructProperty.Read(reader, valueLength); break; case "ArrayProperty": result = new UEArrayProperty(reader, valueLength); break; case "MapProperty": result = new UEMapProperty(reader, valueLength); break; case "ByteProperty": result = UEByteProperty.Read(reader, valueLength); break; default: throw new FormatException($"Offset: 0x{itemOffset:x8}. Unknown value type '{type}' of item '{name}'"); } result.Name = name; result.Type = type; result.ValueLength = valueLength; return(result); }
public UEProperty[] ExportPlaylist(List <string> scenariosList, UEGenericStructProperty scenarioItem) { var sampleName = (UEStringProperty)scenarioItem.Properties[0]; var sampleCount = (UEIntProperty)scenarioItem.Properties[1]; var sampleNone = (UENoneProperty)scenarioItem.Properties[2]; var proparr = new List <UEProperty>(); foreach (var scene in scenariosList) { var name = new UEStringProperty(); var count = new UEIntProperty(); var nil = new UENoneProperty(); name.Value = scene; name.Name = sampleName.Name; name.Type = sampleName.Type; count.Value = 1; count.Name = sampleCount.Name; count.Type = sampleCount.Type; var scenarioProp = new UEGenericStructProperty(); scenarioProp.Properties = new List <UEProperty>(); scenarioProp.Name = string.Copy(scenarioItem.Name); scenarioProp.Type = string.Copy(scenarioItem.Type); scenarioProp.Header = string.Copy(scenarioItem.Header); //scenarioProp.StructType = string.Copy(scenarioItem.StructType); scenarioProp.Properties.Add(name); scenarioProp.Properties.Add(count); scenarioProp.Properties.Add(sampleNone); proparr.Add(scenarioProp); } return(proparr.ToArray()); }
internal static UEProperty Deserialize(string name, string type, long valueLength, BinaryReader reader) { UEProperty result; var itemOffset = reader.BaseStream.Position; switch (type) { case "BoolProperty": result = new UEBoolProperty(reader, valueLength); break; case "IntPropertyArray": result = new UEIntProperty(reader, valueLength, false); break; case "IntProperty": result = new UEIntProperty(reader, valueLength, true); break; case "UInt32Property": result = new UEInt32Property(reader, valueLength); break; case "FloatProperty": result = new UEFloatProperty(reader, valueLength); break; case "NameProperty": case "StrProperty": result = new UEStringProperty(reader, valueLength); break; case "TextProperty": result = new UETextProperty(reader, valueLength); break; case "EnumProperty": result = new UEEnumProperty(reader, valueLength); break; case "StructProperty": result = UEStructProperty.Read(reader, valueLength); result.Address = $"0x{ reader.BaseStream.Position - 1:x8}"; break; case "ArrayProperty": result = new UEArrayProperty(reader, valueLength); break; case "MapProperty": result = new UEMapProperty(reader, valueLength); break; case "ByteProperty": result = UEByteProperty.Read(reader, valueLength); result.Address = $"0x{ reader.BaseStream.Position - 1:x8}"; break; case "SetProperty": result = new UESetProperty(reader, valueLength); break; case "SoftObjectProperty": result = new UEStringProperty(reader, valueLength); break; case "ObjectProperty": result = new UEStringProperty(reader, valueLength); break; default: result = new UEStringProperty(reader, valueLength); break; } result.Name = name; result.Type = type; Debug.WriteLine(String.Format("{0} ({1}) {2}", name, type, $"0x{ reader.BaseStream.Position - 1:x8}")); return(result); }