From db293791e0cfd003d2682d24cc8b2dc42ee6ecbb Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Sat, 24 Aug 2024 13:36:44 +0100 Subject: [PATCH] Handle GAM_FILE chunk --- project/code/LGS/Database/Chunks/GamFile.cs | 22 +++++++++++++++++++++ project/code/LGS/Database/File.cs | 1 + 2 files changed, 23 insertions(+) create mode 100644 project/code/LGS/Database/Chunks/GamFile.cs diff --git a/project/code/LGS/Database/Chunks/GamFile.cs b/project/code/LGS/Database/Chunks/GamFile.cs new file mode 100644 index 0000000..07683d1 --- /dev/null +++ b/project/code/LGS/Database/Chunks/GamFile.cs @@ -0,0 +1,22 @@ +using System; +using System.IO; +using System.Text; + +namespace KeepersCompound.LGS.Database.Chunks; + +public class GamFile : IChunk +{ + public ChunkHeader Header { get; set; } + public string fileName; + + public void ReadData(BinaryReader reader, DbFile.TableOfContents.Entry entry) + { + var tmpName = Encoding.UTF8.GetString(reader.ReadBytes(256)).Replace("\0", string.Empty); + fileName = tmpName[..Math.Min(255, tmpName.Length)]; + } + + public void WriteData(BinaryWriter writer) + { + throw new System.NotImplementedException(); + } +} \ No newline at end of file diff --git a/project/code/LGS/Database/File.cs b/project/code/LGS/Database/File.cs index d18f968..072d3ab 100644 --- a/project/code/LGS/Database/File.cs +++ b/project/code/LGS/Database/File.cs @@ -98,6 +98,7 @@ public class DbFile { // "AI_ROOM_DB" => new AiRoomDb(), // "AICONVERSE" => new AiConverseChunk(), + "GAM_FILE" => new GamFile(), "TXLIST" => new TxList(), "WREXT" => new WorldRep(), "BRLIST" => new BrList(),