A small data container for Archipelago game data. It stores a version number and a dictionary of game identifiers to ArchipelagoGameData, exposes a read-only view, and provides lookup, try-get and clear methods.
using System.Collections.Generic;
namespace APLib;
public sealed class ArchipelagoDataPackage
{
public int Version { get; internal set; }
public IReadOnlyDictionary<string, ArchipelagoGameData> Games => InternalGames;
internal readonly Dictionary<string, ArchipelagoGameData> InternalGames = [];
public ArchipelagoGameData GetGame( string game )
{
InternalGames.TryGetValue( game, out var value );
return value;
}
public bool TryGetGame( string game, out ArchipelagoGameData gameData )
{
return InternalGames.TryGetValue( game, out gameData );
}
internal void Clear()
{
Version = 0;
InternalGames.Clear();
}
}