blob: b9cd337fb90b033f065a802e0ee467ef63ae93f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#!/usr/bin/perl
my ($section, %data);
#read in all the data, split it up into hashes. Thanks again to malte for much input
while (<>) {
if (/\[(.*)\]/) {
$sections{$section} = {%data} if $section;
$section = $1;
undef %data;
next;
}
$data{$1} = $2 if /^([^=]*)=(.*)$/;
}
$sections{$section} = {%data} if $section;
# not used up to now
# $version = $sections{'General'}->{'Version'};
# if "Action description" is not available, we have a new, fresh configuration
# without any need for conversion.
if ( ! $sections{'Action_0'}->{'Action description'} ) {
exit;
}
$numActions = $sections{'General'}->{'Number of Actions'};
for my $i (0..($numActions - 1)) {
my $actionGroup = "Action_$i";
my $numCommands = $sections{$actionGroup}->{'Number of commands'};
print "[$actionGroup]\n";
# rename some keys
print "Description=$sections{$actionGroup}->{'Action description'}\n";
print "Regexp=$sections{$actionGroup}->{'Action regexp'}\n";
print "Number of commands=$numCommands\n";
# move the command entries from "Action_x" to "Action_x/Command_y"
for my $k (0..($numCommands - 1)) {
my $command = "Command_$k";
my $commandGroup = "$actionGroup/$command";
print "\n[$commandGroup]\n";
my $value = $sections{$actionGroup}->{"$command: commandline"};
print "Commandline=$value\n";
$value = $sections{$actionGroup}->{"$command: description"};
print "Description=$value\n";
$value = $sections{$actionGroup}->{"$command: enabled"};
print "Enabled=$value\n";
}
print "\n";
}
©Section( "General" );
©Section( "Global Keys" );
sub copySection()
{
my ($group) = @_;
print "\n[$group]\n";
while (($key,$value) = each(%{$sections{$group}})) {
print "$key=$value\n";
}
}
|