#!/usr/bin/perl

# convert an ASCII dpr file into a StateFile World (Version 1) file

# 1. Open TXT File
# 4. Convert TXT data to .DPR format

use Term::ANSIColor qw(:constants);

my $txtFile = shift @ARGV;
my $dprFile = shift @ARGV;

open ( TXTFILE, $txtFile );
open ( DPRFILE, $dprFile );

my $line = "";
my @path = split(/\//, $infile);
my $file = @path[-1];

print RED, "DPRSim: ", RESET;
print "Converting TXT data ($txtFile) to DPR file...\n";

my $guid = 1;

while ($line=<TXTFILE>) {
    chomp ( $line );
    
    my $newline = "$guid,$line,255,0,0,0";
    chomp($newline);
    system("echo '$newline' >> $dprFile");
    $guid++;
}

close TXTFILE;

print RED, "DPRSim: ", RESET;
print "Complete.\n";
