76 lines
1.9 KiB
C#
76 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Numerics;
|
|
using System.Text;
|
|
|
|
namespace KeepersCompound.LGS.Database.Chunks;
|
|
|
|
public class PropertyModelName : IChunk
|
|
{
|
|
public record Property
|
|
{
|
|
public int objectId;
|
|
public int length;
|
|
public string modelName;
|
|
|
|
public Property(BinaryReader reader)
|
|
{
|
|
objectId = reader.ReadInt32();
|
|
length = (int)reader.ReadUInt32();
|
|
var tmpName = Encoding.UTF8.GetString(reader.ReadBytes(length)).Replace("\0", string.Empty);
|
|
modelName = tmpName[..Math.Min(length - 1, tmpName.Length)];
|
|
}
|
|
}
|
|
|
|
public ChunkHeader Header { get; set; }
|
|
public List<Property> properties;
|
|
|
|
public void ReadData(BinaryReader reader, DbFile.TableOfContents.Entry entry)
|
|
{
|
|
properties = new List<Property>();
|
|
while (reader.BaseStream.Position < entry.Offset + entry.Size + 24)
|
|
{
|
|
properties.Add(new Property(reader));
|
|
}
|
|
}
|
|
|
|
public void WriteData(BinaryWriter writer)
|
|
{
|
|
throw new System.NotImplementedException();
|
|
}
|
|
}
|
|
|
|
public class PropertyScale : IChunk
|
|
{
|
|
public record Property
|
|
{
|
|
public int objectId;
|
|
public int length;
|
|
public Vector3 scale;
|
|
|
|
public Property(BinaryReader reader)
|
|
{
|
|
objectId = reader.ReadInt32();
|
|
length = (int)reader.ReadUInt32();
|
|
scale = reader.ReadVec3();
|
|
}
|
|
}
|
|
|
|
public ChunkHeader Header { get; set; }
|
|
public List<Property> properties;
|
|
|
|
public void ReadData(BinaryReader reader, DbFile.TableOfContents.Entry entry)
|
|
{
|
|
properties = new List<Property>();
|
|
while (reader.BaseStream.Position < entry.Offset + entry.Size + 24)
|
|
{
|
|
properties.Add(new Property(reader));
|
|
}
|
|
}
|
|
|
|
public void WriteData(BinaryWriter writer)
|
|
{
|
|
throw new System.NotImplementedException();
|
|
}
|
|
} |