mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 16:34:23 -05:00
sqlite3.exe import cubemain working
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
session_start();
|
||||
/*
|
||||
GPLv2 (C) <2021> <HashCasper>
|
||||
|
||||
@@ -25,11 +24,12 @@ class D2Files {
|
||||
|
||||
public function __construct() {
|
||||
$filesToIgnore = [
|
||||
"AiParms.txt"
|
||||
"aiparms.txt",
|
||||
"cubemain.txt"
|
||||
];
|
||||
$glob = glob($_SESSION['path'].'*.txt');
|
||||
foreach ($glob as $g){
|
||||
$files[] = basename($g);
|
||||
$files[] = strtolower(basename($g));
|
||||
}
|
||||
$this->files = array_diff($files, $filesToIgnore);
|
||||
return $this->files;
|
||||
|
@@ -31,10 +31,7 @@ class D2TxtParser {
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
public function parseFile($file) {
|
||||
if ($file == "CubeMain.txt") {
|
||||
$this->processCubeMain($file);
|
||||
}
|
||||
public function parseFile($file) {
|
||||
return $this->parseData($file);
|
||||
}
|
||||
|
||||
@@ -52,19 +49,14 @@ class D2TxtParser {
|
||||
$file = $this->path . $file;
|
||||
$rows = array_map(function ($v) {
|
||||
return str_getcsv($v, "\t");
|
||||
}
|
||||
, file($file));
|
||||
$header = array_shift($rows);
|
||||
}, file($file));
|
||||
$header = array_shift($rows);
|
||||
$data = null;
|
||||
foreach ($rows as $row) {
|
||||
$data[] = @array_combine($header, $row);
|
||||
}
|
||||
unset($rows);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function processCubeMain($file){
|
||||
$path = dirname(getcwd()).DIRECTORY_SEPARATOR."bin".DIRECTORY_SEPARATOR;
|
||||
exec($path."sqlite3.exe ".$path.DB_FILE." '.separator \"t\"' '.import ".TXT_PATH."$file cubemain'");
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user