string, PKHeX line number(s)
| 84 | |
| 85 | // string, PKHeX line number(s) |
| 86 | std::vector<std::pair<std::string, std::vector<int>>> readFile(Lang l) |
| 87 | { |
| 88 | std::vector<std::pair<std::string, std::vector<int>>> ret; |
| 89 | |
| 90 | std::string pkhexName = "text_Forms_" + pkhexLangString(l) + ".txt"; |
| 91 | |
| 92 | std::ifstream in(pkhexName); |
| 93 | assert(!in.bad()); |
| 94 | |
| 95 | std::string tmp; |
| 96 | int line = 0; |
| 97 | while (std::getline(in, tmp)) |
| 98 | { |
| 99 | tmp = tmp.substr(0, tmp.find('\n')); |
| 100 | tmp = tmp.substr(0, tmp.find('\r')); |
| 101 | if (!tmp.empty()) |
| 102 | { |
| 103 | auto it = std::find_if(ret.begin(), ret.end(), [&tmp](auto v) { return v.first == tmp; }); |
| 104 | if (it != ret.end()) |
| 105 | { |
| 106 | it->second.emplace_back(line); |
| 107 | } |
| 108 | else |
| 109 | { |
| 110 | ret.emplace_back(tmp, std::vector<int>{{line}}); |
| 111 | } |
| 112 | } |
| 113 | line++; |
| 114 | } |
| 115 | |
| 116 | in.close(); |
| 117 | return ret; |
| 118 | } |
| 119 | |
| 120 | void writeFile(Lang l, const std::vector<std::pair<std::string, std::vector<int>>>& array) |
| 121 | { |