OSDN Git Service

エラーメッセージのword wrapを止める
[kancollesniffer/KancolleSniffer.git] / KancolleSniffer / MissingData.cs
1 // Copyright (C) 2015 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
2 //\r
3 // This program is part of KancolleSniffer.\r
4 //\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
9 //\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
14 //\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
17 \r
18 using System;\r
19 using System.Collections.Generic;\r
20 using System.IO;\r
21 using System.Linq;\r
22 \r
23 namespace KancolleSniffer\r
24 {\r
25     internal class MissingData\r
26     {\r
27         private static readonly string EnemySlotFile =\r
28             Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "EnemySlot.csv");\r
29 \r
30         private static Dictionary<int, int[]> _maxEq;\r
31 \r
32         public static Dictionary<int, int[]> MaxEq\r
33         {\r
34             get\r
35             {\r
36                 if (_maxEq != null)\r
37                     return _maxEq;\r
38                 _maxEq = new Dictionary<int, int[]>();\r
39                 try\r
40                 {\r
41                     foreach (var line in File.ReadLines(EnemySlotFile))\r
42                     {\r
43                         int num;\r
44                         var entry = line.Split(',').Select(e => int.TryParse(e, out num) ? num : 0).ToArray();\r
45                         _maxEq[entry[0]] = entry.Skip(1).ToArray();\r
46                     }\r
47                 }\r
48                 catch (FileNotFoundException)\r
49                 {\r
50                 }\r
51                 return _maxEq;\r
52             }\r
53         }\r
54     }\r
55 }