<?php
$fileName = './chatfile.txt';
function yieldFile($fileName)
{
if (!$fileHandle = fopen($fileName, 'r'))
return;
while (FALSE !== $line = fgets($fileHandle))
yield $line;
fclose($fileHandle);
}
$lines = [];
foreach (yieldFile($fileName) as $line)
{
if (!isset($lines[$line]))
$lines[$line] = 1;
else
++$lines[$line];
}
foreach ($lines as $text => $times)
{
if ($times == 1)
echo trim($text) . PHP_EOL;
else
echo trim($text) . " (x{$times})" . PHP_EOL;
}
?>
php logFileParser.php > logFileCondensed.txt
Apr 09 05:26:20 LFS : 0.6H
Apr 09 05:26:35 Can't open : WE_ADS2.jpg (x5)
Apr 09 05:26:36 Can't open : WE_ADS1.jpg (x6)
Apr 09 05:26:36 Can't open : WE_ADS2.jpg (x9)
Apr 09 05:26:37 Can't open : WE_ADS1.jpg (x3)
Apr 09 05:26:38 Can't open : WE_ADS1.jpg (x9)
Apr 09 05:26:39 Can't open : WE_ADS1.jpg (x8)
Apr 09 05:26:40 Can't open : WE_ADS1.jpg (x9)
Apr 09 05:26:41 Can't open : WE_ADS1.jpg (x9)
Apr 09 05:26:42 Can't open : WE_ADS1.jpg (x8)
Apr 09 05:26:43 Can't open : WE_ADS1.jpg (x9)
Apr 09 05:26:44 Can't open : WE_ADS1.jpg (x8)
Apr 09 05:26:45 Can't open : WE_ADS1.jpg (x7)
Apr 09 05:26:45 Can't open : WE_ADS3.jpg (x15)
Apr 09 05:26:46 Can't open : WE_ADS3.jpg (x62)
Apr 09 05:26:47 Can't open : WE_ADS3.jpg (x62)
Apr 09 05:26:48 Can't open : WE_ADS3.jpg (x60)
Apr 09 05:26:49 Can't open : WE_ADS3.jpg (x46)
Apr 09 05:26:49 Can't open : WE_ADS1.jpg (x2)
Apr 09 05:26:50 Can't open : WE_ADS1.jpg (x8)
Apr 09 05:26:51 Can't open : WE_ADS1.jpg (x8)
Apr 09 05:26:52 Next LOD
Apr 09 05:26:52 Can't open : WE_ADS1.jpg
Apr 09 05:26:53 Can't open : WE_ADS1.jpg (x9)
Apr 09 05:26:54 Can't open : WE_ADS1.jpg (x10)
Apr 09 05:26:55 Can't open : WE_ADS1.jpg (x9)
Apr 09 05:26:55 Can't open : WE_ADS3.jpg (x2)
Apr 09 05:26:56 Can't open : WE_ADS3.jpg (x62)
Apr 09 05:26:57 Can't open : WE_ADS3.jpg (x64)
Apr 09 05:26:58 Can't open : WE_ADS3.jpg (x63)
Apr 09 05:26:59 Can't open : WE_ADS3.jpg (x54)
Apr 09 05:26:59 Can't open : WE_ADS1.jpg
Apr 09 05:27:00 Can't open : WE_ADS1.jpg (x9)
Apr 09 05:27:01 Can't open : WE_ADS1.jpg (x9)
Apr 09 05:27:02 Can't open : WE_ADS1.jpg (x9)
Apr 09 05:27:03 Can't open : WE_ADS1.jpg (x9)
Apr 09 05:27:04 Can't open : WE_ADS1.jpg (x9)
Apr 09 05:27:05 Can't open : WE_ADS1.jpg (x9)
Apr 09 05:27:06 Can't open : WE_ADS1.jpg (x4)
Apr 09 05:27:06 Next LOD (x2)
Apr 09 05:27:06 Meshes : 52
Apr 09 05:27:22 Could not compile pixel shader (Car1) D3DXERR_INVALIDDATA
Apr 09 05:27:22 :41:26: error: syntax error, unexpected KW_REGISTER, expecting VAR_IDENTIFIER or TYPE_IDENTIFIER or NEW_IDENTIFIER
Apr 09 05:27:22 (x2)
Apr 09 05:27:22 Could not compile vertex shader (Car1) D3DXERR_INVALIDDATA
Apr 09 05:27:22 :44:34: error: syntax error, unexpected KW_REGISTER, expecting VAR_IDENTIFIER or TYPE_IDENTIFIER or NEW_IDENTIFIER
Apr 09 05:27:22 > Welcome to our server, enjoy your stay!
Apr 09 05:27:32 Next LOD (x3)
Apr 09 05:27:32 Meshes : 55
Apr 09 05:28:35 shutting down
Apr 09 05:28:35 free objects
Apr 09 05:28:35 free languages
Apr 09 05:28:35 free controllers
Apr 09 05:28:35 clear light map
Apr 09 05:28:35 close sound
Apr 09 05:28:35 close rift
Apr 09 05:28:35 free humans
Apr 09 05:28:35 free font
Apr 09 05:28:35 free helmet
Apr 09 05:28:35 kill graphics
Apr 09 05:28:36 save calibrations
Apr 09 05:28:36 save controls
Apr 09 05:28:36 save views
Apr 09 05:28:36 save config
Apr 09 05:28:36 free mouse
Apr 09 05:28:36 EXIT
Could not create texture WSTfloodL1
Can't open : WSTfloodL1
Could not create texture ambulance
Can't open ambulance
Could not create texture FFoffwall
Can't open : FFoffwall1
...
Can't open : WE_ADS1.jpg (A lot)
...
Can't open : WE_ADS2.jpg (A lot)
...
Can't open : WE_ADS3.jpg (A lot)
...
Note: Importing rules are per file basis, meaning included files will NOT inherit the parent file's importing rules.
<?php
use modules\lfs\insim;
use modules\websockets;
class Multiplexing
{
const URL = 'http://lfsforum.net/forumdisplay.php?f=312';
const NAME = 'Multiplexing Example';
const AUTHOR = 'PRISM Dev Team';
const VERSION = PHPInSimMod::VERSION;
const DESCRIPTION = 'WebSockets and LFS InSim Connections Multiplexing';
public function __construct()
{
$this->registerPacket('onNewPlayer', ISP::NPL);
$this->registerPacket('onPlayerLeave', ISP::PLL);
}
public function onNewPlayer(ISP_NPL $NPL)
{
$this->webSocket(json_encode($NPL));
}
public function onPlayerLeave(ISP_PLL $PLL)
{
$this->webSocket(json_encode($PLL));
}
}
?>
if (Index >= AXO_CONCRETE_SLAB && Index <= AXO_CONCRETE_RAMP_WALL)
{
// Concrete objects - always floating regardless of 0x80 bit
// Flags byte contains various attributes depending on the object
// Each concrete object has three attributes
Attributes:
name bits values
Width : 0x03 >> 0 : 2, 4, 8, 16
Length : 0x0c >> 2 : 2, 4, 8, 16
Size X : 0x03 >> 0 : 0.25, 0.5, 0.75, 1
Size Y : 0x0c >> 2 : 0.25, 0.5, 0.75, 1
Height : 0xf0 >> 4 : 0.25 to 4 in steps of 0.25
Pitch : 0xf0 >> 4 : 0 to 90 in steps of 6 degrees
Colour : 0x03 >> 0 : grey / red / blue / yellow
Attributes used by each object:
AXO_CONCRETE_SLAB : Width / Length / Pitch
AXO_CONCRETE_RAMP : Width / Length / Height
AXO_CONCRETE_WALL : Colour / Length / Height
AXO_CONCRETE_PILLAR : Size X / Size Y / Height
AXO_CONCRETE_SLAB_WALL : Colour / Length / Pitch
AXO_CONCRETE_RAMP_WALL : Colour / Length / Height
}
<?php
private function concrete_parse($index, $bits)
{
switch($index)
{
case AXO_CONCRETE_SLAB:
$name = 'Width/Length/Pitch';
break;
case AXO_CONCRETE_RAMP:
$name = 'Width/Length/Height';
break;
case AXO_CONCRETE_WALL:
$name = 'Color/Length/Height';
break;
case AXO_CONCRETE_PILLAR:
$name = 'SizeX/SizeY/Pitch';
break;
case AXO_CONCRETE_SLAB_WALL:
$name = 'Colour/Length/Pitch';
break;
case AXO_CONCRETE_RAMP_WALL:
$name = 'Colour/Length/Height';
break;
default:
// No idea why we would get here.
break;
}
foreach (explode('/', $name) as $name)
$packet[$name] = self::concret_bits($name, $bits);
}
private function concrete_bits($name, $bits)
{
switch ($name)
{ // Some of these will not return the correct value yet.
case 'Width':
return $bits & 0x03 >> 0; # 2, 4, 8, 16
case 'Length':
return $bits & 0x0c >> 2; # 2, 4, 8, 16
case 'SizeX':
return $bits & 0x03 >> 0; # 0.25, 0.5, 0.75, 1
case 'SizeY':
return $bits & 0x0c >> 2; # 0.25, 0.5, 0.75, 1
case 'Height':
return $bits & 0xf0 >> 4; # 0.25 to 4 in steps of 0.25
case 'Pitch':
return $bits & 0xf0 >> 4; # 0 to 90 in steps of 6 degrees
case 'Colour':
return $bits & 0x03 >> 0; # grey / red / blue / yellow
}
}
?>