Questionable/GatheringPaths/AssemblyGatheringLocationLoader.cs
2024-08-02 20:04:59 +02:00

31 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using Questionable.Model.Gathering;
namespace Questionable.GatheringPaths;
[SuppressMessage("ReSharper", "PartialTypeWithSinglePart", Justification = "Required for RELEASE")]
public static partial class AssemblyGatheringLocationLoader
{
private static Dictionary<ushort, GatheringRoot>? _locations;
public static IReadOnlyDictionary<ushort, GatheringRoot> GetLocations()
{
if (_locations == null)
{
_locations = [];
LoadLocations();
}
return _locations ?? throw new InvalidOperationException("location data is not initialized");
}
public static Stream QuestSchema =>
typeof(AssemblyGatheringLocationLoader).Assembly.GetManifestResourceStream("Questionable.GatheringPaths.GatheringLocationSchema")!;
[SuppressMessage("ReSharper", "UnusedMember.Local")]
private static void AddLocation(ushort questId, GatheringRoot root) => _locations![questId] = root;
}