| [698] | 1 | package net.oni2.aeinstaller.backend.oni;
|
|---|
| 2 |
|
|---|
| 3 | import java.io.File;
|
|---|
| 4 | import java.io.IOException;
|
|---|
| 5 | import java.util.Vector;
|
|---|
| 6 |
|
|---|
| [699] | 7 | import net.oni2.aeinstaller.backend.CaseInsensitiveFile;
|
|---|
| [698] | 8 | import net.oni2.aeinstaller.backend.Paths;
|
|---|
| [720] | 9 | import net.oni2.platformtools.applicationinvoker.ApplicationInvoker;
|
|---|
| 10 | import net.oni2.platformtools.applicationinvoker.ApplicationInvocationResult;
|
|---|
| 11 | import net.oni2.platformtools.applicationinvoker.EExeType;
|
|---|
| 12 | import net.oni2.platformtools.applicationinvoker.ERuntimeNotInstalledException;
|
|---|
| [698] | 13 |
|
|---|
| 14 | /**
|
|---|
| 15 | * @author Christian Illy
|
|---|
| 16 | */
|
|---|
| 17 | public class XMLTools {
|
|---|
| 18 |
|
|---|
| 19 | /**
|
|---|
| 20 | * Patch the given XML file with the given patch
|
|---|
| 21 | *
|
|---|
| 22 | * @param patch
|
|---|
| 23 | * Patchfile
|
|---|
| 24 | * @param source
|
|---|
| 25 | * File to patch
|
|---|
| 26 | *
|
|---|
| 27 | * @return XMLTools output
|
|---|
| 28 | */
|
|---|
| [720] | 29 | public static ApplicationInvocationResult patch(File patch, File source) {
|
|---|
| 30 | Vector<String> params = new Vector<String>();
|
|---|
| [698] | 31 | // xmlTools.exe patchfile -filename:PATCH -forceinfiles:TOPATCH
|
|---|
| [720] | 32 | params.add("patchfile");
|
|---|
| 33 | params.add("-filename:" + patch.getPath());
|
|---|
| 34 | params.add("-forceinfiles:" + source.getPath());
|
|---|
| 35 | ApplicationInvocationResult res = null;
|
|---|
| [698] | 36 | try {
|
|---|
| [720] | 37 | res = ApplicationInvoker.executeAndWait(EExeType.DOTNET, null,
|
|---|
| 38 | getProgramFile(), params);
|
|---|
| [698] | 39 | } catch (IOException e) {
|
|---|
| 40 | e.printStackTrace();
|
|---|
| [720] | 41 | } catch (ERuntimeNotInstalledException e) {
|
|---|
| 42 | e.printStackTrace();
|
|---|
| [698] | 43 | }
|
|---|
| 44 | return res;
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | private static File getProgramFile() {
|
|---|
| [720] | 48 | File toolsPath = CaseInsensitiveFile.getCaseInsensitiveFile(
|
|---|
| 49 | Paths.getEditionBasePath(), "Tools");
|
|---|
| 50 | return CaseInsensitiveFile.getCaseInsensitiveFile(toolsPath,
|
|---|
| 51 | "xmlTools.exe");
|
|---|
| [698] | 52 | }
|
|---|
| 53 | }
|
|---|