using System.Collections.Generic; using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; using System.Text.RegularExpressions; using WarframeClock.Properties; namespace WarframeClock { public static class WfcdWorldStateData { [DataContract] public class SolNode { [DataMember(Name = "value")] public string Location { get; private set; } [DataMember(Name = "enemy")] public string Faction { get; private set; } [DataMember(Name = "type")] public string MissionType { get; private set; } public string LocationCompact => Regex.Replace(Location, @"^(.+) \((.+)\)$", @"$2/$1"); private SolNode() { } } private static readonly Dictionary SolNodes; static WfcdWorldStateData() { var settings = new DataContractJsonSerializerSettings { UseSimpleDictionaryFormat = true }; var serializer = new DataContractJsonSerializer(typeof(Dictionary), settings); using (var io = new MemoryStream(Resources.solNodes)) SolNodes = (Dictionary)serializer.ReadObject(io); } public static SolNode GetSolNode(string solNodeName) => SolNodes[solNodeName]; } }