| @@ 151-212 (lines=62) @@ | ||
| 148 | $this->info('Fertig.'); |
|
| 149 | } |
|
| 150 | ||
| 151 | public function search_for_base_path($filepath) |
|
| 152 | { |
|
| 153 | $dirarray = [ |
|
| 154 | 'backdrop', |
|
| 155 | 'battle', |
|
| 156 | 'battle2', |
|
| 157 | 'battlecharset', |
|
| 158 | 'battleweapon', |
|
| 159 | 'charset', |
|
| 160 | 'chipset', |
|
| 161 | 'faceset', |
|
| 162 | 'frame', |
|
| 163 | 'gameover', |
|
| 164 | 'monster', |
|
| 165 | 'panorama', |
|
| 166 | 'picture', |
|
| 167 | 'system', |
|
| 168 | 'system2', |
|
| 169 | 'title', |
|
| 170 | 'music', |
|
| 171 | 'sound', |
|
| 172 | ]; |
|
| 173 | ||
| 174 | $rootarray = [ |
|
| 175 | 'harmony.dll', |
|
| 176 | 'rpg_rt.exe', |
|
| 177 | 'rpg_rt.ini', |
|
| 178 | 'rpg_rt.ldb', |
|
| 179 | 'rpg_rt.lmt', |
|
| 180 | 'rpg_rt.dat', |
|
| 181 | ]; |
|
| 182 | ||
| 183 | $mapparray = []; |
|
| 184 | for ($i = 0; $i < 2000; $i++) { |
|
| 185 | $mapparray[] = 'map'.sprintf('%04d', $i).'.lmu'; |
|
| 186 | } |
|
| 187 | ||
| 188 | $filearray = array_merge($rootarray, $mapparray); |
|
| 189 | ||
| 190 | $searcharray = array_merge($dirarray, $filearray); |
|
| 191 | ||
| 192 | if (starts_with(strtolower($filepath), $searcharray)) { |
|
| 193 | $imp = str_replace('/', '\\/', $filepath); |
|
| 194 | } else { |
|
| 195 | if (str_contains(strtolower($filepath), $searcharray)) { |
|
| 196 | $exp = explode('/', $filepath); |
|
| 197 | $res = array_shift($exp); |
|
| 198 | $imp = implode('/', $exp); |
|
| 199 | $imp = $this->search_for_base_path($imp); |
|
| 200 | } else { |
|
| 201 | $imp = ''; |
|
| 202 | } |
|
| 203 | } |
|
| 204 | ||
| 205 | if ($imp != '') { |
|
| 206 | if (array_search(strtolower($imp), $filearray)) { |
|
| 207 | $imp = '.\\/'.$imp; |
|
| 208 | } |
|
| 209 | } |
|
| 210 | ||
| 211 | return $imp; |
|
| 212 | } |
|
| 213 | } |
|
| 214 | ||
| @@ 30-91 (lines=62) @@ | ||
| 27 | } |
|
| 28 | } |
|
| 29 | ||
| 30 | public function getZipRootPath($zipfilepath) |
|
| 31 | { |
|
| 32 | $dirarray = [ |
|
| 33 | 'backdrop', |
|
| 34 | 'battle', |
|
| 35 | 'battle2', |
|
| 36 | 'battlecharset', |
|
| 37 | 'battleweapon', |
|
| 38 | 'charset', |
|
| 39 | 'chipset', |
|
| 40 | 'faceset', |
|
| 41 | 'frame', |
|
| 42 | 'gameover', |
|
| 43 | 'monster', |
|
| 44 | 'panorama', |
|
| 45 | 'picture', |
|
| 46 | 'system', |
|
| 47 | 'system2', |
|
| 48 | 'title', |
|
| 49 | 'music', |
|
| 50 | 'sound', |
|
| 51 | ]; |
|
| 52 | ||
| 53 | $rootarray = [ |
|
| 54 | 'harmony.dll', |
|
| 55 | 'rpg_rt.exe', |
|
| 56 | 'rpg_rt.ini', |
|
| 57 | 'rpg_rt.ldb', |
|
| 58 | 'rpg_rt.lmt', |
|
| 59 | 'rpg_rt.dat', |
|
| 60 | ]; |
|
| 61 | ||
| 62 | $mapparray = []; |
|
| 63 | for ($i = 0; $i < 2000; $i++) { |
|
| 64 | $mapparray[] = 'map'.sprintf('%04d', $i).'.lmu'; |
|
| 65 | } |
|
| 66 | ||
| 67 | $filearray = array_merge($rootarray, $mapparray); |
|
| 68 | ||
| 69 | $searcharray = array_merge($dirarray, $filearray); |
|
| 70 | ||
| 71 | if (starts_with(strtolower($zipfilepath), $searcharray)) { |
|
| 72 | $imp = str_replace('/', '\\/', $zipfilepath); |
|
| 73 | } else { |
|
| 74 | if (str_contains(strtolower($zipfilepath), $searcharray)) { |
|
| 75 | $exp = explode('/', $zipfilepath); |
|
| 76 | $res = array_shift($exp); |
|
| 77 | $imp = implode('/', $exp); |
|
| 78 | $imp = $this->getZipRootPath($imp); |
|
| 79 | } else { |
|
| 80 | $imp = ''; |
|
| 81 | } |
|
| 82 | } |
|
| 83 | ||
| 84 | if ($imp != '') { |
|
| 85 | if (array_search(strtolower($imp), $filearray)) { |
|
| 86 | $imp = '.\\/'.$imp; |
|
| 87 | } |
|
| 88 | } |
|
| 89 | ||
| 90 | return $imp; |
|
| 91 | } |
|
| 92 | } |
|
| 93 | ||