From a2113dbb1acf41dc5cb789231b1316a9de5e3ade Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 3 Oct 2015 09:35:29 +0200 Subject: declutter clientfiles/ --- clientfiles/make-csv.pl | 72 ---------------------- clientfiles/very-important-source-code/make-csv.pl | 72 ++++++++++++++++++++++ 2 files changed, 72 insertions(+), 72 deletions(-) delete mode 100644 clientfiles/make-csv.pl create mode 100644 clientfiles/very-important-source-code/make-csv.pl diff --git a/clientfiles/make-csv.pl b/clientfiles/make-csv.pl deleted file mode 100644 index ee60364e..00000000 --- a/clientfiles/make-csv.pl +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env perl - -use strict; -use List::Util qw'reduce'; - -sub get_games_1 { - my @games; - - open my $fd, "<", $ARGV[1] or die "open: $!"; - <$fd>; - - while (defined(my $line = <$fd>)) { - chomp $line; - if ($line !~ /^(\d+)\s+"([^"]+)"(?:\s+\(([0-9A-F]{16})\))?$/) { - warn "Broken line"; - next; - } - push @games, +{ id => $1, name => $2, key => defined $3 ? (sprintf "%04X", $1) . $3 . '00' : undef}; - } - - [@games]; -} - -sub get_games_2 { - open my $fd, "<", $ARGV[0] or die "open: $!"; - <$fd>; - my @games; - while (defined(my $line = <$fd>)) { - chomp $line; - my @line = split/;/, $line; - if (@line != 8) { - warn "Broken line"; - next; - } - my @cols = qw'no name proto since verified by id key'; - push @games, +{ map { $cols[$_] => $line[$_] } 0..$#cols }; - } - [@games]; -} - -sub merge { - my ($new_games, $old_games) = @_; - my $no = (reduce { $a->{no} > $b->{no} ? $a : $b } +{id=>0}, @$old_games)->{no} + 1; - my %game_hash = map { $_->{name} => $_ } @$old_games; - my %ids = map { $_->{id} => 1 } @$old_games; - for my $g (@$new_games) { - if (!exists $game_hash{$g->{name}} && !exists $ids{$g->{id}}) { - $game_hash{$g->{name}} = +{ - no => $no++, - name => $g->{name}, - proto => 'FreeTrack20', - since => (defined $g->{key} ? 'V170' : 'V160'), - verified => '', - by => '', - id => $g->{id}, - key => $g->{key} - }; - } - } - print "No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID\n"; - for (sort { lc($a->{name}) cmp lc($b->{name}) } values %game_hash) { - my $g = {%$_}; - if (!defined $g->{key}) { - $g->{key} = (sprintf "%04X", $g->{no}) . (join"", map { sprintf "%02X", int rand 256 } 0 .. 7) . '00'; - } - my @cols = qw'no name proto since verified by id key'; - print join";", map { $g->{$_} } @cols; - print "\n"; - } -} - -merge(get_games_1(), get_games_2()); diff --git a/clientfiles/very-important-source-code/make-csv.pl b/clientfiles/very-important-source-code/make-csv.pl new file mode 100644 index 00000000..ee60364e --- /dev/null +++ b/clientfiles/very-important-source-code/make-csv.pl @@ -0,0 +1,72 @@ +#!/usr/bin/env perl + +use strict; +use List::Util qw'reduce'; + +sub get_games_1 { + my @games; + + open my $fd, "<", $ARGV[1] or die "open: $!"; + <$fd>; + + while (defined(my $line = <$fd>)) { + chomp $line; + if ($line !~ /^(\d+)\s+"([^"]+)"(?:\s+\(([0-9A-F]{16})\))?$/) { + warn "Broken line"; + next; + } + push @games, +{ id => $1, name => $2, key => defined $3 ? (sprintf "%04X", $1) . $3 . '00' : undef}; + } + + [@games]; +} + +sub get_games_2 { + open my $fd, "<", $ARGV[0] or die "open: $!"; + <$fd>; + my @games; + while (defined(my $line = <$fd>)) { + chomp $line; + my @line = split/;/, $line; + if (@line != 8) { + warn "Broken line"; + next; + } + my @cols = qw'no name proto since verified by id key'; + push @games, +{ map { $cols[$_] => $line[$_] } 0..$#cols }; + } + [@games]; +} + +sub merge { + my ($new_games, $old_games) = @_; + my $no = (reduce { $a->{no} > $b->{no} ? $a : $b } +{id=>0}, @$old_games)->{no} + 1; + my %game_hash = map { $_->{name} => $_ } @$old_games; + my %ids = map { $_->{id} => 1 } @$old_games; + for my $g (@$new_games) { + if (!exists $game_hash{$g->{name}} && !exists $ids{$g->{id}}) { + $game_hash{$g->{name}} = +{ + no => $no++, + name => $g->{name}, + proto => 'FreeTrack20', + since => (defined $g->{key} ? 'V170' : 'V160'), + verified => '', + by => '', + id => $g->{id}, + key => $g->{key} + }; + } + } + print "No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID\n"; + for (sort { lc($a->{name}) cmp lc($b->{name}) } values %game_hash) { + my $g = {%$_}; + if (!defined $g->{key}) { + $g->{key} = (sprintf "%04X", $g->{no}) . (join"", map { sprintf "%02X", int rand 256 } 0 .. 7) . '00'; + } + my @cols = qw'no name proto since verified by id key'; + print join";", map { $g->{$_} } @cols; + print "\n"; + } +} + +merge(get_games_1(), get_games_2()); -- cgit v1.2.3