forked from SMUnlimited/AMAI
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathUninstallDir-Icon.pl
134 lines (117 loc) · 8.97 KB
/
UninstallDir-Icon.pl
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#! /usr/bin/perl5 -w
use strict;
eval {
print "Perl version: $]\n";
};
if ($@) {
print "ERROR: Failed to uninstall AMAI.";
die "Please install Perl as a requirement to uninstall AMAI. Download : https://strawberryperl.com/";
}
sub process_dir {
my $dirname = $_[0];
my $commander = $_[1];
my $filename;
opendir my $DIR, $dirname or die "Could not open $dirname\n";
while ($filename = readdir($DIR)) {
next if $filename eq "." || $filename eq "..";
if ((-d "$dirname/$filename") ) {
print "Uninstalling AMAI and Commander and Icon to dir $dirname\\$filename\n";
process_dir ("$dirname\\$filename", $commander);
} elsif ($filename =~ m/\.w3m$/ || $filename =~ m/\.w3x$/ ) {
print "Uninstalling AMAI and Commander and Icon to $dirname/$filename\n";
system "MPQEditor d \"$dirname/$filename\" Scripts\\common.ai";
if ($? == -1) {
printf "Unable to spawn MPQEditor process";
} elsif ($? >> 8 == 5) {
printf "ERROR: Failed to uninstall, you may not have valid permissions or are blocked by windows UAC. Ensure map files are not in a UAC protected location %d\n", $? >> 8;
} elsif ($? >> 8 == 2) {
# Already deleted file so ignore
} elsif ($? >> 8 > 0) {
printf "ERROR: Unknown. AMAI not have uninstalled correctly. delete :%d\n", $? >> 8;
}
system "MPQEditor d \"$dirname/$filename\" Scripts\\elf.ai";
system "MPQEditor d \"$dirname/$filename\" Scripts\\human.ai";
system "MPQEditor d \"$dirname/$filename\" Scripts\\orc.ai";
system "MPQEditor d \"$dirname/$filename\" Scripts\\undead.ai";
system "MPQEditor d \"$dirname/$filename\" Scripts\\elf2.ai";
system "MPQEditor d \"$dirname/$filename\" Scripts\\human2.ai";
system "MPQEditor d \"$dirname/$filename\" Scripts\\orc2.ai";
system "MPQEditor d \"$dirname/$filename\" Scripts\\undead2.ai";
system "MPQEditor d \"$dirname/$filename\" Scripts\\Blizzard.j";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIClawsOfAttack+3.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIClawsOfAttack+6.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIClawsOfAttack+9.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIClawsOfAttack+12.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIClawsOfAttack+15.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIRingGreen+1.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIRingGreen+2.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIRingGreen+3.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIRingGreen+4.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIRingGreen+5.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIClaw+4.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIClaw+5.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIClaw+8.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIClaw+9.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIClaw+12.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIClaw+15.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIRoP+3.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIRoP+4.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtons\\BTN_AMAIRoP+5.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIClawsOfAttack+3.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIClawsOfAttack+6.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIClawsOfAttack+9.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIClawsOfAttack+12.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIClawsOfAttack+15.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIRingGreen+1.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIRingGreen+2.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIRingGreen+3.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIRingGreen+4.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIRingGreen+5.blp";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIClaw+4.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIClaw+5.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIClaw+8.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIClaw+9.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIClaw+12.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIClaw+15.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIRoP+3.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIRoP+4.dds";
system "MPQEditor d \"$dirname/$filename\" ReplaceableTextures\\CommandButtonsDisabled\\DISBTN_AMAI_AMAIRoP+5.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-FountainLife.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-FountainLife.mdx";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-FountainMana.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-FountainMana.mdx";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-FountainPower.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-FountainPower.mdx";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\MiniMap-Gold.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-GragonRoost.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-GragonRoost.mdx";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\MiniMapIconCreepLoc.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\MiniMapIconCreepLoc2.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-Laboratory.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-Laboratory.mdx";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-Mercenary.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-Mercenary.mdx";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-NeutralBuilding.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-ShipYard.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-ShipYard.mdx";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-Shop.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-Shop.mdx";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-Tavern.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-Tavern.mdx";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-WaypointMarker.dds";
system "MPQEditor d \"$dirname/$filename\" UI\\MiniMap\\AMAI_MiniMap-WaypointMarker.mdx";
system "MPQEditor d \"$dirname/$filename\" war3map.imp";
system "MPQEditor d \"$dirname/$filename\" war3map.w3t";
system "MPQEditor f \"$dirname/$filename\"";
if ($? == -1) {
printf "Unable to spawn MPQEditor process";
} elsif ($? >> 8 == 5) {
printf "ERROR: Failed to uninstall flush, you may not have valid permissions or are blocked by windows UAC. Ensure map files are not in a UAC protected location %d\n", $? >> 8;
} elsif ($? >> 8 > 0) {
printf "ERROR: Unknown. AMAI not have uninstalled correctly. flush:%d\n", $? >> 8;
}
}
}
closedir($DIR);
}
process_dir ($ARGV[0], $ARGV[1]);