using AssortGenerator.Models.Input; using AssortGenerator.Models.Other; using AssortGenerator.Models.Output;using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.Json; namespace AssortGenerator.Common.Helpers { public static class PresetHelper { private static Dictionary _presetData; public static List GetDefaultPreset(string tpl) { if (_presetData == null) { var questFilePath = InputFileHelper.GetInputFilePaths().FirstOrDefault(x => x.Contains("globals")); var questDataJson = File.ReadAllText(questFilePath); _presetData = JsonSerializer.Deserialize(questDataJson).ItemPresets; } return _presetData.FirstOrDefault(x => x.Value._encyclopedia == tpl).Value?._items; } } } public class Globals { public Dictionary ItemPresets { get; set; } } public class GlobalPreset { public string _encyclopedia { get; set; } public List _items { get; set; } }