internal BinTreeOptional(BinaryReader br, IBinTreeParent parent, uint nameHash) : base(parent, nameHash) { this.ValueType = BinUtilities.UnpackType((BinPropertyType)br.ReadByte()); bool isSome = br.ReadBoolean(); if (isSome) { this.Value = BinTreeProperty.Read(br, this, this.ValueType); } }
private string GetPropertyTypeDeclaration(MetaDumpProperty property, Dictionary <uint, string> classNames) { return(BinUtilities.UnpackType(property.Type) switch { BinPropertyType.Container => GetContainerTypeDeclaration(property.OtherClass, property.Container, false, classNames), BinPropertyType.UnorderedContainer => GetContainerTypeDeclaration(property.OtherClass, property.Container, true, classNames), BinPropertyType.Structure => GetStructureTypeDeclaration(property.OtherClass, classNames), BinPropertyType.Embedded => GetEmbeddedTypeDeclaration(property.OtherClass, classNames), BinPropertyType.Optional => GetOptionalTypeDeclaration(property.OtherClass, property.Container, classNames), BinPropertyType.Map => GetMapTypeDeclaration(property.OtherClass, property.Map, classNames), BinPropertyType type => GetPrimitivePropertyTypeDeclaration(type, true) });
private void WritePropertyAttribute(StreamWriter sw, MetaDumpProperty property, Dictionary <uint, string> propertyNames) { BinPropertyType propertyType = BinUtilities.UnpackType(property.Type); if (propertyNames.TryGetValue(property.Hash, out string propertyName)) { sw.WriteLineIndented(2, @"[MetaProperty(""{0}"", BinPropertyType.{1})]", propertyName, propertyType); } else { sw.WriteLineIndented(2, @"[MetaProperty({0}, BinPropertyType.{1})]", property.Hash, propertyType); } }