using System.Collections.Generic;
using System.Linq;
namespace PKHeX.Core;
///
/// Utilizes Reflection to obtain all defined accessor property names and object values.
///
/// Type of accessor
public sealed class SaveBlockMetadata
{
private readonly Dictionary BlockList;
public SaveBlockMetadata(ISaveBlockAccessor accessor)
{
var aType = accessor.GetType();
BlockList = aType.GetAllPropertiesOfType(accessor);
}
public IEnumerable GetSortedBlockList()
{
return BlockList.Select(z => z.Value).OrderBy(z => z);
}
public IDataIndirect GetBlock(string name) => BlockList.First(z => z.Value == name).Key;
}