1 | package net.oni2.aeinstaller.backend.oni;
|
---|
2 |
|
---|
3 | import java.io.File;
|
---|
4 | import java.io.IOException;
|
---|
5 | import java.util.Vector;
|
---|
6 |
|
---|
7 | import net.oni2.aeinstaller.backend.CaseInsensitiveFile;
|
---|
8 | import net.oni2.aeinstaller.backend.Paths;
|
---|
9 | import net.oni2.platformtools.PlatformInformation;
|
---|
10 | import net.oni2.platformtools.applicationinvoker.ApplicationInvoker;
|
---|
11 | import net.oni2.platformtools.applicationinvoker.ApplicationInvocationResult;
|
---|
12 | import net.oni2.platformtools.applicationinvoker.EExeType;
|
---|
13 | import net.oni2.platformtools.applicationinvoker.ERuntimeNotInstalledException;
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * @author Christian Illy
|
---|
17 | */
|
---|
18 | public class XMLTools {
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Patch XML files with the given patch list
|
---|
22 | *
|
---|
23 | * @param patch
|
---|
24 | * Patchlist file
|
---|
25 | *
|
---|
26 | * @return XMLTools output
|
---|
27 | */
|
---|
28 | public static ApplicationInvocationResult patch(File patch) {
|
---|
29 | Vector<String> params = new Vector<String>();
|
---|
30 | params.add("--aei-patch-files-list \"" + patch.getPath() + "\"");
|
---|
31 | ApplicationInvocationResult res = null;
|
---|
32 | try {
|
---|
33 | res = ApplicationInvoker.executeAndWait(EExeType.OSBINARY, null,
|
---|
34 | getProgramFile(), params, false);
|
---|
35 | } catch (IOException e) {
|
---|
36 | e.printStackTrace();
|
---|
37 | } catch (ERuntimeNotInstalledException e) {
|
---|
38 | e.printStackTrace();
|
---|
39 | }
|
---|
40 | return res;
|
---|
41 | }
|
---|
42 |
|
---|
43 | private static File getProgramFile() {
|
---|
44 | File toolsPath = CaseInsensitiveFile.getCaseInsensitiveFile(
|
---|
45 | Paths.getEditionBasePath(), "Tools");
|
---|
46 | File xmlToolsPath = CaseInsensitiveFile.getCaseInsensitiveFile(
|
---|
47 | toolsPath, "XmlTools");
|
---|
48 | switch (PlatformInformation.getPlatform()) {
|
---|
49 | case WIN:
|
---|
50 | return CaseInsensitiveFile.getCaseInsensitiveFile(xmlToolsPath,
|
---|
51 | "XmlTools.exe");
|
---|
52 | case LINUX:
|
---|
53 | case MACOS:
|
---|
54 | return CaseInsensitiveFile.getCaseInsensitiveFile(xmlToolsPath,
|
---|
55 | "XmlTools");
|
---|
56 | default:
|
---|
57 | }
|
---|
58 | return null;
|
---|
59 | }
|
---|
60 | }
|
---|