-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunClass.java
57 lines (53 loc) · 1.85 KB
/
runClass.java
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
import scriptLib.codeRunning;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
/**
* @version beta 0.0.1
* @author vamco2020
*
* Now, this script has 3 run mode,
* 1, straight run it. (Can use)
* 2, converted the codes to Java, Then run it.(To Jar Will default use it) (Will show in the beta 0.15)
* 3, converted the codes to C++, Then run it.(Your Computer need gcc or g++!) (Will show in the beta 0.25)
*/
public class runClass {
public static void main(String[] args) {
File info = new File(".\\file\\program.inf");
Map<Integer,String> code = new HashMap<>();
String[] infoGet = new String[64];
try{
BufferedReader reader = new BufferedReader(
new FileReader(info)
);
String s;
int l = 0;
while ((s = reader.readLine()) != null){
infoGet[l] = s;
l++;
}
} catch (FileNotFoundException e) {
System.out.println("Error:Cannot found the program.info file!");
} catch (IOException e) {
System.out.println("Error:IOException");
}
String mainFileName = infoGet[0].split(":")[1];
File mainCodeFile = new File(".\\file\\codes\\" + mainFileName);
try{
BufferedReader reader = new BufferedReader(
new FileReader(mainCodeFile)
);
String s;
int l = 0;
while ((s = reader.readLine()) != null){
code.put(l,s);
l++;
}
} catch (FileNotFoundException e) {
System.out.println("Error:Cannot found the Main file!");
} catch (IOException e) {
System.out.println("Error:IOException");
}
codeRunning.run(code,0);
}
}