From 70dacbecdcc71dd744d8f7d6cfa5c968d9b20a8e Mon Sep 17 00:00:00 2001 From: rvost Date: Sun, 16 Oct 2022 02:19:22 +0300 Subject: [PATCH] Minor fixes * Fix order of tags and attributes in types.xml files; * Remove filename filter in ItemTypes open dialog; * Add Known Issues section to README --- README.md | 9 ++++++++- .../ViewModels/ItemTypesViewModel.cs | 1 - src/DayzServerTools.Library/Xml/ItemFlags.cs | 4 ++-- src/DayzServerTools.Library/Xml/ItemType.cs | 19 ++++++------------- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 0490c5d..b8150c9 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file +* 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. \ No newline at end of file diff --git a/src/DayzServerTools.Application/ViewModels/ItemTypesViewModel.cs b/src/DayzServerTools.Application/ViewModels/ItemTypesViewModel.cs index aa6b02c..72d79fa 100644 --- a/src/DayzServerTools.Application/ViewModels/ItemTypesViewModel.cs +++ b/src/DayzServerTools.Application/ViewModels/ItemTypesViewModel.cs @@ -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() diff --git a/src/DayzServerTools.Library/Xml/ItemFlags.cs b/src/DayzServerTools.Library/Xml/ItemFlags.cs index cfae639..3758a72 100644 --- a/src/DayzServerTools.Library/Xml/ItemFlags.cs +++ b/src/DayzServerTools.Library/Xml/ItemFlags.cs @@ -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"); diff --git a/src/DayzServerTools.Library/Xml/ItemType.cs b/src/DayzServerTools.Library/Xml/ItemType.cs index d2646bd..340186b 100644 --- a/src/DayzServerTools.Library/Xml/ItemType.cs +++ b/src/DayzServerTools.Library/Xml/ItemType.cs @@ -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 Tags { get; set; } = new ObservableCollection(); [XmlElement("usage", typeof(UserDefinableFlag))] public ObservableCollection Usages { get; set; } = new ObservableCollection(); [XmlElement("value", typeof(UserDefinableFlag))] public ObservableCollection Value { get; set; } = new ObservableCollection(); - - [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 Tags { get; set; } = new ObservableCollection(); }