private static void LoadFavorites(IEnumerable <InventoryPouch8a> pouches, SCBlockAccessor access) { var favorites = access.GetBlock(SaveBlockAccessor8LA.KItemFavorite).Data.AsSpan(); foreach (var arr in pouches) { LoadFavorites(arr.Items, favorites); } }
private static void SaveFavorites(ReadOnlySpan <InventoryPouch8a> pouches, SCBlockAccessor access) { var favorites = access.GetBlock(SaveBlockAccessor8LA.KItemFavorite).Data.AsSpan(); favorites.Clear(); foreach (var arr in pouches) { SaveFavorites(arr.Items, favorites); } }
/// <summary> /// Creates a new instance of <see cref="SCBlockMetadata"/> by loading properties and constants declared via reflection. /// </summary> public SCBlockMetadata(SCBlockAccessor accessor, IEnumerable <string> extraKeyNames, params string[] exclusions) { var aType = accessor.GetType(); BlockList = aType.GetAllPropertiesOfType <IDataIndirect>(accessor); ValueList = aType.GetAllConstantsOfType <uint>(); AddExtraKeyNames(ValueList, extraKeyNames); if (exclusions.Length > 0) { ValueList = ValueList.Where(z => !exclusions.Any(z.Value.Contains)).ToDictionary(z => z.Key, z => z.Value); } Accessor = accessor; }