protected virtual void ReadHotfixes <T>(IDictionary <int, T> storage, DBParser dbReader) where T : class, new() { var fieldCache = typeof(T).GetFields().Select(x => new FieldCache <T>(x)).ToArray(); // Id fields need to be excluded if not inline if (dbReader.Flags.HasFlagExt(DB2Flags.Index)) { fieldCache[dbReader.IdFieldIndex].IndexMapField = true; } // TODO verify hotfixes need to be applied sequentially var records = _reader.GetRecords(dbReader.TableHash).OrderBy(x => x.PushId); foreach (var row in records) { if (row.IsValid) { T entry = new T(); row.GetFields(fieldCache, entry); storage[row.RecordId] = entry; } else { storage.Remove(row.RecordId); } } }
public void ApplyHotfixes <T>(IDictionary <int, T> storage, DBParser dbReader) where T : class, new() => ReadHotfixes(storage, dbReader);