[TestMethod]\r
public void TransportPoint()\r
{\r
- ItemSpec.LoadTpSpec();\r
+ DataLoader.LoadTpSpec();\r
\r
var sniffer1 = new Sniffer();\r
SniffLogFile(sniffer1, "transportpoint_001");\r
\r
namespace KancolleSniffer\r
{\r
- public static class DataLoader\r
+ public static class DataLoader\r
{\r
private static readonly string EnemySlotFile =\r
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "EnemySlot.csv");\r
\r
public static int[] EnemySlot(int id) =>\r
_maxEq != null ? _maxEq.TryGetValue(id, out var slot) ? slot : null : null;\r
+\r
+\r
+ private static readonly string TpFile =\r
+ Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TP.csv");\r
+\r
+ private static Dictionary<int, double> _tpSpec;\r
+\r
+ public static void LoadTpSpec()\r
+ {\r
+ try\r
+ {\r
+ _tpSpec = File.ReadAllLines(TpFile)\r
+ .Select(line => line.Split(','))\r
+ .ToDictionary(f => int.Parse(f[0]), f => double.Parse(f[2]));\r
+ }\r
+ catch (IOException)\r
+ {\r
+ }\r
+ }\r
+\r
+ public static double ItemTp(int id) =>\r
+ _tpSpec != null ? _tpSpec.TryGetValue(id, out var tp) ? tp : -1 : -1;\r
}\r
}
\ No newline at end of file
}\r
}\r
\r
- private static Dictionary<int, double> _tpSpec;\r
-\r
- public static void LoadTpSpec()\r
- {\r
- try\r
- {\r
- _tpSpec = File.ReadAllLines(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TP.csv"))\r
- .Select(line => line.Split(','))\r
- .ToDictionary(f => int.Parse(f[0]), f => double.Parse(f[2]));\r
- }\r
- catch (IOException)\r
- {\r
- }\r
- }\r
-\r
public double TransportPoint\r
{\r
get\r
{\r
- if (_tpSpec != null && _tpSpec.TryGetValue(Id, out var tp))\r
+ var tp = DataLoader.ItemTp(Id);\r
+ if (tp >= 0)\r
return tp;\r
switch (Id)\r
{\r
{\r
var target = "";\r
_sniffer.LoadState();\r
- ItemSpec.LoadTpSpec();\r
+ DataLoader.LoadTpSpec();\r
_watcher.SynchronizingObject = this;\r
_watcherTimer.Tick += (sender, ev) =>\r
{\r
_sniffer.LoadState();\r
break;\r
case "TP.csv":\r
- ItemSpec.LoadTpSpec();\r
+ DataLoader.LoadTpSpec();\r
break;\r
}\r
};\r