diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2019-05-05 12:38:09 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2019-05-06 10:43:37 +0900 |
commit | 2496dee5430d1a258adcc55c47fc2adfb84109c7 (patch) | |
tree | d0b6a56d25d42c0cf551ff910acaa3f55c92a901 /WarframeClock/WfcdWorldStateData.cs | |
parent | 43027ad475524194e6b3929d4db3378ef3c8d537 (diff) | |
download | wf-clock-2496dee5430d1a258adcc55c47fc2adfb84109c7.tar.gz |
add Arbitration and Kuva Flood trackers
They can be turned on or off from the settings window.
Diffstat (limited to 'WarframeClock/WfcdWorldStateData.cs')
-rw-r--r-- | WarframeClock/WfcdWorldStateData.cs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/WarframeClock/WfcdWorldStateData.cs b/WarframeClock/WfcdWorldStateData.cs new file mode 100644 index 0000000..f0175a2 --- /dev/null +++ b/WarframeClock/WfcdWorldStateData.cs @@ -0,0 +1,44 @@ +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<string, SolNode> SolNodes; + + static WfcdWorldStateData() + { + var settings = new DataContractJsonSerializerSettings + { + UseSimpleDictionaryFormat = true + }; + var serializer = new DataContractJsonSerializer(typeof(Dictionary<string, SolNode>), settings); + using (var io = new MemoryStream(Resources.solNodes)) + SolNodes = (Dictionary<string, SolNode>)serializer.ReadObject(io); + } + + public static SolNode GetSolNode(string solNodeName) => SolNodes[solNodeName]; + } +} |