Questionable/GatheringPaths/AssemblyGatheringLocationLoader.cs

31 lines
1.0 KiB
C#
Raw Permalink Normal View History

2024-08-02 16:30:21 +00:00
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();
}
2024-08-02 18:04:45 +00:00
return _locations ?? throw new InvalidOperationException("location data is not initialized");
2024-08-02 16:30:21 +00:00
}
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;
}