Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deletion hotfixes not applying #28

Merged
merged 3 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions DBCD/DBCDStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ public DBCDStorage(DBParser parser, Storage<T> 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)
Expand All @@ -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);
}

Expand All @@ -182,6 +180,7 @@ IEnumerator<DynamicKeyValuePair<int>> IEnumerable<DynamicKeyValuePair<int>>.GetE

public void Save(string filename)
{
storage.Clear();
#if NETSTANDARD2_0
var sortedDictionary = new SortedDictionary<int, DBCDRow>(this);
foreach (var record in sortedDictionary)
Expand All @@ -191,10 +190,10 @@ public void Save(string filename)
storage.Add(id, record.AsType<T>());
#endif
storage.Save(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
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<DebugType>embedded</DebugType>
<LangVersion>latest</LangVersion>
<Version>2.0.2</Version>
<Version>2.0.3</Version>
</PropertyGroup>
<PropertyGroup>
<Authors>WoWDev</Authors>
Expand Down
Loading