From d1c49126e0f28ba769450b788ed105462d76b889 Mon Sep 17 00:00:00 2001 From: InX-Invader Date: Wed, 17 Mar 2021 02:01:44 -0500 Subject: [PATCH 1/2] Update DataMapping member types. Update DataForgeDataMapping StructIndex and StructCount types and reads for new structure in Datacore version 5. --- src/unforge/ComplexTypes/DataForgeDataMapping.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unforge/ComplexTypes/DataForgeDataMapping.cs b/src/unforge/ComplexTypes/DataForgeDataMapping.cs index 13c37f0a..f4206453 100644 --- a/src/unforge/ComplexTypes/DataForgeDataMapping.cs +++ b/src/unforge/ComplexTypes/DataForgeDataMapping.cs @@ -8,16 +8,16 @@ namespace unforge { public class DataForgeDataMapping : _DataForgeSerializable { - public UInt16 StructIndex { get; set; } - public UInt16 StructCount { get; set; } + public UInt32 StructIndex { get; set; } + public UInt32 StructCount { get; set; } public UInt32 NameOffset { get; set; } public String Name { get { return this.DocumentRoot.ValueMap[this.NameOffset]; } } public DataForgeDataMapping(DataForge documentRoot) : base(documentRoot) { - this.StructCount = this._br.ReadUInt16(); - this.StructIndex = this._br.ReadUInt16(); + this.StructCount = this._br.ReadUInt32(); + this.StructIndex = this._br.ReadUInt32(); this.NameOffset = documentRoot.StructDefinitionTable[this.StructIndex].NameOffset; } From 1bdd1d5405480b8c0f7bb85cd0ebad2624fe11f2 Mon Sep 17 00:00:00 2001 From: InX-Invader Date: Wed, 17 Mar 2021 02:28:16 -0500 Subject: [PATCH 2/2] Add case for legacy DataMapping --- src/unforge/ComplexTypes/DataForgeDataMapping.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/unforge/ComplexTypes/DataForgeDataMapping.cs b/src/unforge/ComplexTypes/DataForgeDataMapping.cs index f4206453..83a58e08 100644 --- a/src/unforge/ComplexTypes/DataForgeDataMapping.cs +++ b/src/unforge/ComplexTypes/DataForgeDataMapping.cs @@ -16,8 +16,13 @@ public class DataForgeDataMapping : _DataForgeSerializable public DataForgeDataMapping(DataForge documentRoot) : base(documentRoot) { - this.StructCount = this._br.ReadUInt32(); - this.StructIndex = this._br.ReadUInt32(); + if(this.DocumentRoot.FileVersion >= 5) { + this.StructCount = this._br.ReadUInt32(); + this.StructIndex = this._br.ReadUInt32(); + } else { + this.StructCount = this._br.ReadUInt16(); + this.StructIndex = this._br.ReadUInt16(); + } this.NameOffset = documentRoot.StructDefinitionTable[this.StructIndex].NameOffset; }