1 |
package net.oni2.aeinstaller; |
2 |
|
3 |
import java.util.HashMap; |
4 |
import java.util.HashSet; |
5 |
|
6 |
import net.oni2.aeinstaller.backend.depot.DepotCacheUpdateProgressListener; |
7 |
import net.oni2.aeinstaller.backend.depot.DepotConfig; |
8 |
import net.oni2.aeinstaller.backend.depot.DepotManager; |
9 |
import net.oni2.aeinstaller.backend.depot.model.Node; |
10 |
import net.oni2.aeinstaller.backend.depot.model.NodeMod; |
11 |
|
12 |
/** |
13 |
* @author Christian Illy |
14 |
*/ |
15 |
public class DepotPackageCheck { |
16 |
|
17 |
/** |
18 |
* @param args |
19 |
* Arguments |
20 |
*/ |
21 |
public static void main(String[] args) { |
22 |
System.out.println("Reading Depot data:"); |
23 |
DepotManager.getInstance().updateInformation(false, |
24 |
new DepotCacheUpdateProgressListener() { |
25 |
|
26 |
@Override |
27 |
public void cacheUpdateProgress(String stepName, |
28 |
int current, int total) { |
29 |
System.out.format("%50s", ""); |
30 |
System.out.format("\rStep %2d / %2d - %s", current, |
31 |
total, stepName); |
32 |
} |
33 |
}); |
34 |
System.out.println("\nReading done"); |
35 |
System.out.println(); |
36 |
DepotManager.getInstance().printStats(); |
37 |
|
38 |
System.out.println(); |
39 |
|
40 |
printModsWithFilesNot1(); |
41 |
} |
42 |
|
43 |
private static void printModsWithFilesNot1() { |
44 |
System.out.println("Mod-Nodes with files != 1:"); |
45 |
|
46 |
HashMap<String, HashSet<NodeMod>> foundNodes = new HashMap<String, HashSet<NodeMod>>(); |
47 |
for (Node n : DepotManager.getInstance().getNodesByType( |
48 |
DepotConfig.getNodeType_Mod())) { |
49 |
NodeMod nm = (NodeMod) n; |
50 |
if (nm.getUploads().size() != 1) { |
51 |
if (!foundNodes.containsKey(nm.getInstallMethod().getName())) |
52 |
foundNodes.put(nm.getInstallMethod().getName(), |
53 |
new HashSet<NodeMod>()); |
54 |
foundNodes.get(nm.getInstallMethod().getName()).add(nm); |
55 |
} |
56 |
} |
57 |
|
58 |
for (String inst : foundNodes.keySet()) { |
59 |
System.out.format("Inst method '%s':\n", inst); |
60 |
for (NodeMod nm : foundNodes.get(inst)) { |
61 |
System.out |
62 |
.format(" Node %3d, Files %d, Platform %5s, Type %10s, Title \"%s\"\n", |
63 |
nm.getNid(), nm.getUploads().size(), nm |
64 |
.getPlatform().toString(), nm |
65 |
.getTypes().toString(), nm.getTitle()); |
66 |
} |
67 |
System.out.println(); |
68 |
} |
69 |
} |
70 |
|
71 |
} |