You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Docs/README.egosoft
+57-25Lines changed: 57 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,30 @@
1
-
[size=150][b]Modding tools: XML diff and patch for X4: Foundations[/b][/size]
1
+
[size=140][u]Modding tools: XML diff and patch for X4: Foundations[/u][/size]
2
2
3
3
This toolset is a simple XML diff and patch tools for X4: Foundations. It is designed to help modders to compare and patch XML files.
4
4
5
5
The format of diff XML files is compatible with the appropriate [b]diff.xsd[/b] format definition. It is means - you can you this tool to create diff files for any XML files used in game.
6
6
Also, you can use appropriate tool to patch XML files with diff files, this action has reason to check how your diff file will be applied to the vanilla XML file. Or better understand, what other modders did in their mods.
7
7
8
-
[size=120][b]Important note[/b][/size]
9
-
It is highly recommended to use the [b]diff.xsd[/b] file to validate the diff XML files. It is especially important when you creating them by [b]XMLDiff.exe[/b].
8
+
[size=130][u]Important note[/u][/size]
10
9
10
+
It is highly recommended to use the [b]diff.xsd[/b] file to validate the diff XML files. It is especially important when you creating them by [b]XMLDiff.exe[/b].
11
11
12
-
[size=120][b]How to use[/b][/size]
12
+
[size=130][u]How to use[/u][/size]
13
13
[list=1]
14
14
[*] Download the latest release from:
15
-
[/list][*] GitHub [url=https://github.com/chemodun/x4_XMLDiffAndPatch/releases/]releases page[/url] - there is an archive file [b]XMLDiffAndPatch.zip[/b].
15
+
[/list][list]
16
+
[list]
17
+
[*] GitHub [url=https://github.com/chemodun/x4_XMLDiffAndPatch/releases/]releases page[/url] - there is an archive file [b]XMLDiffAndPatch.zip[/b].
16
18
[*] [url=https://www.nexusmods.com/x4foundations/mods/1578]NexusMods[/url] - there is an archive file [b]XMLDiffAndPatch.zip[/b].
17
-
[list=1]
18
-
[*] Extract the archive file to any useful location.
19
-
[*] Inside will be a folder, named XMLDiffAndPatch with two executable - [b]XMLDiff.exe[/b] and [b]XMLPatch.exe[/b].
20
19
[/list]
21
-
[size=100][b]How to create a diff file[/b][/size]
20
+
[/list]
21
+
[list=1][*] Extract the archive file to any useful location.
22
+
[*] Inside will be a folder, named XMLDiffAndPatch with two executables - [b]XMLDiff.exe[/b] and [b]XMLPatch.exe[/b].
23
+
[/list]
24
+
[size=125][u]How to create a diff file[/u][/size]
25
+
22
26
There is a command line help for the [b]XMLDiff[/b] tool:
@@ -66,19 +75,24 @@ There the is example of the diff files created by tool:
66
75
</add>
67
76
</diff>
68
77
```
78
+
[list]
69
79
[*] with replace operation:
80
+
[/list]
70
81
```xml
71
82
<?xml version='1.0' encoding='UTF-8'?>
72
83
<diff>
73
84
<replace sel="//do_if[@value="@$speak and not this.assignedcontrolled.nextorder and (@$defaultorder.id != 'Patrol') and (@$defaultorder.id != 'ProtectPosition') and (@$defaultorder.id != 'ProtectShip') and (@$defaultorder.id != 'ProtectStation') and (@$defaultorder.id != 'Plunder') and (@$defaultorder.id != 'Police') and (not this.assignedcontrolled.commander or (this.assignedcontrolled.commander == player.occupiedship)) and notification.npc_await_orders.active"]/@value">@$speak and not this.assignedcontrolled.nextorder and (@$defaultorder.id != 'ProtectSector') and (@$defaultorder.id != 'Patrol') and (@$defaultorder.id != 'ProtectPosition') and (@$defaultorder.id != 'ProtectShip') and (@$defaultorder.id != 'ProtectStation') and (@$defaultorder.id != 'Plunder') and (@$defaultorder.id != 'Police') and (not this.assignedcontrolled.commander or (this.assignedcontrolled.commander == player.occupiedship)) and notification.npc_await_orders.active</replace>
74
85
</diff>
75
86
```
76
-
[size=90][b]Path options[/b][/size]
77
87
78
-
[size=80][b]Only full path[/b][/size]
88
+
[size=120][u]Path options[/u][/size]
89
+
90
+
[size=115][u]Only full path[/u][/size]
91
+
79
92
The [b]--only-full-path[/b] option will generate only the full path to the element in the XML file. It is mean - there no [b]//[/b] will be in the [b]sel[/b] attribute of the [b]add[/b], [b]replace[/b] or [b]remove[/b] element.
[size=80][b]Use all attributes in XPath[/b][/size]
112
+
[size=115][u]Use all attributes in XPath[/u][/size]
113
+
99
114
The [b]--use-all-attributes[/b] option will generate the [b]sel[/b] attribute with all attributes of the element in the XML file. It is mean - there will be all attributes of the element in the [b]sel[/b] attribute of the [b]add[/b], [b]replace[/b] or [b]remove[/b] element.
<do_if value="@$speak and not this.assignedcontrolled.nextorder and (@$defaultorder.id != 'Patrol') and (@$defaultorder.id != 'ProtectSector') and (@$defaultorder.id != 'ProtectPosition') and (@$defaultorder.id != 'ProtectShip') and (@$defaultorder.id != 'ProtectStation') and (@$defaultorder.id != 'Plunder') and (@$defaultorder.id != 'Police') and (not this.assignedcontrolled.commander or (this.assignedcontrolled.commander == player.occupiedship)) and notification.npc_await_orders.active">
[size=100][b]If output XML is a directory[/b][/size]
207
+
[size=125][u]If output XML is a directory[/u][/size]
208
+
184
209
If the output XML is a directory, the tool will create a new XML file with the same name as the original XML file in the output directory.
185
210
For example, if the original XML file is [b]vanilla.xml[/b] and the output directory is [b]output[/b], the tool will create a new XML file [b]output/vanilla.xml[/b].
186
211
187
-
[size=100][b]How to apply a tools to a directories[/b][/size]
212
+
[size=125][u]How to apply a tools to a directories[/u][/size]
213
+
188
214
You can apply the tools to directories. In this case, the tools will apply the diff or patch to all XML files in the directory.
189
215
The logic will be a next:
216
+
[list]
190
217
[*] all input parameters are directories - the tools will apply the diff or patch to all XML files in the directories.
191
218
[*] it will recursively gro thru the diff or changed XML files in the directories, respectively to the tool.
192
219
[*] for each diff or changed files will be checked a corresponding original XML file in the original directory with the same relative path.
193
220
[*] if the original XML file is not found - the diff or changed file will be skipped.
194
221
[*] if the original XML file is found - the diff or changed file will be patched with the original XML file and created a new patched XML file in the output directory with the same relative path.
If you have any issues with the tool, please create an issue in the [url=https://github.com/chemodun/x4_XMLDiffAndPatch/issues]issues page[/url].
208
238
Will be highly appreciated if you will provide a version of used tool and XMLDiff.log or XMLPatch.log file respectively to the tool.
209
239
To create such debug file please use the [b]--log-to-file[/b] option.
210
240
211
-
[size=120][b]License[/b][/size]
212
-
There is a MIT license for this tool. You can find it in the [url=LICENSE]LICENSE[/url] file.
241
+
[size=130][u]License[/u][/size]
242
+
243
+
There is a MIT license for this tool. You can find it in the [url=https://github.com/chemodun/X4-UniverseEditor/raw/main/C:\Users\psvor\OneDrive\Development\C#\X4\XMLDiffAndPatch/LICENSE]LICENSE[/url] file.
213
244
214
-
[size=120][b]Additional links[/b][/size]
245
+
[size=130][u]Additional links[/u][/size]
215
246
216
247
There is a topic on the [url=https://forum.egosoft.com/viewtopic.php?t=468623]Egosoft forum[/url], related to this toolset.
217
248
218
-
[size=120][b]Antivirus scanning[/b][/size]
219
-
Please be aware - each release archive has an appropriate ling to the [url=https://www.virustotal.com]VirusTotal[/url]. Follow the link to be sure that the archive is safe.
249
+
[size=130][u]Antivirus scanning[/u][/size]
250
+
251
+
Please be aware - each release archive has an appropriate ling to the [url=https://www.virustotal.com]VirusTotal[/url]. Follow the link to be sure that the archive is safe.
Copy file name to clipboardExpand all lines: README.md
+46-14Lines changed: 46 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,18 +6,23 @@ The format of diff XML files is compatible with the appropriate `diff.xsd` forma
6
6
Also, you can use appropriate tool to patch XML files with diff files, this action has reason to check how your diff file will be applied to the vanilla XML file. Or better understand, what other modders did in their mods.
7
7
8
8
## Important note
9
-
It is highly recommended to use the `diff.xsd` file to validate the diff XML files. It is especially important when you creating them by `XMLDiff.exe`.
10
9
10
+
It is highly recommended to use the `diff.xsd` file to validate the diff XML files. It is especially important when you creating them by `XMLDiff.exe`.
11
11
12
12
## How to use
13
+
13
14
1. Download the latest release from:
14
-
- GitHub [releases page](https://github.com/chemodun/x4_XMLDiffAndPatch/releases/) - there is an archive file `XMLDiffAndPatch.zip`.
15
-
-[NexusMods](https://www.nexusmods.com/x4foundations/mods/1578) - there is an archive file `XMLDiffAndPatch.zip`.
15
+
16
+
- GitHub [releases page](https://github.com/chemodun/x4_XMLDiffAndPatch/releases/) - there is an archive file `XMLDiffAndPatch.zip`.
17
+
-[NexusMods](https://www.nexusmods.com/x4foundations/mods/1578) - there is an archive file `XMLDiffAndPatch.zip`.
18
+
16
19
2. Extract the archive file to any useful location.
17
-
3. Inside will be a folder, named XMLDiffAndPatch with two executable - `XMLDiff.exe` and `XMLPatch.exe`.
20
+
3. Inside will be a folder, named XMLDiffAndPatch with two executables - `XMLDiff.exe` and `XMLPatch.exe`.
18
21
19
22
### How to create a diff file
23
+
20
24
There is a command line help for the `XMLDiff` tool:
@@ -64,19 +73,24 @@ There the is example of the diff files created by tool:
64
73
</add>
65
74
</diff>
66
75
```
67
-
- with replace operation:
76
+
77
+
- with replace operation:
78
+
68
79
```xml
69
80
<?xml version='1.0' encoding='UTF-8'?>
70
81
<diff>
71
82
<replacesel="//do_if[@value="@$speak and not this.assignedcontrolled.nextorder and (@$defaultorder.id != 'Patrol') and (@$defaultorder.id != 'ProtectPosition') and (@$defaultorder.id != 'ProtectShip') and (@$defaultorder.id != 'ProtectStation') and (@$defaultorder.id != 'Plunder') and (@$defaultorder.id != 'Police') and (not this.assignedcontrolled.commander or (this.assignedcontrolled.commander == player.occupiedship)) and notification.npc_await_orders.active"]/@value">@$speak and not this.assignedcontrolled.nextorder and (@$defaultorder.id != 'ProtectSector') and (@$defaultorder.id != 'Patrol') and (@$defaultorder.id != 'ProtectPosition') and (@$defaultorder.id != 'ProtectShip') and (@$defaultorder.id != 'ProtectStation') and (@$defaultorder.id != 'Plunder') and (@$defaultorder.id != 'Police') and (not this.assignedcontrolled.commander or (this.assignedcontrolled.commander == player.occupiedship)) and notification.npc_await_orders.active</replace>
72
83
</diff>
73
84
```
85
+
74
86
#### Path options
75
87
76
88
##### Only full path
89
+
77
90
The `--only-full-path` option will generate only the full path to the element in the XML file. It is mean - there no `//` will be in the `sel` attribute of the `add`, `replace` or `remove` element.
The `--use-all-attributes` option will generate the `sel` attribute with all attributes of the element in the XML file. It is mean - there will be all attributes of the element in the `sel` attribute of the `add`, `replace` or `remove` element.
@@ -179,23 +203,29 @@ There the is example of the patched XML files created by tool:
179
203
```
180
204
181
205
### If output XML is a directory
206
+
182
207
If the output XML is a directory, the tool will create a new XML file with the same name as the original XML file in the output directory.
183
208
For example, if the original XML file is `vanilla.xml` and the output directory is `output`, the tool will create a new XML file `output/vanilla.xml`.
184
209
185
210
### How to apply a tools to a directories
211
+
186
212
You can apply the tools to directories. In this case, the tools will apply the diff or patch to all XML files in the directory.
187
213
The logic will be a next:
188
-
- all input parameters are directories - the tools will apply the diff or patch to all XML files in the directories.
189
-
- it will recursively gro thru the diff or changed XML files in the directories, respectively to the tool.
190
-
- for each diff or changed files will be checked a corresponding original XML file in the original directory with the same relative path.
191
-
- if the original XML file is not found - the diff or changed file will be skipped.
192
-
- if the original XML file is found - the diff or changed file will be patched with the original XML file and created a new patched XML file in the output directory with the same relative path.
214
+
215
+
- all input parameters are directories - the tools will apply the diff or patch to all XML files in the directories.
216
+
- it will recursively gro thru the diff or changed XML files in the directories, respectively to the tool.
217
+
- for each diff or changed files will be checked a corresponding original XML file in the original directory with the same relative path.
218
+
- if the original XML file is not found - the diff or changed file will be skipped.
219
+
- if the original XML file is found - the diff or changed file will be patched with the original XML file and created a new patched XML file in the output directory with the same relative path.
@@ -207,11 +237,13 @@ Will be highly appreciated if you will provide a version of used tool and XMLDif
207
237
To create such debug file please use the `--log-to-file` option.
208
238
209
239
## License
240
+
210
241
There is a MIT license for this tool. You can find it in the [LICENSE](LICENSE) file.
211
242
212
243
## Additional links
213
244
214
245
There is a topic on the [Egosoft forum](https://forum.egosoft.com/viewtopic.php?t=468623), related to this toolset.
215
246
216
247
## Antivirus scanning
217
-
Please be aware - each release archive has an appropriate ling to the [VirusTotal](https://www.virustotal.com). Follow the link to be sure that the archive is safe.
248
+
249
+
Please be aware - each release archive has an appropriate ling to the [VirusTotal](https://www.virustotal.com). Follow the link to be sure that the archive is safe.
0 commit comments