Skip to content

Commit

Permalink
Attempt at cleaning up DBCDStorage.cs diff
Browse files Browse the repository at this point in the history
  • Loading branch information
Marlamin committed Aug 9, 2024
1 parent 247c1cc commit fca6efb
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions DBCD/DBCDStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,12 @@ public interface IDBCDStorage : IEnumerable<DynamicKeyValuePair<int>>, IDictiona

DBCDRow ConstructRow(int index);

Dictionary<ulong, int> GetEncryptedSections();
Dictionary<ulong, int[]> GetEncryptedIDs();

void ApplyingHotfixes(HotfixReader hotfixReader);
void ApplyingHotfixes(HotfixReader hotfixReader, HotfixReader.RowProcessor processor);

Dictionary<ulong, int> GetEncryptedSections();

void Save(string filename);

Dictionary<int, DBCDRow> ToDictionary();
Expand Down Expand Up @@ -145,15 +146,6 @@ public DBCDStorage(DBParser parser, Storage<T> storage, DBCDInfo info) : base(ne
storage.Clear();
}

IEnumerator<DynamicKeyValuePair<int>> IEnumerable<DynamicKeyValuePair<int>>.GetEnumerator()
{
var enumerator = GetEnumerator();
while (enumerator.MoveNext())
yield return new DynamicKeyValuePair<int>(enumerator.Current.Key, enumerator.Current.Value);
}

public Dictionary<ulong, int> GetEncryptedSections() => this.parser.GetEncryptedSections();

public void ApplyingHotfixes(HotfixReader hotfixReader)
{
this.ApplyingHotfixes(hotfixReader, null);
Expand All @@ -166,7 +158,7 @@ public void ApplyingHotfixes(HotfixReader hotfixReader, HotfixReader.RowProcesso
hotfixReader.ApplyHotfixes(mutableStorage, this.parser, processor);

#if NETSTANDARD2_0
foreach(var record in mutableStorage)
foreach (var record in mutableStorage)
base[record.Key] = new DBCDRow(record.Key, record.Value, fieldAccessor);
#else
foreach (var (id, row) in mutableStorage)
Expand All @@ -176,6 +168,16 @@ public void ApplyingHotfixes(HotfixReader hotfixReader, HotfixReader.RowProcesso
base.Remove(key);
}

IEnumerator<DynamicKeyValuePair<int>> IEnumerable<DynamicKeyValuePair<int>>.GetEnumerator()
{
var enumerator = GetEnumerator();
while (enumerator.MoveNext())
yield return new DynamicKeyValuePair<int>(enumerator.Current.Key, enumerator.Current.Value);
}

public Dictionary<ulong, int> GetEncryptedSections() => this.parser.GetEncryptedSections();
public Dictionary<ulong, int[]> GetEncryptedIDs() => this.parser.GetEncryptedIDs();

public void Save(string filename)
{
#if NETSTANDARD2_0
Expand All @@ -186,8 +188,6 @@ public void Save(string filename)
foreach (var (id, record) in new SortedDictionary<int, DBCDRow>(this))
storage.Add(id, record.AsType<T>());
#endif


storage?.Save(filename);
}

Expand Down

0 comments on commit fca6efb

Please sign in to comment.