12
12
import java .nio .file .Files ;
13
13
import java .nio .file .Path ;
14
14
import java .nio .file .Paths ;
15
+ import java .util .List ;
15
16
import java .util .stream .Collectors ;
16
17
import java .util .stream .Stream ;
17
18
@@ -22,10 +23,21 @@ public void scan(String dir, String s) throws Exception {
22
23
dir = dir +"/" ;
23
24
}
24
25
try (Stream <Path > paths = Files .walk (Paths .get (dir ))) {
25
- String finalDir = dir ;
26
- paths .map (Path ::toString ).filter (f -> f .endsWith (".class" ))
27
- .collect (Collectors .toList ())
28
- .forEach (c -> decompiler (new File (c ), finalDir ));
26
+ List <String > collect = paths .map (Path ::toString ).filter (f -> f .endsWith (".class" ))
27
+ .collect (Collectors .toList ());
28
+ int collectLength = collect .size ();
29
+ int part = collectLength /100 ;
30
+ int aPart = part ;
31
+ int partNum = 0 ;
32
+ for (int i = 0 ; i < collectLength ; i ++) {
33
+ if (aPart == i ){
34
+ System .out .println ("完成了: " +partNum +"%" );
35
+ partNum ++;
36
+ aPart = aPart + part ;
37
+ }
38
+ decompiler (new File (collect .get (i )), dir );
39
+ }
40
+ //.forEach(c -> decompiler(new File(c), finalDir));
29
41
} catch (IOException e ) {
30
42
e .printStackTrace ();
31
43
}
@@ -34,7 +46,9 @@ public void scan(String dir, String s) throws Exception {
34
46
public static void decompiler (File clazzFile , String base ){
35
47
int baseLength = base .length ();
36
48
String path = clazzFile .getAbsolutePath ();
37
- System .out .println (clazzFile .getAbsolutePath ());
49
+ if (Main .log ){
50
+ System .out .println (clazzFile .getAbsolutePath ());
51
+ }
38
52
path = path .substring (baseLength );
39
53
if (path .endsWith (".class" )){
40
54
Loader loader = new ppsoft1991 .decompier .Loader (new File (base ));
0 commit comments