forked from hmoog/riot-decode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
indexer.php
66 lines (55 loc) · 1.44 KB
/
indexer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
use riotDecode\raf\ExtractedRiotArchiveFileEntry;
// setup php environment
ini_set("memory_limit","512M");
set_time_limit(0);
spl_autoload_register();
$start_time = microtime(true);
// create game folder object
//$gameFolder = new \riotDecode\GameFolder('D:\\9_Perso\\jeux\\Riot\\League of Legends\\');
$gameFolder = 'D:\\9_Perso\\LOL\\GlobalDumped';
$p = null;
$dir = $gameFolder;
if (isset($_REQUEST["current"]))
{
$p = $_REQUEST["current"];
$dir = $gameFolder. DIRECTORY_SEPARATOR . $p;
}
$indexed = array();
$count = 0;
function indexDir(&$count, &$indexed, $dir)
{
if (is_dir($dir))
{
$cdir = scandir($dir);
foreach ($cdir as $key => $value)
{
if (!in_array($value,array(".","..")))
{
indexDir($count, $indexed, $dir . DIRECTORY_SEPARATOR . $value);
}
}
}
else
{
$gameFile = new ExtractedRiotArchiveFileEntry(null, $dir, 0, 0, null);
$decodedFile = $gameFile->decode();
if ($decodedFile instanceof \riotDecode\common\BaseFile)
{
if ($decodedFile->isIndexable())
{
echo "indexing : " . $dir . "<br>";
$indexed[$dir] = $decodedFile->getValues();
$count++;
}
}
}
}
echo("ROOT :". $dir . "<br><br>");
indexDir($count, $indexed, $dir);
echo("INDEXING DONE<br><br>");
$file=fopen("riotDecode/_private/indexed",'w');
fwrite($file, serialize($indexed));
fclose($file);
?>
This index was builded in <?php echo(number_format(microtime(true) - $start_time, 2)); ?> seconds / <?php echo($count); ?> Files