1 // Copyright (C) 2013 Kazuhiro Fujieda <fujieda@users.sourceforge.jp>
\r
3 // This program is part of KancolleSniffer.
\r
5 // KancolleSniffer is free software: you can redistribute it and/or modify
\r
6 // it under the terms of the GNU General Public License as published by
\r
7 // the Free Software Foundation, either version 3 of the License, or
\r
8 // (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, see <http://www.gnu.org/licenses/>.
\r
18 using System.Collections.Generic;
\r
20 namespace KancolleSniffer
\r
22 public class MissionInfo
\r
24 private readonly Dictionary<int, string> _missionNames = new Dictionary<int, string>();
\r
25 private readonly NameAndTimer[] _missions = new NameAndTimer[3];
\r
27 public MissionInfo()
\r
29 for (var i = 0; i < _missions.Length; i++)
\r
30 _missions[i] = new NameAndTimer();
\r
33 public void InspectMaster(dynamic json)
\r
35 foreach (var entry in json)
\r
36 _missionNames[(int)entry.api_id] = (string)entry.api_name;
\r
39 public void InspectDeck(dynamic json)
\r
41 foreach (var entry in json)
\r
43 var id = (int)entry.api_id;
\r
47 var mission = entry.api_mission;
\r
48 if (mission[0] == 0)
\r
50 _missions[id].Name = "";
\r
51 _missions[id].Timer.SetEndTime(0);
\r
55 _missions[id].Name = _missionNames.TryGetValue((int)mission[1], out name) ? name : "不明";
\r
56 _missions[id].Timer.SetEndTime(mission[2]);
\r
60 public NameAndTimer[] Missions
\r
62 get { return _missions; }
\r