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); } }
public BinTreeOptional(IBinTreeParent parent, uint nameHash, BinPropertyType type, BinTreeProperty value) : base(parent, nameHash) { this.ValueType = type; this.Value = value; if (value is not null) { value.Parent = this; } }
internal static BinTreeProperty Read(BinaryReader br, IBinTreeParent parent, BinPropertyType?type = null) { uint nameHash = 0; BinPropertyType packedType; if (type is null) { nameHash = br.ReadUInt32(); packedType = (BinPropertyType)br.ReadByte(); type = BinUtilities.UnpackType(packedType); } return(type switch { BinPropertyType.None => new BinTreeNone(br, parent, nameHash), BinPropertyType.Bool => new BinTreeBool(br, parent, nameHash), BinPropertyType.SByte => new BinTreeSByte(br, parent, nameHash), BinPropertyType.Byte => new BinTreeByte(br, parent, nameHash), BinPropertyType.Int16 => new BinTreeInt16(br, parent, nameHash), BinPropertyType.UInt16 => new BinTreeUInt16(br, parent, nameHash), BinPropertyType.Int32 => new BinTreeInt32(br, parent, nameHash), BinPropertyType.UInt32 => new BinTreeUInt32(br, parent, nameHash), BinPropertyType.Int64 => new BinTreeInt64(br, parent, nameHash), BinPropertyType.UInt64 => new BinTreeUInt64(br, parent, nameHash), BinPropertyType.Float => new BinTreeFloat(br, parent, nameHash), BinPropertyType.Vector2 => new BinTreeVector2(br, parent, nameHash), BinPropertyType.Vector3 => new BinTreeVector3(br, parent, nameHash), BinPropertyType.Vector4 => new BinTreeVector4(br, parent, nameHash), BinPropertyType.Matrix44 => new BinTreeMatrix44(br, parent, nameHash), BinPropertyType.Color => new BinTreeColor(br, parent, nameHash), BinPropertyType.String => new BinTreeString(br, parent, nameHash), BinPropertyType.Hash => new BinTreeHash(br, parent, nameHash), BinPropertyType.WadEntryLink => new BinTreeWadEntryLink(br, parent, nameHash), BinPropertyType.Container => new BinTreeContainer(br, parent, nameHash), BinPropertyType.UnorderedContainer => new BinTreeUnorderedContainer(br, parent, nameHash), BinPropertyType.Structure => new BinTreeStructure(br, parent, nameHash), BinPropertyType.Embedded => new BinTreeEmbedded(br, parent, nameHash), BinPropertyType.ObjectLink => new BinTreeObjectLink(br, parent, nameHash), BinPropertyType.Optional => new BinTreeOptional(br, parent, nameHash), BinPropertyType.Map => new BinTreeMap(br, parent, nameHash), BinPropertyType.BitBool => new BinTreeBitBool(br, parent, nameHash), _ => throw new InvalidOperationException("Invalid BinPropertyType: " + type), });
public BinTreeOptional(IBinTreeParent parent, uint nameHash, BinPropertyType type, BinTreeProperty value) : base(parent, nameHash) { this.ValueType = type; this.Value = value; }
internal BinTreeUnorderedContainer(BinaryReader br, IBinTreeParent parent, uint nameHash) : base(br, parent, nameHash) { }
public BinTreeMatrix44(IBinTreeParent parent, uint nameHash, Matrix4x4 value) : base(parent, nameHash) { this.Value = value; }
public BinTreeByte(IBinTreeParent parent, uint nameHash, byte value) : base(parent, nameHash) { this.Value = value; }
public BinTreeVector4(IBinTreeParent parent, uint nameHash, Vector4 value) : base(parent, nameHash) { this.Value = value; }
public BinTreeNone(IBinTreeParent parent, uint nameHash) : base(parent, nameHash) { }
public BinTreeObjectLink(IBinTreeParent parent, uint nameHash, uint value) : base(parent, nameHash) { this.Value = value; }
internal BinTreeColor(BinaryReader br, IBinTreeParent parent, uint nameHash) : base(parent, nameHash) { this.Value = br.ReadColor(ColorFormat.RgbaU8); }
public BinTreeColor(IBinTreeParent parent, uint nameHash, Color value) : base(parent, nameHash) { this.Value = value; }
internal BinTreeFloat(BinaryReader br, IBinTreeParent parent, uint nameHash) : base(parent, nameHash) { this.Value = br.ReadSingle(); }
public BinTreeFloat(IBinTreeParent parent, uint nameHash, float value) : base(parent, nameHash) { this.Value = value; }
protected BinTreeProperty(IBinTreeParent parent, uint nameHash) { this.Parent = parent; this.NameHash = nameHash; }
internal BinTreeString(BinaryReader br, IBinTreeParent parent, uint nameHash) : base(parent, nameHash) { this.Value = Encoding.ASCII.GetString(br.ReadBytes(br.ReadUInt16())); }
internal BinTreeNone(BinaryReader br, IBinTreeParent parent, uint nameHash) : base(parent, nameHash) { }
internal BinTreeObjectLink(BinaryReader br, IBinTreeParent parent, uint nameHash) : base(parent, nameHash) { this.Value = br.ReadUInt32(); }
public BinTreeUInt32(IBinTreeParent parent, uint nameHash, uint value) : base(parent, nameHash) { this.Value = value; }
public BinTreeWadEntryLink(IBinTreeParent parent, uint nameHash, ulong value) : base(parent, nameHash) { this.Value = value; }
internal BinTreeWadEntryLink(BinaryReader br, IBinTreeParent parent, uint nameHash) : base(parent, nameHash) { this.Value = br.ReadUInt64(); }
public BinTreeInt16(IBinTreeParent parent, uint nameHash, short value) : base(parent, nameHash) { this.Value = value; }
internal BinTreeVector4(BinaryReader br, IBinTreeParent parent, uint nameHash) : base(parent, nameHash) { this.Value = br.ReadVector4(); }
public BinTreeInt64(IBinTreeParent parent, uint nameHash, long value) : base(parent, nameHash) { this.Value = value; }
internal BinTreeByte(BinaryReader br, IBinTreeParent parent, uint nameHash) : base(parent, nameHash) { this.Value = br.ReadByte(); }
public BinTreeBool(IBinTreeParent parent, uint nameHash, bool value) : base(parent, nameHash) { this.Value = value; }
internal BinTreeMatrix44(BinaryReader br, IBinTreeParent parent, uint nameHash) : base(parent, nameHash) { this.Value = br.ReadMatrix4x4RowMajor(); }
public BinTreeString(IBinTreeParent parent, uint nameHash, string value) : base(parent, nameHash) { this.Value = value; }
public BinTreeUnorderedContainer(IBinTreeParent parent, uint nameHash, BinPropertyType propertiesType, IEnumerable <BinTreeProperty> properties) : base(parent, nameHash, propertiesType, properties) { }
public BinTreeEmbedded(IBinTreeParent parent, uint nameHash, uint metaClassHash, IEnumerable <BinTreeProperty> properties) : base(parent, nameHash, metaClassHash, properties) { }