From 3bedeaaa5a3339e3754492c3f86d9fb98344955d Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Sat, 23 Nov 2019 21:16:32 -0500 Subject: [PATCH] use time-tested RoundUp function and calculate table size minus length of '@UTF' signature (maybe this is wrong) --- .../DataFormats/Database/UTF/UTFDataFormat.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CSharp/Plugins/UniversalEditor.Plugins.CRI/DataFormats/Database/UTF/UTFDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.CRI/DataFormats/Database/UTF/UTFDataFormat.cs index 5debb1d2..a786ec91 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.CRI/DataFormats/Database/UTF/UTFDataFormat.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.CRI/DataFormats/Database/UTF/UTFDataFormat.cs @@ -387,7 +387,7 @@ namespace UniversalEditor.Plugins.CRI.DataFormats.Database.UTF } } - int tableSize = 32; // size of entire file + int tableSize = 28; // size of entire file minus "@UTF" signature tableSize += (5 * dt.Fields.Count); tableSize += (dt.Name.Length + 1); @@ -432,8 +432,7 @@ namespace UniversalEditor.Plugins.CRI.DataFormats.Database.UTF } } - tableSize += ((8 - (tableSize % 8)) % 8); - tableSize -= 8; + tableSize = tableSize.RoundUp(8); bw.WriteInt32(tableSize); bw.WriteInt32(rowsOffset);