From 9160eb3549460428f5c36732fb784e856cb1677b Mon Sep 17 00:00:00 2001 From: Martin Benjamins Date: Fri, 6 Sep 2024 05:04:28 +0200 Subject: [PATCH 1/3] Fix hotfix deletions not being applied --- DBCD/DBCDStorage.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/DBCD/DBCDStorage.cs b/DBCD/DBCDStorage.cs index 5f185e5..6839471 100644 --- a/DBCD/DBCDStorage.cs +++ b/DBCD/DBCDStorage.cs @@ -144,8 +144,6 @@ public DBCDStorage(DBParser parser, Storage storage, DBCDInfo info) : base(ne foreach (var record in storage) base.Add(record.Key, new DBCDRow(record.Key, record.Value, fieldAccessor)); - - storage.Clear(); } public void ApplyingHotfixes(HotfixReader hotfixReader) @@ -166,7 +164,7 @@ public void ApplyingHotfixes(HotfixReader hotfixReader, HotfixReader.RowProcesso foreach (var (id, row) in mutableStorage) base[id] = new DBCDRow(id, row, fieldAccessor); #endif - foreach (var key in mutableStorage.Keys.Except(base.Keys)) + foreach (var key in base.Keys.Except(mutableStorage.Keys)) base.Remove(key); } @@ -194,7 +192,8 @@ public void Save(string filename) storage.Clear(); } - public DBCDRow ConstructRow(int index) { + public DBCDRow ConstructRow(int index) + { T raw = new(); var fields = typeof(T).GetFields(); // Array Fields need to be initialized to fill their length From 0d28226fa05116f39dd3715b26523c8272666aeb Mon Sep 17 00:00:00 2001 From: Martin Benjamins Date: Fri, 6 Sep 2024 11:29:23 +0200 Subject: [PATCH 2/3] Move Clear() call in saving to before row adding --- DBCD/DBCDStorage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DBCD/DBCDStorage.cs b/DBCD/DBCDStorage.cs index 6839471..253d362 100644 --- a/DBCD/DBCDStorage.cs +++ b/DBCD/DBCDStorage.cs @@ -180,6 +180,7 @@ IEnumerator> IEnumerable>.GetE public void Save(string filename) { + storage.Clear(); #if NETSTANDARD2_0 var sortedDictionary = new SortedDictionary(this); foreach (var record in sortedDictionary) @@ -189,7 +190,6 @@ public void Save(string filename) storage.Add(id, record.AsType()); #endif storage.Save(filename); - storage.Clear(); } public DBCDRow ConstructRow(int index) From 144e26080c05d2edb103fe3210c62f9f625aba5a Mon Sep 17 00:00:00 2001 From: Martin Benjamins Date: Fri, 6 Sep 2024 11:33:13 +0200 Subject: [PATCH 3/3] Bump version --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index a2421d6..469bb45 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ embedded latest - 2.0.2 + 2.0.3 WoWDev