Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
* Fix order of tags and attributes in types.xml files;
* Remove filename filter in ItemTypes open dialog;
* Add Known Issues section to README
  • Loading branch information
rvost committed Oct 15, 2022
1 parent 75d636d commit 70dacbe
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,11 @@ Some tips on how to use DayzServerTools:
* Export items from `types.xml` to trader or new file works on on selected too.
* To move items from one trader to another: use right click on selected items and choose option in context menu.
* To delete value or usage flag or tag: right click on it and choose 'Remove' in context menu.
* Delete rows in tables with `Del` key.
* Delete rows in tables with `Del` key.

## Known issues

**Caution:** DayzServerTools uses generic format for xml files the order of tags and attributes matches the one in vanilla files, comments and your custom formatting will be stripped on editing.

This may cause merge conflicts with future versions of the files (if you edited `db\types.xml` for example).
Workaround: when update comes out, you can open&save new file with the tool and then merge your current version with it.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ protected override void OnLoad(Stream input, string filename)
protected override IFileDialog CreateOpenFileDialog()
{
var dialog = _dialogFactory.CreateOpenFileDialog();
dialog.FileName = "types*";
return dialog;
}
protected override bool CanSave()
Expand Down
4 changes: 2 additions & 2 deletions src/DayzServerTools.Library/Xml/ItemFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public void ReadXml(XmlReader reader)

public void WriteXml(XmlWriter writer)
{
writer.WriteAttributeString("count_in_map", CountInMap ? "1" : "0");
writer.WriteAttributeString("count_in_hoarder", CountInHoarder ? "1" : "0");
writer.WriteAttributeString("count_in_cargo", CountInCargo ? "1" : "0");
writer.WriteAttributeString("count_in_hoarder", CountInHoarder ? "1" : "0");
writer.WriteAttributeString("count_in_map", CountInMap ? "1" : "0");
writer.WriteAttributeString("count_in_player", CountInPlayer ? "1" : "0");
writer.WriteAttributeString("crafted", Crafted ? "1" : "0");
writer.WriteAttributeString("deloot", Deloot ? "1" : "0");
Expand Down
19 changes: 6 additions & 13 deletions src/DayzServerTools.Library/Xml/ItemType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,16 @@ public class ItemType

[XmlElement("flags", typeof(ItemFlags))]
public ItemFlags Flags { get; set; } = new ItemFlags();
[XmlElement("category", typeof(VanillaFlag))]
public VanillaFlag Category { get; set; } = new VanillaFlag();
[XmlIgnore]
public bool CategorySpecified => !string.IsNullOrWhiteSpace(Category?.Value);
[XmlElement("tag", typeof(VanillaFlag))]
public ObservableCollection<VanillaFlag> Tags { get; set; } = new ObservableCollection<VanillaFlag>();

[XmlElement("usage", typeof(UserDefinableFlag))]
public ObservableCollection<UserDefinableFlag> Usages { get; set; } = new ObservableCollection<UserDefinableFlag>();

[XmlElement("value", typeof(UserDefinableFlag))]
public ObservableCollection<UserDefinableFlag> Value { get; set; } = new ObservableCollection<UserDefinableFlag>();

[XmlElement("category", typeof(VanillaFlag))]
public VanillaFlag Category { get; set; } = new VanillaFlag();

[XmlIgnore]
public bool CategorySpecified
{
get => !string.IsNullOrEmpty(Category?.Value);
set { return; }
}

[XmlElement("tag", typeof(VanillaFlag))]
public ObservableCollection<VanillaFlag> Tags { get; set; } = new ObservableCollection<VanillaFlag>();
}

0 comments on commit 70dacbe

Please sign in to comment.