41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.IO;
|
||
|
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();
|
||
|
}
|
||
|
}
|