]> git.localhorst.tv Git - alttp.git/blob - app/Console/Commands/BeatPatchCommand.php
chat adlib prototype
[alttp.git] / app / Console / Commands / BeatPatchCommand.php
1 <?php
2
3 namespace App\Console\Commands;
4
5 use App\Beat\Decoder;
6 use Illuminate\Console\Command;
7
8 class BeatPatchCommand extends Command
9 {
10         /**
11          * The name and signature of the console command.
12          *
13          * @var string
14          */
15         protected $signature = 'beat:patch {source} {patch} {target}';
16
17         /**
18          * The console command description.
19          *
20          * @var string
21          */
22         protected $description = 'Apply BPS patch';
23
24         /**
25          * Execute the console command.
26          *
27          * @return int
28          */
29         public function handle()
30         {
31                 $source = file_get_contents($this->argument('source'));
32                 $patch = file_get_contents($this->argument('patch'));
33                 $decoder = new Decoder($source);
34                 $target = $decoder->applyPatch($patch);
35                 file_put_contents($this->argument('target'), $target);
36                 return 0;
37         }
38 }