using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Security.Cryptography; using System.Threading; using Questionable.Model.IO; using Questionable.Model.Questing; namespace Questionable.QuestPaths; internal static class AssemblyQuestLoader { private static readonly Lazy> Quests = new Lazy>(LoadQuests, LazyThreadSafetyMode.ExecutionAndPublication); internal static TimeSpan? DecodeDuration { get; private set; } internal static Stream QuestSchema => typeof(AssemblyQuestLoader).Assembly.GetManifestResourceStream("Questionable.QuestPaths.QuestSchema"); internal static IReadOnlyDictionary GetQuests() { return Quests.Value; } internal static string? GetQuestPath(ElementId questId) { return null; } private static IReadOnlyDictionary LoadQuests() { Stopwatch stopwatch = Stopwatch.StartNew(); using Stream stream = typeof(AssemblyQuestLoader).Assembly.GetManifestResourceStream("Questionable.QuestPaths.QuestBundle"); byte[] array = PathBundleSecret.Key(); List> list = PathBundle.Deserialize(stream, array); CryptographicOperations.ZeroMemory(array); Dictionary dictionary = new Dictionary(list.Count); foreach (var (value, value2) in list) { dictionary[ElementId.FromString(value)] = value2; } DecodeDuration = stopwatch.Elapsed; return dictionary; } }