using System; using System.Collections.Generic; using System.IO; using System.Numerics; using System.Text; namespace KeepersCompound.LGS.Database.Chunks; public class Property { public int objectId; public int length; public virtual void Read(BinaryReader reader) { objectId = reader.ReadInt32(); length = (int)reader.ReadUInt32(); } } public class PropertyChunk : IChunk, IMergable where T : Property, new() { public ChunkHeader Header { get; set; } public List properties; public void ReadData(BinaryReader reader, DbFile.TableOfContents.Entry entry) { properties = new List(); while (reader.BaseStream.Position < entry.Offset + entry.Size + 24) { var prop = new T(); prop.Read(reader); properties.Add(prop); } } public void WriteData(BinaryWriter writer) { throw new System.NotImplementedException(); } public void Merge(IMergable other) { properties.AddRange(((PropertyChunk)other).properties); } } public class PropGeneric : Property { public byte[] data; public override void Read(BinaryReader reader) { base.Read(reader); data = reader.ReadBytes(length); } } public class PropModelName : Property { public string modelName; public override void Read(BinaryReader reader) { base.Read(reader); modelName = reader.ReadNullString(length); } } public class PropScale : Property { public Vector3 scale; public override void Read(BinaryReader reader) { base.Read(reader); scale = reader.ReadVec3(); } } public class PropRenderType : Property { public enum Mode { Normal, NotRendered, Unlit, EditorOnly, CoronaOnly, } public Mode mode; public override void Read(BinaryReader reader) { base.Read(reader); mode = (Mode)reader.ReadUInt32(); } } public class PropString : Property { public int stringLength; public string value; public override void Read(BinaryReader reader) { base.Read(reader); stringLength = reader.ReadInt32(); value = reader.ReadNullString(stringLength); } } public class PropFloat : Property { public float value; public override void Read(BinaryReader reader) { base.Read(reader); value = reader.ReadSingle(); } }