}\r
\r
/// <summary>\r
+ /// 拡張した編成記録枠にすぐに記録してもエラーにならない\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void PresetExpand()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "preset_002");\r
+ }\r
+\r
+ /// <summary>\r
/// 装備の交換を正しく反映する\r
/// </summary>\r
[TestMethod]\r
-Subproject commit 90e2e0497ca3149b3f385fd41f04dd4d7bef590e
+Subproject commit dcc1717edd28e4eaf4bd2f30406f1748e961721e
{\r
private readonly ShipInfo _shipInfo;\r
private readonly DockInfo _dockInfo;\r
+ private readonly PresetDeck _presetDeck;\r
private readonly RepairStatus[] _repairStatuses = new RepairStatus[ShipInfo.FleetCount];\r
private DateTime _start;\r
private DateTime _prev;\r
public string Completed { get; set; }\r
}\r
\r
- public AkashiTimer(ShipInfo ship, DockInfo dock)\r
+ public AkashiTimer(ShipInfo ship, DockInfo dock, PresetDeck preset)\r
{\r
_shipInfo = ship;\r
_dockInfo = dock;\r
+ _presetDeck = preset;\r
for (var i = 0; i < _repairStatuses.Length; i++)\r
_repairStatuses[i] = new RepairStatus();\r
}\r
public bool CheckReparing() => Enumerable.Range(0, ShipInfo.FleetCount).Any(CheckReparing);\r
\r
public bool CheckPresetReparing()\r
- => _shipInfo.PresetDeck.Where(deck => deck != null)\r
+ => _presetDeck.Decks.Where(deck => deck != null)\r
.Any(deck => RepairTarget(deck).Any(s => s.NowHp < s.MaxHp));\r
\r
public Notice[] GetNotice()\r
<Compile Include="MaterialInfo.cs" />\r
<Compile Include="MiscTextInfo.cs" />\r
<Compile Include="MissingData.cs" />\r
+ <Compile Include="PresetDeck.cs" />\r
<Compile Include="ShipLabels.cs" />\r
<Compile Include="ListForm.cs">\r
<SubType>Form</SubType>\r
--- /dev/null
+// Copyright (C) 2016 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the "License");\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+\r
+using System.Collections.Generic;\r
+using System.Linq;\r
+\r
+namespace KancolleSniffer\r
+{\r
+ public class PresetDeck\r
+ {\r
+ private readonly Dictionary<int, int[]> _presetDeck = new Dictionary<int, int[]>();\r
+\r
+ public void Inspect(dynamic json)\r
+ {\r
+ foreach (KeyValuePair<string, dynamic> entry in json.api_deck)\r
+ InspectRegister(entry.Value);\r
+ }\r
+\r
+ public void InspectRegister(dynamic json)\r
+ {\r
+ var no = (int)json.api_preset_no - 1;\r
+ _presetDeck[no] = json.api_ship;\r
+ }\r
+\r
+ public void InspectDelete(string request)\r
+ {\r
+ var values = HttpUtility.ParseQueryString(request);\r
+ _presetDeck[int.Parse(values["api_preset_no"]) - 1] = null;\r
+ }\r
+\r
+ public int[][] Decks => _presetDeck.Values.ToArray();\r
+ }\r
+}
\ No newline at end of file
private int _hqLevel;\r
private readonly List<int> _escapedShips = new List<int>();\r
private int _combinedFleetType;\r
- private int[][] _presetDeck = new int[0][];\r
\r
public ShipInfo(ItemInfo itemInfo)\r
{\r
_shipInfo.Remove(ship);\r
}\r
\r
- public void InspectPresetDeck(dynamic json)\r
- {\r
- _presetDeck = new int[(int)json.api_max_num][];\r
- foreach (KeyValuePair<string, dynamic> entry in json.api_deck)\r
- InspectPresetRegister(entry.Value);\r
- }\r
-\r
- public void InspectPresetRegister(dynamic json)\r
- {\r
- var no = (int)json.api_preset_no - 1;\r
- _presetDeck[no] = json.api_ship;\r
- }\r
-\r
- public void InspectPresetDelete(string request)\r
- {\r
- var values = HttpUtility.ParseQueryString(request);\r
- _presetDeck[int.Parse(values["api_preset_no"]) - 1] = null;\r
- }\r
-\r
public void InspectCombined(string request)\r
{\r
var values = HttpUtility.ParseQueryString(request);\r
_combinedFleetType = int.Parse(values["api_combined_type"]);\r
}\r
\r
- public int[][] PresetDeck => _presetDeck;\r
-\r
public void InspectMapStart(string request)\r
{\r
var values = HttpUtility.ParseQueryString(request);\r
private readonly ExMapInfo _exMapInfo = new ExMapInfo();\r
private readonly MiscTextInfo _miscTextInfo = new MiscTextInfo();\r
private readonly BaseAirCoprs _baseAirCoprs;\r
+ private readonly PresetDeck _presetDeck = new PresetDeck();\r
private readonly Status _status = new Status();\r
private bool _saveState;\r
private readonly List<IHaveState> _haveState;\r
_shipInfo = new ShipInfo(_itemInfo);\r
_conditionTimer = new ConditionTimer(_shipInfo);\r
_dockInfo = new DockInfo(_shipInfo, _materialInfo);\r
- _akashiTimer = new AkashiTimer(_shipInfo, _dockInfo);\r
+ _akashiTimer = new AkashiTimer(_shipInfo, _dockInfo, _presetDeck);\r
_battleInfo = new BattleInfo(_shipInfo, _itemInfo);\r
_logger = new Logger(_shipInfo, _itemInfo, _battleInfo);\r
_baseAirCoprs = new BaseAirCoprs(_itemInfo);\r
}\r
if (url.EndsWith("api_get_member/preset_deck"))\r
{\r
- _shipInfo.InspectPresetDeck(data);\r
+ _presetDeck.Inspect(data);\r
return Update.None;\r
}\r
if (url.EndsWith("api_get_member/base_air_corps"))\r
}\r
if (url.EndsWith("api_req_hensei/preset_register"))\r
{\r
- _shipInfo.InspectPresetRegister(data);\r
+ _presetDeck.InspectRegister(data);\r
return Update.None;\r
}\r
if (url.EndsWith("api_req_hensei/preset_delete"))\r
{\r
- _shipInfo.InspectPresetDelete(request);\r
+ _presetDeck.InspectDelete(request);\r
return Update.Timer;\r
}\r
if (url.EndsWith("api_req_hensei/combined"))\r