ArchipelagoGameData.cs

Data container for Archipelago game metadata. Stores game Name and maps of item and location ids to names, exposes read-only dictionaries and lookup helpers that return fallback strings when an id is missing.

File Access
using System.Collections.Generic;

namespace APLib;

public sealed class ArchipelagoGameData
{
	public string Name { get; internal set; }
	
	public IReadOnlyDictionary<long, string> Items => InternalItems;
	
	public IReadOnlyDictionary<long, string> Locations => InternalLocations;
	
	internal readonly Dictionary<long, string> InternalItems = [];
	
	internal readonly Dictionary<long, string> InternalLocations = [];
	
	public string GetItemName( long id )
	{
		return InternalItems.TryGetValue( id, out var name ) ? name : $"Item {id}";
	}
	
	public string GetLocationName( long id )
	{
		return InternalLocations.TryGetValue( id, out var name ) ? name : $"Location {id}";
	}
}