Skip to content

Commit 57d4a2d

Browse files
committed
docs: improve formatting and clarity in README file
1 parent 545e1db commit 57d4a2d

File tree

2 files changed

+103
-39
lines changed

2 files changed

+103
-39
lines changed

Docs/README.egosoft

Lines changed: 57 additions & 25 deletions
Original file line numberDiff line numberDiff 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]
22

33
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.
44

55
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.
66
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.
77

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]
109

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].
1111

12-
[size=120][b]How to use[/b][/size]
12+
[size=130][u]How to use[/u][/size]
1313
[list=1]
1414
[*] 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].
1618
[*] [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].
2019
[/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+
2226
There is a command line help for the [b]XMLDiff[/b] tool:
27+
2328
[code]
2429
XMLDiff 0.2.13
2530
Developed by Chem O`Dun
@@ -44,13 +49,17 @@ Developed by Chem O`Dun
4449
[/code]
4550

4651
Example:
52+
4753
[code]
4854
XMLDiff.exe -o vanilla.xml -m modified.xml -d diff.xml
4955
[/code]
5056

51-
[size=100][b]Example of resulting diff files[/b][/size]
57+
[size=125][u]Example of resulting diff files[/u][/size]
58+
5259
There the is example of the diff files created by tool:
60+
[list]
5361
[*] with add operation:
62+
[/list]
5463
[code=xml]
5564
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
5665
<diff>
@@ -66,19 +75,24 @@ There the is example of the diff files created by tool:
6675
</add>
6776
</diff>
6877
```
78+
[list]
6979
[*] with replace operation:
80+
[/list]
7081
```xml
7182
<?xml version='1.0' encoding='UTF-8'?>
7283
<diff>
7384
<replace sel="//do_if[@value=&quot;@$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&quot;]/@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>
7485
</diff>
7586
```
76-
[size=90][b]Path options[/b][/size]
7787

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+
7992
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.
8093

8194
Example:
95+
8296
[/code]xml
8397
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
8498
<diff>
@@ -95,10 +109,12 @@ Example:
95109
</diff>
96110
[code]
97111

98-
[size=80][b]Use all attributes in XPath[/b][/size]
112+
[size=115][u]Use all attributes in XPath[/u][/size]
113+
99114
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.
100115

101116
Example:
117+
102118
[/code]xml
103119
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
104120
<diff>
@@ -115,8 +131,10 @@ Example:
115131
</diff>
116132
[code]
117133

118-
[size=100][b]How to apply a diff file[/b][/size]
134+
[size=125][u]How to apply a diff file[/u][/size]
135+
119136
There is a command line help for the [b]XMLPatch[/b] tool:
137+
120138
[/code]
121139
XMLPatch 0.2.13
122140
Developed by Chem O`Dun
@@ -137,13 +155,17 @@ Developed by Chem O`Dun
137155
[code]
138156

139157
Example:
158+
140159
[/code]
141-
xml-patch.exe -o vanilla.xml -d diff.xml -u modified.xml
160+
XMLPatch.exe -o vanilla.xml -d diff.xml -u modified.xml
142161
[code]
143162

144-
[size=100][b]Example of resulting patched XML files[/b][/size]
163+
[size=125][u]Example of resulting patched XML files[/u][/size]
164+
145165
There the is example of the patched XML files created by tool:
166+
[list]
146167
[*] with add operation:
168+
[/list]
147169
```xml
148170
<ware id="satellite_mk2" name="{20201,20401}" description="{20201,20402}" transport="equipment" volume="1" tags="equipment satellite">
149171
<price min="44380" average="52215" max="60045"/>
@@ -172,48 +194,58 @@ There the is example of the patched XML files created by tool:
172194
<use threshold="0"/>
173195
</ware>
174196
```
197+
[list]
175198
[*] with replace operation:
199+
[/list]
176200
```xml
177201
<set_to_default_flight_control_model object="this.assignedcontrolled"/>
178202
<set_value name="$defaultorder" exact="this.assignedcontrolled.defaultorder"/>
179203
<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">
180204
<set_value name="$speakline" exact="10304" comment="Awaiting orders."/>
181205
```
182206

183-
[size=100][b]If output XML is a directory[/b][/size]
207+
[size=125][u]If output XML is a directory[/u][/size]
208+
184209
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.
185210
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].
186211

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+
188214
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.
189215
The logic will be a next:
216+
[list]
190217
[*] all input parameters are directories - the tools will apply the diff or patch to all XML files in the directories.
191218
[*] it will recursively gro thru the diff or changed XML files in the directories, respectively to the tool.
192219
[*] for each diff or changed files will be checked a corresponding original XML file in the original directory with the same relative path.
193220
[*] if the original XML file is not found - the diff or changed file will be skipped.
194221
[*] 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.
195-
222+
[/list]
196223
Example:
224+
197225
[/code]
198226
XMLDiff.exe -o vanilla_dir -m modified_dir -d diff_dir
199227
[code]
228+
200229
or
230+
201231
[/code]
202232
XMLPatch.exe -o vanilla_dir -d diff_dir -u modified_dir
203233
```
204234

205-
[size=120][b]Issues reporting[/b][/size]
235+
[size=130][u]Issues reporting[/u][/size]
206236

207237
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].
208238
Will be highly appreciated if you will provide a version of used tool and XMLDiff.log or XMLPatch.log file respectively to the tool.
209239
To create such debug file please use the [b]--log-to-file[/b] option.
210240

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.
213244

214-
[size=120][b]Additional links[/b][/size]
245+
[size=130][u]Additional links[/u][/size]
215246

216247
There is a topic on the [url=https://forum.egosoft.com/viewtopic.php?t=468623]Egosoft forum[/url], related to this toolset.
217248

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.

README.md

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,23 @@ The format of diff XML files is compatible with the appropriate `diff.xsd` forma
66
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.
77

88
## 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`.
109

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`.
1111

1212
## How to use
13+
1314
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+
1619
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`.
1821

1922
### How to create a diff file
23+
2024
There is a command line help for the `XMLDiff` tool:
25+
2126
```
2227
XMLDiff 0.2.13
2328
Developed by Chem O`Dun
@@ -42,13 +47,17 @@ Developed by Chem O`Dun
4247
```
4348

4449
Example:
50+
4551
```
4652
XMLDiff.exe -o vanilla.xml -m modified.xml -d diff.xml
4753
```
4854

4955
### Example of resulting diff files
56+
5057
There the is example of the diff files created by tool:
51-
- with add operation:
58+
59+
- with add operation:
60+
5261
```xml
5362
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
5463
<diff>
@@ -64,19 +73,24 @@ There the is example of the diff files created by tool:
6473
</add>
6574
</diff>
6675
```
67-
- with replace operation:
76+
77+
- with replace operation:
78+
6879
```xml
6980
<?xml version='1.0' encoding='UTF-8'?>
7081
<diff>
7182
<replace sel="//do_if[@value=&quot;@$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&quot;]/@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>
7283
</diff>
7384
```
85+
7486
#### Path options
7587

7688
##### Only full path
89+
7790
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.
7891

7992
Example:
93+
8094
```xml
8195
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
8296
<diff>
@@ -94,9 +108,11 @@ Example:
94108
```
95109

96110
##### Use all attributes in XPath
111+
97112
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.
98113

99114
Example:
115+
100116
```xml
101117
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
102118
<diff>
@@ -114,7 +130,9 @@ Example:
114130
```
115131

116132
### How to apply a diff file
133+
117134
There is a command line help for the `XMLPatch` tool:
135+
118136
```
119137
XMLPatch 0.2.13
120138
Developed by Chem O`Dun
@@ -135,13 +153,17 @@ Developed by Chem O`Dun
135153
```
136154

137155
Example:
156+
138157
```
139158
XMLPatch.exe -o vanilla.xml -d diff.xml -u modified.xml
140159
```
141160

142161
### Example of resulting patched XML files
162+
143163
There the is example of the patched XML files created by tool:
144-
- with add operation:
164+
165+
- with add operation:
166+
145167
```xml
146168
<ware id="satellite_mk2" name="{20201,20401}" description="{20201,20402}" transport="equipment" volume="1" tags="equipment satellite">
147169
<price min="44380" average="52215" max="60045"/>
@@ -170,7 +192,9 @@ There the is example of the patched XML files created by tool:
170192
<use threshold="0"/>
171193
</ware>
172194
```
173-
- with replace operation:
195+
196+
- with replace operation:
197+
174198
```xml
175199
<set_to_default_flight_control_model object="this.assignedcontrolled"/>
176200
<set_value name="$defaultorder" exact="this.assignedcontrolled.defaultorder"/>
@@ -179,23 +203,29 @@ There the is example of the patched XML files created by tool:
179203
```
180204

181205
### If output XML is a directory
206+
182207
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.
183208
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`.
184209

185210
### How to apply a tools to a directories
211+
186212
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.
187213
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.
193220

194221
Example:
222+
195223
```
196224
XMLDiff.exe -o vanilla_dir -m modified_dir -d diff_dir
197225
```
226+
198227
or
228+
199229
```
200230
XMLPatch.exe -o vanilla_dir -d diff_dir -u modified_dir
201231
```
@@ -207,11 +237,13 @@ Will be highly appreciated if you will provide a version of used tool and XMLDif
207237
To create such debug file please use the `--log-to-file` option.
208238
209239
## License
240+
210241
There is a MIT license for this tool. You can find it in the [LICENSE](LICENSE) file.
211242
212243
## Additional links
213244
214245
There is a topic on the [Egosoft forum](https://forum.egosoft.com/viewtopic.php?t=468623), related to this toolset.
215246
216247
## 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

Comments
 (0)