From d256bf6d728c71b034b7686394712d0560552fc5 Mon Sep 17 00:00:00 2001 From: James Hughes Date: Mon, 6 May 2024 17:05:52 +0100 Subject: [PATCH 01/15] Turns out ids aren't required --- .../Models/Abundance.cs | 1 - src/UniversalDiveDataFormat/Models/Audio.cs | 2 +- .../Models/BottomTimeTable.cs | 3 ++- .../Models/Buehlmann.cs | 2 +- .../Models/Certification.cs | 1 + src/UniversalDiveDataFormat/Models/Dive.cs | 3 ++- .../Models/DiveBase.cs | 3 ++- .../Models/DiveComputerDump.cs | 1 + .../Models/DiverDetails.cs | 2 +- src/UniversalDiveDataFormat/Models/Doctor.cs | 2 +- .../Models/EquipmentConfiguration.cs | 3 ++- .../Models/EquipmentDetails.cs | 3 ++- .../Models/EquipmentUsed.cs | 1 + .../Models/Generator.cs | 1 + src/UniversalDiveDataFormat/Models/Guide.cs | 1 + src/UniversalDiveDataFormat/Models/Image.cs | 2 +- .../Models/InformationBeforeDive.cs | 1 + .../Models/InputProfile.cs | 1 + .../Models/Instructor.cs | 2 +- src/UniversalDiveDataFormat/Models/Link.cs | 12 ----------- .../Models/{ => Linking}/ILinkable.cs | 2 +- .../Models/Linking/Link.cs | 21 +++++++++++++++++++ .../Models/Manufacturer.cs | 2 +- src/UniversalDiveDataFormat/Models/Mix.cs | 2 +- src/UniversalDiveDataFormat/Models/Notes.cs | 1 + .../Models/PointOfInterest.cs | 2 +- src/UniversalDiveDataFormat/Models/Profile.cs | 3 ++- .../Models/Purchase.cs | 1 + .../Models/RelatedDives.cs | 1 + .../Models/RepetitionGroup.cs | 2 +- src/UniversalDiveDataFormat/Models/Rgbm.cs | 2 +- src/UniversalDiveDataFormat/Models/Shop.cs | 2 +- src/UniversalDiveDataFormat/Models/Site.cs | 3 ++- src/UniversalDiveDataFormat/Models/Species.cs | 2 +- .../Models/TankData.cs | 3 ++- src/UniversalDiveDataFormat/Models/Trip.cs | 2 +- .../Models/TripPart.cs | 1 + src/UniversalDiveDataFormat/Models/Video.cs | 2 +- .../Models/VideoCamera.cs | 2 +- src/UniversalDiveDataFormat/Models/Vpm.cs | 2 +- 40 files changed, 66 insertions(+), 39 deletions(-) delete mode 100644 src/UniversalDiveDataFormat/Models/Link.cs rename src/UniversalDiveDataFormat/Models/{ => Linking}/ILinkable.cs (79%) create mode 100644 src/UniversalDiveDataFormat/Models/Linking/Link.cs diff --git a/src/UniversalDiveDataFormat/Models/Abundance.cs b/src/UniversalDiveDataFormat/Models/Abundance.cs index 9399050..e2103f5 100644 --- a/src/UniversalDiveDataFormat/Models/Abundance.cs +++ b/src/UniversalDiveDataFormat/Models/Abundance.cs @@ -1,4 +1,3 @@ -using System.Globalization; using System.Xml.Serialization; namespace UniversalDiveDataFormat.Models; diff --git a/src/UniversalDiveDataFormat/Models/Audio.cs b/src/UniversalDiveDataFormat/Models/Audio.cs index 8819bc8..e43a401 100644 --- a/src/UniversalDiveDataFormat/Models/Audio.cs +++ b/src/UniversalDiveDataFormat/Models/Audio.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class Audio: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("objectname")] public required string ObjectName { get; init; } [XmlElement("title")] diff --git a/src/UniversalDiveDataFormat/Models/BottomTimeTable.cs b/src/UniversalDiveDataFormat/Models/BottomTimeTable.cs index 2ef773f..e221a5e 100644 --- a/src/UniversalDiveDataFormat/Models/BottomTimeTable.cs +++ b/src/UniversalDiveDataFormat/Models/BottomTimeTable.cs @@ -1,5 +1,6 @@ using System.Xml; using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; @@ -7,7 +8,7 @@ namespace UniversalDiveDataFormat.Models; public class BottomTimeTable: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("link")] public List Links { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/Buehlmann.cs b/src/UniversalDiveDataFormat/Models/Buehlmann.cs index 3b0e46e..dd544cc 100644 --- a/src/UniversalDiveDataFormat/Models/Buehlmann.cs +++ b/src/UniversalDiveDataFormat/Models/Buehlmann.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class Buehlmann: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("gradientfactorhigh")] public float? GradientFactorHigh { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Certification.cs b/src/UniversalDiveDataFormat/Models/Certification.cs index 59a0cf8..0447792 100644 --- a/src/UniversalDiveDataFormat/Models/Certification.cs +++ b/src/UniversalDiveDataFormat/Models/Certification.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; diff --git a/src/UniversalDiveDataFormat/Models/Dive.cs b/src/UniversalDiveDataFormat/Models/Dive.cs index 1110688..059863b 100644 --- a/src/UniversalDiveDataFormat/Models/Dive.cs +++ b/src/UniversalDiveDataFormat/Models/Dive.cs @@ -1,5 +1,6 @@ using System.Xml; using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; @@ -7,7 +8,7 @@ namespace UniversalDiveDataFormat.Models; public class Dive : ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("link")] public List Links { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/DiveBase.cs b/src/UniversalDiveDataFormat/Models/DiveBase.cs index 13559c1..ffc6baf 100644 --- a/src/UniversalDiveDataFormat/Models/DiveBase.cs +++ b/src/UniversalDiveDataFormat/Models/DiveBase.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; @@ -6,7 +7,7 @@ namespace UniversalDiveDataFormat.Models; public class DiveBase : ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("name")] public required string Name { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/DiveComputerDump.cs b/src/UniversalDiveDataFormat/Models/DiveComputerDump.cs index 0d8fdf9..94e93bb 100644 --- a/src/UniversalDiveDataFormat/Models/DiveComputerDump.cs +++ b/src/UniversalDiveDataFormat/Models/DiveComputerDump.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; diff --git a/src/UniversalDiveDataFormat/Models/DiverDetails.cs b/src/UniversalDiveDataFormat/Models/DiverDetails.cs index 991a54d..87af65a 100644 --- a/src/UniversalDiveDataFormat/Models/DiverDetails.cs +++ b/src/UniversalDiveDataFormat/Models/DiverDetails.cs @@ -5,7 +5,7 @@ namespace UniversalDiveDataFormat.Models; public abstract class DiverDetails : ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("address")] public Address? Address { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Doctor.cs b/src/UniversalDiveDataFormat/Models/Doctor.cs index c183f8e..c93bc7c 100644 --- a/src/UniversalDiveDataFormat/Models/Doctor.cs +++ b/src/UniversalDiveDataFormat/Models/Doctor.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class Doctor: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("address")] public Address? Address { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/EquipmentConfiguration.cs b/src/UniversalDiveDataFormat/Models/EquipmentConfiguration.cs index bf28c02..071f895 100644 --- a/src/UniversalDiveDataFormat/Models/EquipmentConfiguration.cs +++ b/src/UniversalDiveDataFormat/Models/EquipmentConfiguration.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; @@ -6,7 +7,7 @@ namespace UniversalDiveDataFormat.Models; public class EquipmentConfiguration : ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("name")] public required string Name { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/EquipmentDetails.cs b/src/UniversalDiveDataFormat/Models/EquipmentDetails.cs index 128ed2b..02194ca 100644 --- a/src/UniversalDiveDataFormat/Models/EquipmentDetails.cs +++ b/src/UniversalDiveDataFormat/Models/EquipmentDetails.cs @@ -1,11 +1,12 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; public abstract class EquipmentDetails : ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("name")] public required string Name { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/EquipmentUsed.cs b/src/UniversalDiveDataFormat/Models/EquipmentUsed.cs index 35bcda9..ec2da1e 100644 --- a/src/UniversalDiveDataFormat/Models/EquipmentUsed.cs +++ b/src/UniversalDiveDataFormat/Models/EquipmentUsed.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; diff --git a/src/UniversalDiveDataFormat/Models/Generator.cs b/src/UniversalDiveDataFormat/Models/Generator.cs index d682f1b..67d3c47 100644 --- a/src/UniversalDiveDataFormat/Models/Generator.cs +++ b/src/UniversalDiveDataFormat/Models/Generator.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; diff --git a/src/UniversalDiveDataFormat/Models/Guide.cs b/src/UniversalDiveDataFormat/Models/Guide.cs index 2e62452..9af7411 100644 --- a/src/UniversalDiveDataFormat/Models/Guide.cs +++ b/src/UniversalDiveDataFormat/Models/Guide.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; diff --git a/src/UniversalDiveDataFormat/Models/Image.cs b/src/UniversalDiveDataFormat/Models/Image.cs index 390ea1f..6a2b2b7 100644 --- a/src/UniversalDiveDataFormat/Models/Image.cs +++ b/src/UniversalDiveDataFormat/Models/Image.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class Image : ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } // These should ideally be int? but the serializer doesn't like that [XmlAttribute("height")] diff --git a/src/UniversalDiveDataFormat/Models/InformationBeforeDive.cs b/src/UniversalDiveDataFormat/Models/InformationBeforeDive.cs index 591d95f..05baf37 100644 --- a/src/UniversalDiveDataFormat/Models/InformationBeforeDive.cs +++ b/src/UniversalDiveDataFormat/Models/InformationBeforeDive.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; diff --git a/src/UniversalDiveDataFormat/Models/InputProfile.cs b/src/UniversalDiveDataFormat/Models/InputProfile.cs index b036919..f5391cb 100644 --- a/src/UniversalDiveDataFormat/Models/InputProfile.cs +++ b/src/UniversalDiveDataFormat/Models/InputProfile.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; diff --git a/src/UniversalDiveDataFormat/Models/Instructor.cs b/src/UniversalDiveDataFormat/Models/Instructor.cs index b480ed6..4930411 100644 --- a/src/UniversalDiveDataFormat/Models/Instructor.cs +++ b/src/UniversalDiveDataFormat/Models/Instructor.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class Instructor: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("personal")] public required Personal Personal { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Link.cs b/src/UniversalDiveDataFormat/Models/Link.cs deleted file mode 100644 index a600c58..0000000 --- a/src/UniversalDiveDataFormat/Models/Link.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Xml.Serialization; - -namespace UniversalDiveDataFormat.Models; - -[XmlRoot("link")] -public class Link -{ - [XmlAttribute("ref")] - public required string Ref { get; init; } - - // public ILinkable? LinkedObject { get; init; } -} \ No newline at end of file diff --git a/src/UniversalDiveDataFormat/Models/ILinkable.cs b/src/UniversalDiveDataFormat/Models/Linking/ILinkable.cs similarity index 79% rename from src/UniversalDiveDataFormat/Models/ILinkable.cs rename to src/UniversalDiveDataFormat/Models/Linking/ILinkable.cs index b1c4d6b..7fdfa52 100644 --- a/src/UniversalDiveDataFormat/Models/ILinkable.cs +++ b/src/UniversalDiveDataFormat/Models/Linking/ILinkable.cs @@ -5,5 +5,5 @@ namespace UniversalDiveDataFormat.Models; public interface ILinkable { [XmlAttribute("id")] - public string Id { get; init; } + public string? Id { get; init; } } \ No newline at end of file diff --git a/src/UniversalDiveDataFormat/Models/Linking/Link.cs b/src/UniversalDiveDataFormat/Models/Linking/Link.cs new file mode 100644 index 0000000..7234357 --- /dev/null +++ b/src/UniversalDiveDataFormat/Models/Linking/Link.cs @@ -0,0 +1,21 @@ +using System.Xml.Serialization; + +namespace UniversalDiveDataFormat.Models.Linking; + +[XmlRoot("link")] +public class Link +{ + [XmlAttribute("ref")] + public required string Ref { get; init; } + + [XmlIgnore] + public ILinkable? LinkedObject { get; private set; } + + [XmlIgnore] + public bool IsResolved => LinkedObject is not null; + + public void SetLinkedObject(ILinkable? linkedObject) + { + LinkedObject = linkedObject; + } +} \ No newline at end of file diff --git a/src/UniversalDiveDataFormat/Models/Manufacturer.cs b/src/UniversalDiveDataFormat/Models/Manufacturer.cs index 92d24d5..82708a3 100644 --- a/src/UniversalDiveDataFormat/Models/Manufacturer.cs +++ b/src/UniversalDiveDataFormat/Models/Manufacturer.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class Manufacturer: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("name")] public required string Name { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Mix.cs b/src/UniversalDiveDataFormat/Models/Mix.cs index 66feddd..07a6923 100644 --- a/src/UniversalDiveDataFormat/Models/Mix.cs +++ b/src/UniversalDiveDataFormat/Models/Mix.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class Mix: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("name")] public required string Name { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Notes.cs b/src/UniversalDiveDataFormat/Models/Notes.cs index df6be9c..ef4d3a4 100644 --- a/src/UniversalDiveDataFormat/Models/Notes.cs +++ b/src/UniversalDiveDataFormat/Models/Notes.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; diff --git a/src/UniversalDiveDataFormat/Models/PointOfInterest.cs b/src/UniversalDiveDataFormat/Models/PointOfInterest.cs index 062b0d6..d6ef275 100644 --- a/src/UniversalDiveDataFormat/Models/PointOfInterest.cs +++ b/src/UniversalDiveDataFormat/Models/PointOfInterest.cs @@ -5,7 +5,7 @@ namespace UniversalDiveDataFormat.Models; public abstract class PointOfInterest : ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("name")] public required string Name { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Profile.cs b/src/UniversalDiveDataFormat/Models/Profile.cs index 68d740d..4da35a0 100644 --- a/src/UniversalDiveDataFormat/Models/Profile.cs +++ b/src/UniversalDiveDataFormat/Models/Profile.cs @@ -1,5 +1,6 @@ using System.Xml; using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; @@ -7,7 +8,7 @@ namespace UniversalDiveDataFormat.Models; public class Profile: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("applicationdata")] public XmlElement? ApplicationData { get; init; } // This stuff is application-specific diff --git a/src/UniversalDiveDataFormat/Models/Purchase.cs b/src/UniversalDiveDataFormat/Models/Purchase.cs index 5ae843a..90870af 100644 --- a/src/UniversalDiveDataFormat/Models/Purchase.cs +++ b/src/UniversalDiveDataFormat/Models/Purchase.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; diff --git a/src/UniversalDiveDataFormat/Models/RelatedDives.cs b/src/UniversalDiveDataFormat/Models/RelatedDives.cs index bae065d..801f96a 100644 --- a/src/UniversalDiveDataFormat/Models/RelatedDives.cs +++ b/src/UniversalDiveDataFormat/Models/RelatedDives.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; diff --git a/src/UniversalDiveDataFormat/Models/RepetitionGroup.cs b/src/UniversalDiveDataFormat/Models/RepetitionGroup.cs index ba4577a..b627a32 100644 --- a/src/UniversalDiveDataFormat/Models/RepetitionGroup.cs +++ b/src/UniversalDiveDataFormat/Models/RepetitionGroup.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class RepetitionGroup : ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("dive")] public List Dives { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/Rgbm.cs b/src/UniversalDiveDataFormat/Models/Rgbm.cs index 3b3130e..fc9cc8c 100644 --- a/src/UniversalDiveDataFormat/Models/Rgbm.cs +++ b/src/UniversalDiveDataFormat/Models/Rgbm.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class Rgbm: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("tissue")] public List Tissues { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/Shop.cs b/src/UniversalDiveDataFormat/Models/Shop.cs index d7f06a5..9ffffe4 100644 --- a/src/UniversalDiveDataFormat/Models/Shop.cs +++ b/src/UniversalDiveDataFormat/Models/Shop.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class Shop: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("name")] public required string Name { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Site.cs b/src/UniversalDiveDataFormat/Models/Site.cs index 4bdad36..1186934 100644 --- a/src/UniversalDiveDataFormat/Models/Site.cs +++ b/src/UniversalDiveDataFormat/Models/Site.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; @@ -6,7 +7,7 @@ namespace UniversalDiveDataFormat.Models; public class Site: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("name")] public required string Name { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Species.cs b/src/UniversalDiveDataFormat/Models/Species.cs index d4b4de1..56b10ac 100644 --- a/src/UniversalDiveDataFormat/Models/Species.cs +++ b/src/UniversalDiveDataFormat/Models/Species.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class Species : ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("trivialname")] public string? TrivialName { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/TankData.cs b/src/UniversalDiveDataFormat/Models/TankData.cs index 06dc4cd..f002df2 100644 --- a/src/UniversalDiveDataFormat/Models/TankData.cs +++ b/src/UniversalDiveDataFormat/Models/TankData.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; @@ -6,7 +7,7 @@ namespace UniversalDiveDataFormat.Models; public class TankData: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("breathingconsumptionvolume")] public float? BreathingConsumptionVolumeInMetersCubedPerSecond { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Trip.cs b/src/UniversalDiveDataFormat/Models/Trip.cs index 41720f6..3bdc0c3 100644 --- a/src/UniversalDiveDataFormat/Models/Trip.cs +++ b/src/UniversalDiveDataFormat/Models/Trip.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class Trip: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("name")] public required string Name { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/TripPart.cs b/src/UniversalDiveDataFormat/Models/TripPart.cs index dfdc246..40cb50e 100644 --- a/src/UniversalDiveDataFormat/Models/TripPart.cs +++ b/src/UniversalDiveDataFormat/Models/TripPart.cs @@ -1,4 +1,5 @@ using System.Xml.Serialization; +using UniversalDiveDataFormat.Models.Linking; namespace UniversalDiveDataFormat.Models; diff --git a/src/UniversalDiveDataFormat/Models/Video.cs b/src/UniversalDiveDataFormat/Models/Video.cs index d9220f7..d798944 100644 --- a/src/UniversalDiveDataFormat/Models/Video.cs +++ b/src/UniversalDiveDataFormat/Models/Video.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class Video: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("objectname")] public required string ObjectName { get; init; } [XmlElement("title")] diff --git a/src/UniversalDiveDataFormat/Models/VideoCamera.cs b/src/UniversalDiveDataFormat/Models/VideoCamera.cs index 00517e9..3dfad50 100644 --- a/src/UniversalDiveDataFormat/Models/VideoCamera.cs +++ b/src/UniversalDiveDataFormat/Models/VideoCamera.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class VideoCamera: ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("body")] public Body? Body { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Vpm.cs b/src/UniversalDiveDataFormat/Models/Vpm.cs index 8b1e9fb..b44d8f8 100644 --- a/src/UniversalDiveDataFormat/Models/Vpm.cs +++ b/src/UniversalDiveDataFormat/Models/Vpm.cs @@ -6,7 +6,7 @@ namespace UniversalDiveDataFormat.Models; public class Vpm : ILinkable { [XmlAttribute("id")] - public required string Id { get; init; } + public string? Id { get; init; } [XmlElement("conservatism")] public float? Conservatism { get; init; } From 151144b69ea2469b0d034c82ed517de2bccfd45a Mon Sep 17 00:00:00 2001 From: James Hughes Date: Mon, 6 May 2024 19:54:41 +0100 Subject: [PATCH 02/15] Can seemingly resolve links but it's a horror show --- .../Services/LinkResolutionServiceTests.cs | 157 ++++++++++++++++++ .../Services/LinkResolutionService.cs | 110 ++++++++++++ 2 files changed, 267 insertions(+) create mode 100644 src/UniversalDiveDataFormat.Tests/Services/LinkResolutionServiceTests.cs create mode 100644 src/UniversalDiveDataFormat/Services/LinkResolutionService.cs diff --git a/src/UniversalDiveDataFormat.Tests/Services/LinkResolutionServiceTests.cs b/src/UniversalDiveDataFormat.Tests/Services/LinkResolutionServiceTests.cs new file mode 100644 index 0000000..9490589 --- /dev/null +++ b/src/UniversalDiveDataFormat.Tests/Services/LinkResolutionServiceTests.cs @@ -0,0 +1,157 @@ +using System.Xml.Serialization; +using Shouldly; +using UniversalDiveDataFormat.ExtensionMethods; +using UniversalDiveDataFormat.Models; +using UniversalDiveDataFormat.Services; + +namespace UniversalDiveDataFormat.Tests.Services; + +public class LinkResolutionServiceTests +{ + private const string Xml = """ + + + + Arno's flatfeet... + flatfeet.jpg + + + + + + + +
+ +
+ + + + + + 2003-04-12 + + + Dirk + Dusel + Dr. + male + + + +
+ Duddelstr. 34 + Dortmund + 54321 + Deutschland + Nordrhein-Westfalen +
+ + deutsch + 01234/987654 + +
+ passed + + + Flatfeet don't seem to affect dive fitness :-) + + + +
+ + 2004-04-20 + + passed + +
+ + + Bronze + VDST/CMAS + + 1994-03-15 + + + + Orientation + VDST/CMAS + + 1994-03-15 + + + + Silver + VDST/CMAS + + 1997-11-26 + + + + Gold + VDST/CMAS + + 2000-05-10 + + + + + + DiveCard + Austria + + 2004-08-24 + + + 2005-08-23 + + + + Zeeland + Zeeland (The Netherlands) + + 1996-09-03:00 + + + 2001-08-31 + + + +
+ + + Bertie + Bammel + + + airsucker@deepdiving.info + http://www.deepdiving.info/bertie + + + + + Carl + Cabuff + + + lurchi@abcde.com + http://www.deepdiving.info/carl + + +
+
+ """; + + [Fact] + public void CanResolveLinks() + { + XmlSerializer serializer = new(typeof(UniversalDiveDataFormatRoot)); + UniversalDiveDataFormatRoot uddf = serializer.Deserialize(Xml); + + LinkResolutionService lrs = new(); + lrs.ResolveAllLinksInObjectGraph(uddf); + + var linkedImage = uddf.MediaData!.ImageFiles[0]; + uddf.Diver!.Owner!.Medical!.Examinations[0].Notes!.Links[0].LinkedObject.ShouldBe(linkedImage); + } +} \ No newline at end of file diff --git a/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs b/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs new file mode 100644 index 0000000..6076cec --- /dev/null +++ b/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs @@ -0,0 +1,110 @@ +using System.Collections; +using System.Reflection; +using UniversalDiveDataFormat.Models; +using UniversalDiveDataFormat.Models.Linking; + +namespace UniversalDiveDataFormat.Services; + +// I don't generally work with XML, so if there's a built-in way to do this, let me know +// This is also a bit smarter than the UDDF spec says it should be, not requiring elements to already +// be declared before their link since it does a full parse before resolving the links +public class LinkResolutionService +{ + private readonly Dictionary _linkableLookup; + private readonly List _links; + + private readonly bool _failOnMissingLink; + + public LinkResolutionService(bool failOnMissingLink = true) + { + _failOnMissingLink = failOnMissingLink; + _linkableLookup = new(); + _links = []; + } + + public void ResolveAllLinksInObjectGraph(object root) + { + // Maybe make everything inherit from an empty base and use that rather than object + if (!IsInModelNamespace(root.GetType())) + { + throw new ArgumentException("The root object must belong to the UDDF Models namespace"); + } + + FindAllLinkablesAndLinksInSubgraph(root); + BuildLinks(); + } + + private void BuildLinks() + { + foreach (Link link in _links) + { + if (!_linkableLookup.TryGetValue(link.Ref, out ILinkable? linkable) && _failOnMissingLink) + { + throw new ArgumentException($"The linkable with id {link.Ref} could not be found"); + } + + link.SetLinkedObject(linkable); + } + } + + private void FindAllLinkablesAndLinksInSubgraph(object root) + { + foreach (object model in AllModelObjectsInGraph(root)) + { + if (model.GetType().IsAssignableTo(typeof(ILinkable))) + { + ILinkable linkable = (ILinkable)model; + if (linkable.Id is not null) + { + _linkableLookup[linkable.Id] = linkable; + } + } + + if (model is Link link) + { + _links.Add(link); + } + } + } + + private bool IsInModelNamespace(Type t) => t.Namespace!.StartsWith("UniversalDiveDataFormat.Models"); + private bool IsList(Type type) => type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableTo(typeof(IList)); + + IEnumerable AllModelObjectsInGraph(object root) + { + PropertyInfo[] properties = root.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty); + + foreach (PropertyInfo property in properties) + { + object? propertyValue = property.GetValue(root); + if (propertyValue is null) continue; + if (IsList(property.PropertyType)) + { + IList list = (IList)propertyValue!; + foreach (object? item in list) + { + if (item is null) continue; + if (IsInModelNamespace(item.GetType())) // This could be moved out and read reflectively + { + yield return item; + foreach (var innerObject in AllModelObjectsInGraph(item)) + { + yield return innerObject; + } + } + } + continue; + } + + if (!IsInModelNamespace(property.PropertyType)) continue; + + yield return propertyValue; + foreach (var innerObject in AllModelObjectsInGraph(propertyValue)) + { + yield return innerObject; + } + } + + } + +} From 27bb7ca17426c36ee094b7403591b06d9e10c8a2 Mon Sep 17 00:00:00 2001 From: James Hughes Date: Mon, 6 May 2024 20:26:07 +0100 Subject: [PATCH 03/15] Slight refactoring --- .../Services/LinkResolutionService.cs | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs b/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs index 6076cec..19bc2ce 100644 --- a/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs +++ b/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs @@ -67,10 +67,14 @@ private void FindAllLinkablesAndLinksInSubgraph(object root) } } - private bool IsInModelNamespace(Type t) => t.Namespace!.StartsWith("UniversalDiveDataFormat.Models"); - private bool IsList(Type type) => type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableTo(typeof(IList)); + private static bool IsInModelNamespace(Type t) => t.Namespace!.StartsWith("UniversalDiveDataFormat.Models"); + private static bool IsList(Type type) => type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableTo(typeof(IList)); + private static bool IsListOfModelObjects(Type type) => IsList(type) && IsInModelNamespace(type.GetGenericArguments().Single()); - IEnumerable AllModelObjectsInGraph(object root) + + // This is horrible... but it works. + // Not sure how to tidy it up and keep it as an Enumerable + private IEnumerable AllModelObjectsInGraph(object root) { PropertyInfo[] properties = root.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty); @@ -78,19 +82,16 @@ IEnumerable AllModelObjectsInGraph(object root) { object? propertyValue = property.GetValue(root); if (propertyValue is null) continue; - if (IsList(property.PropertyType)) + if (IsListOfModelObjects(property.PropertyType)) { - IList list = (IList)propertyValue!; - foreach (object? item in list) + IList list = (IList)propertyValue; + foreach (object? item in list) { if (item is null) continue; - if (IsInModelNamespace(item.GetType())) // This could be moved out and read reflectively + yield return item; + foreach (var innerObject in AllModelObjectsInGraph(item)) { - yield return item; - foreach (var innerObject in AllModelObjectsInGraph(item)) - { - yield return innerObject; - } + yield return innerObject; } } continue; @@ -99,12 +100,11 @@ IEnumerable AllModelObjectsInGraph(object root) if (!IsInModelNamespace(property.PropertyType)) continue; yield return propertyValue; - foreach (var innerObject in AllModelObjectsInGraph(propertyValue)) + foreach (object innerObject in AllModelObjectsInGraph(propertyValue)) { yield return innerObject; } } - } } From 3ddc85f52ff41c2e8cfce752ed009c7b8a919415 Mon Sep 17 00:00:00 2001 From: James Hughes Date: Mon, 6 May 2024 20:49:00 +0100 Subject: [PATCH 04/15] Hammer crack nut... --- .../Services/LinkResolutionService.cs | 66 ++++++++----------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs b/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs index 19bc2ce..fa7bfea 100644 --- a/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs +++ b/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs @@ -47,34 +47,11 @@ private void BuildLinks() } } - private void FindAllLinkablesAndLinksInSubgraph(object root) - { - foreach (object model in AllModelObjectsInGraph(root)) - { - if (model.GetType().IsAssignableTo(typeof(ILinkable))) - { - ILinkable linkable = (ILinkable)model; - if (linkable.Id is not null) - { - _linkableLookup[linkable.Id] = linkable; - } - } - - if (model is Link link) - { - _links.Add(link); - } - } - } - private static bool IsInModelNamespace(Type t) => t.Namespace!.StartsWith("UniversalDiveDataFormat.Models"); private static bool IsList(Type type) => type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableTo(typeof(IList)); private static bool IsListOfModelObjects(Type type) => IsList(type) && IsInModelNamespace(type.GetGenericArguments().Single()); - - // This is horrible... but it works. - // Not sure how to tidy it up and keep it as an Enumerable - private IEnumerable AllModelObjectsInGraph(object root) + private void FindAllLinkablesAndLinksInSubgraph(object root) { PropertyInfo[] properties = root.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty); @@ -84,27 +61,42 @@ private IEnumerable AllModelObjectsInGraph(object root) if (propertyValue is null) continue; if (IsListOfModelObjects(property.PropertyType)) { - IList list = (IList)propertyValue; - foreach (object? item in list) - { - if (item is null) continue; - yield return item; - foreach (var innerObject in AllModelObjectsInGraph(item)) - { - yield return innerObject; - } - } + ProcessListOfModelObjects((IList)propertyValue); continue; } if (!IsInModelNamespace(property.PropertyType)) continue; - yield return propertyValue; - foreach (object innerObject in AllModelObjectsInGraph(propertyValue)) + ProcessModelObject(propertyValue); + FindAllLinkablesAndLinksInSubgraph(propertyValue); + } + } + + private void ProcessListOfModelObjects(IList list) + { + foreach (object? item in list) + { + if (item is null) continue; + ProcessModelObject(item); + FindAllLinkablesAndLinksInSubgraph(item); + } + } + + private void ProcessModelObject(object model) + { + if (model.GetType().IsAssignableTo(typeof(ILinkable))) + { + ILinkable linkable = (ILinkable)model; + if (linkable.Id is not null) { - yield return innerObject; + _linkableLookup[linkable.Id] = linkable; } } + + if (model is Link link) + { + _links.Add(link); + } } } From 1b448a1a3cf4beff77440fdba07b883299fe229f Mon Sep 17 00:00:00 2001 From: James Hughes Date: Mon, 6 May 2024 20:50:03 +0100 Subject: [PATCH 05/15] Use base IEnumerable --- .../Services/LinkResolutionService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs b/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs index fa7bfea..985cdc6 100644 --- a/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs +++ b/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs @@ -48,7 +48,7 @@ private void BuildLinks() } private static bool IsInModelNamespace(Type t) => t.Namespace!.StartsWith("UniversalDiveDataFormat.Models"); - private static bool IsList(Type type) => type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableTo(typeof(IList)); + private static bool IsList(Type type) => type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableTo(typeof(IEnumerable)); private static bool IsListOfModelObjects(Type type) => IsList(type) && IsInModelNamespace(type.GetGenericArguments().Single()); private void FindAllLinkablesAndLinksInSubgraph(object root) @@ -61,7 +61,7 @@ private void FindAllLinkablesAndLinksInSubgraph(object root) if (propertyValue is null) continue; if (IsListOfModelObjects(property.PropertyType)) { - ProcessListOfModelObjects((IList)propertyValue); + ProcessListOfModelObjects((IEnumerable)propertyValue); continue; } @@ -72,7 +72,7 @@ private void FindAllLinkablesAndLinksInSubgraph(object root) } } - private void ProcessListOfModelObjects(IList list) + private void ProcessListOfModelObjects(IEnumerable list) { foreach (object? item in list) { From 0526bae433d6341a053c45d4fca88524767f4697 Mon Sep 17 00:00:00 2001 From: James Hughes Date: Mon, 6 May 2024 22:08:19 +0100 Subject: [PATCH 06/15] Refactored to make less horrible --- .../Services/LinkResolutionService.cs | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs b/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs index 985cdc6..19834df 100644 --- a/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs +++ b/src/UniversalDiveDataFormat/Services/LinkResolutionService.cs @@ -14,6 +14,11 @@ public class LinkResolutionService private readonly List _links; private readonly bool _failOnMissingLink; + + private static bool IsInModelNamespace(Type t) => t.Namespace!.StartsWith("UniversalDiveDataFormat.Models"); + private static bool IsList(Type type) => type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableTo(typeof(IEnumerable)); + private static bool IsListOfModelObjects(Type type) => IsList(type) && IsInModelNamespace(type.GetGenericArguments().Single()); + public LinkResolutionService(bool failOnMissingLink = true) { @@ -24,6 +29,8 @@ public LinkResolutionService(bool failOnMissingLink = true) public void ResolveAllLinksInObjectGraph(object root) { + _linkableLookup.Clear(); + _links.Clear(); // Maybe make everything inherit from an empty base and use that rather than object if (!IsInModelNamespace(root.GetType())) { @@ -46,41 +53,26 @@ private void BuildLinks() link.SetLinkedObject(linkable); } } - - private static bool IsInModelNamespace(Type t) => t.Namespace!.StartsWith("UniversalDiveDataFormat.Models"); - private static bool IsList(Type type) => type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableTo(typeof(IEnumerable)); - private static bool IsListOfModelObjects(Type type) => IsList(type) && IsInModelNamespace(type.GetGenericArguments().Single()); - private void FindAllLinkablesAndLinksInSubgraph(object root) + private void FindAllLinkablesAndLinksInSubgraph(object? root) { + if (root is null) return; PropertyInfo[] properties = root.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty); - + ProcessModelObject(root); foreach (PropertyInfo property in properties) { object? propertyValue = property.GetValue(root); if (propertyValue is null) continue; if (IsListOfModelObjects(property.PropertyType)) { - ProcessListOfModelObjects((IEnumerable)propertyValue); + ((IEnumerable)propertyValue).Cast().ToList().ForEach(FindAllLinkablesAndLinksInSubgraph); continue; } if (!IsInModelNamespace(property.PropertyType)) continue; - - ProcessModelObject(propertyValue); FindAllLinkablesAndLinksInSubgraph(propertyValue); } } - - private void ProcessListOfModelObjects(IEnumerable list) - { - foreach (object? item in list) - { - if (item is null) continue; - ProcessModelObject(item); - FindAllLinkablesAndLinksInSubgraph(item); - } - } private void ProcessModelObject(object model) { From b78f7dfc8f957c6a7aa786afd4aa53cb30eb4ef3 Mon Sep 17 00:00:00 2001 From: James Hughes Date: Mon, 6 May 2024 22:45:01 +0100 Subject: [PATCH 07/15] Added UddfModel base to everything BREAKING CHANGE: Everything now has a base class whereas previously we relied on namespaces to do this. --- .../Models/Abundance.cs | 2 +- .../Models/Accommodation.cs | 2 +- .../Models/Acknowledge.cs | 2 +- src/UniversalDiveDataFormat/Models/Address.cs | 2 +- .../Models/AlcoholBeforeDive.cs | 2 +- .../Models/AnySymptoms.cs | 2 +- src/UniversalDiveDataFormat/Models/Ascent.cs | 2 +- src/UniversalDiveDataFormat/Models/Audio.cs | 2 +- .../Models/BirthDate.cs | 2 +- .../Models/BottomTimeTable.cs | 2 +- .../Models/BottomTimeTableScope.cs | 2 +- .../Models/Buehlmann.cs | 2 +- src/UniversalDiveDataFormat/Models/Built.cs | 2 +- .../Models/Business.cs | 2 +- .../Models/CalculateBottomTimeTable.cs | 2 +- .../Models/CalculateProfile.cs | 2 +- .../Models/CalculateTable.cs | 2 +- src/UniversalDiveDataFormat/Models/Camera.cs | 2 +- .../Models/Certification.cs | 2 +- src/UniversalDiveDataFormat/Models/Contact.cs | 2 +- .../Models/DateOfFlight.cs | 2 +- .../Models/DateOfTrip.cs | 2 +- .../Models/DecoModel.cs | 2 +- src/UniversalDiveDataFormat/Models/Descent.cs | 2 +- src/UniversalDiveDataFormat/Models/Dive.cs | 2 +- .../Models/DiveBase.cs | 2 +- .../Models/DiveComputerAlarm.cs | 2 +- .../Models/DiveComputerControl.cs | 2 +- .../Models/DiveComputerDump.cs | 2 +- .../Models/DiveInsurances.cs | 2 +- .../Models/DivePermissions.cs | 2 +- .../Models/DiveSite.cs | 2 +- .../Models/DiveTrips.cs | 2 +- src/UniversalDiveDataFormat/Models/Diver.cs | 2 +- .../Models/DiverDetails.cs | 6 +-- src/UniversalDiveDataFormat/Models/Doctor.cs | 2 +- src/UniversalDiveDataFormat/Models/Drug.cs | 4 +- src/UniversalDiveDataFormat/Models/Ecology.cs | 2 +- .../Models/Education.cs | 2 +- .../Models/Equipment.cs | 2 +- .../Models/EquipmentConfiguration.cs | 2 +- .../Models/EquipmentDetails.cs | 42 ++++++++--------- .../Models/EquipmentUsed.cs | 2 +- .../Models/ExposureToAltitude.cs | 2 +- src/UniversalDiveDataFormat/Models/Fauna.cs | 2 +- src/UniversalDiveDataFormat/Models/Flora.cs | 2 +- .../Models/GasDefinitions.cs | 2 +- .../Models/Generator.cs | 2 +- .../Models/Geography.cs | 2 +- .../Models/GetDiveComputerData.cs | 18 ++++---- .../Models/GlobalAlarmsGiven.cs | 2 +- src/UniversalDiveDataFormat/Models/Guide.cs | 2 +- src/UniversalDiveDataFormat/Models/Image.cs | 2 +- .../Models/ImageData.cs | 2 +- .../Models/Infinity.cs | 2 +- .../Models/InformationAfterDive.cs | 2 +- .../Models/InformationBeforeDive.cs | 2 +- .../Models/InputProfile.cs | 2 +- .../Models/Instructor.cs | 2 +- .../Models/Insurance.cs | 2 +- .../Models/Invertebrata.cs | 2 +- .../Models/IssueDate.cs | 2 +- .../Models/LaunchingDate.cs | 2 +- .../Models/Linking/Link.cs | 2 +- src/UniversalDiveDataFormat/Models/Maker.cs | 2 +- .../Models/Manufacturer.cs | 2 +- .../Models/MediaData.cs | 2 +- src/UniversalDiveDataFormat/Models/Medical.cs | 2 +- .../Models/MedicalExamination.cs | 2 +- .../Models/MedicationBeforeDive.cs | 2 +- src/UniversalDiveDataFormat/Models/Mix.cs | 2 +- .../Models/MixChange.cs | 2 +- .../Models/NextServiceDate.cs | 2 +- src/UniversalDiveDataFormat/Models/NoSuit.cs | 2 +- src/UniversalDiveDataFormat/Models/Notes.cs | 2 +- .../Models/NumberOfDives.cs | 2 +- .../Models/Observations.cs | 2 +- .../Models/Operator.cs | 2 +- src/UniversalDiveDataFormat/Models/Output.cs | 2 +- src/UniversalDiveDataFormat/Models/Permit.cs | 2 +- .../Models/Personal.cs | 2 +- .../Models/PlannedProfile.cs | 2 +- .../Models/PointOfInterest.cs | 14 +++--- src/UniversalDiveDataFormat/Models/Price.cs | 15 ++++-- .../Models/PriceDivePackage.cs | 13 ------ src/UniversalDiveDataFormat/Models/Profile.cs | 2 +- .../Models/ProfileData.cs | 2 +- .../Models/Purchase.cs | 2 +- src/UniversalDiveDataFormat/Models/Rating.cs | 2 +- .../Models/RelatedDives.cs | 2 +- .../Models/RepetitionGroup.cs | 2 +- src/UniversalDiveDataFormat/Models/Rgbm.cs | 2 +- src/UniversalDiveDataFormat/Models/Samples.cs | 2 +- .../Models/SetDiveComputerAlarmTime.cs | 2 +- .../Models/SetDiveComputerBuddyData.cs | 2 +- .../Models/SetDiveComputerData.cs | 8 ++-- .../Models/SetDiveComputerDateTime.cs | 2 +- .../Models/SetDiveComputerDecoModel.cs | 2 +- .../Models/SetDiveComputerDiveDepthAlarm.cs | 2 +- .../Models/SetDiveComputerDiveSiteData.cs | 2 +- .../Models/SetDiveComputerDiveTimeAlarm.cs | 2 +- .../SetDiveComputerEndNoDecoTimeAlarm.cs | 2 +- ...SetDiveComputerPartialPressureOfO2Alarm.cs | 2 +- .../Models/SetDiveComputerPassword.cs | 2 +- .../Models/ShipDimension.cs | 2 +- src/UniversalDiveDataFormat/Models/Shop.cs | 2 +- src/UniversalDiveDataFormat/Models/Site.cs | 2 +- .../Models/SiteData.cs | 2 +- src/UniversalDiveDataFormat/Models/Species.cs | 2 +- src/UniversalDiveDataFormat/Models/Sunk.cs | 2 +- .../Models/SurfaceInterval.cs | 4 +- .../Models/SwitchMix.cs | 2 +- src/UniversalDiveDataFormat/Models/Table.cs | 2 +- .../Models/TableGeneration.cs | 2 +- .../Models/TableScope.cs | 2 +- .../Models/TankData.cs | 2 +- .../Models/TaxonomicClass.cs | 46 +++++++++---------- src/UniversalDiveDataFormat/Models/Tissue.cs | 2 +- src/UniversalDiveDataFormat/Models/Trip.cs | 2 +- .../Models/TripPart.cs | 2 +- .../Models/UddfModel.cs | 3 ++ .../Models/UniversalDiveDataFormatRoot.cs | 2 +- .../Models/ValidDate.cs | 2 +- .../Models/Vertebrata.cs | 2 +- src/UniversalDiveDataFormat/Models/Vessel.cs | 2 +- src/UniversalDiveDataFormat/Models/Video.cs | 2 +- .../Models/VideoCamera.cs | 2 +- src/UniversalDiveDataFormat/Models/Vpm.cs | 2 +- .../Models/WayAltitude.cs | 2 +- .../Models/Waypoint.cs | 2 +- 130 files changed, 205 insertions(+), 206 deletions(-) delete mode 100644 src/UniversalDiveDataFormat/Models/PriceDivePackage.cs create mode 100644 src/UniversalDiveDataFormat/Models/UddfModel.cs diff --git a/src/UniversalDiveDataFormat/Models/Abundance.cs b/src/UniversalDiveDataFormat/Models/Abundance.cs index e2103f5..84e784c 100644 --- a/src/UniversalDiveDataFormat/Models/Abundance.cs +++ b/src/UniversalDiveDataFormat/Models/Abundance.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("abundance")] -public class Abundance +public class Abundance: UddfModel { [XmlAttribute("quality")] public Quality Quality { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Accommodation.cs b/src/UniversalDiveDataFormat/Models/Accommodation.cs index 39c8084..c92077c 100644 --- a/src/UniversalDiveDataFormat/Models/Accommodation.cs +++ b/src/UniversalDiveDataFormat/Models/Accommodation.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("accommodation")] -public class Accommodation +public class Accommodation: UddfModel { [XmlElement("name")] public required string Name { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Acknowledge.cs b/src/UniversalDiveDataFormat/Models/Acknowledge.cs index a7e9355..8317c0c 100644 --- a/src/UniversalDiveDataFormat/Models/Acknowledge.cs +++ b/src/UniversalDiveDataFormat/Models/Acknowledge.cs @@ -3,4 +3,4 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("acknowledge")] -public class Acknowledge; \ No newline at end of file +public class Acknowledge: UddfModel; \ No newline at end of file diff --git a/src/UniversalDiveDataFormat/Models/Address.cs b/src/UniversalDiveDataFormat/Models/Address.cs index d68bf83..b8051a2 100644 --- a/src/UniversalDiveDataFormat/Models/Address.cs +++ b/src/UniversalDiveDataFormat/Models/Address.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("address")] -public class Address +public class Address: UddfModel { [XmlElement("street")] public string? Street { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/AlcoholBeforeDive.cs b/src/UniversalDiveDataFormat/Models/AlcoholBeforeDive.cs index 53f9d95..dbeb601 100644 --- a/src/UniversalDiveDataFormat/Models/AlcoholBeforeDive.cs +++ b/src/UniversalDiveDataFormat/Models/AlcoholBeforeDive.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("alcoholbeforedive")] -public class AlcoholBeforeDive +public class AlcoholBeforeDive: UddfModel { [XmlElement("drink")] public List Drinks { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/AnySymptoms.cs b/src/UniversalDiveDataFormat/Models/AnySymptoms.cs index 1e5de04..3c210e3 100644 --- a/src/UniversalDiveDataFormat/Models/AnySymptoms.cs +++ b/src/UniversalDiveDataFormat/Models/AnySymptoms.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("anysymptoms")] -public class AnySymptoms +public class AnySymptoms: UddfModel { [XmlElement("notes")] public Notes? Notes { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Ascent.cs b/src/UniversalDiveDataFormat/Models/Ascent.cs index e03332f..16b1ace 100644 --- a/src/UniversalDiveDataFormat/Models/Ascent.cs +++ b/src/UniversalDiveDataFormat/Models/Ascent.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("ascent")] -public class Ascent +public class Ascent: UddfModel { [XmlElement("waypoint")] public List Waypoints { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/Audio.cs b/src/UniversalDiveDataFormat/Models/Audio.cs index e43a401..8427b27 100644 --- a/src/UniversalDiveDataFormat/Models/Audio.cs +++ b/src/UniversalDiveDataFormat/Models/Audio.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("audio")] -public class Audio: ILinkable +public class Audio: UddfModel, ILinkable { [XmlAttribute("id")] public string? Id { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/BirthDate.cs b/src/UniversalDiveDataFormat/Models/BirthDate.cs index 87fa805..cdfafe5 100644 --- a/src/UniversalDiveDataFormat/Models/BirthDate.cs +++ b/src/UniversalDiveDataFormat/Models/BirthDate.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("birthdate")] -public class BirthDate +public class BirthDate: UddfModel { [XmlElement("datetime")] public required DateTime DateTime { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/BottomTimeTable.cs b/src/UniversalDiveDataFormat/Models/BottomTimeTable.cs index e221a5e..8d1877c 100644 --- a/src/UniversalDiveDataFormat/Models/BottomTimeTable.cs +++ b/src/UniversalDiveDataFormat/Models/BottomTimeTable.cs @@ -5,7 +5,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("bottomtimetable")] -public class BottomTimeTable: ILinkable +public class BottomTimeTable: UddfModel, ILinkable { [XmlAttribute("id")] public string? Id { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/BottomTimeTableScope.cs b/src/UniversalDiveDataFormat/Models/BottomTimeTableScope.cs index 197654a..06ab45d 100644 --- a/src/UniversalDiveDataFormat/Models/BottomTimeTableScope.cs +++ b/src/UniversalDiveDataFormat/Models/BottomTimeTableScope.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("bottomtimetablescope")] -public class BottomTimeTableScope +public class BottomTimeTableScope: UddfModel { [XmlElement("breathingconsumptionvolumebegin")] public required float BreathingConsumptionVolumeBeginInCubicMetersPerSecond { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Buehlmann.cs b/src/UniversalDiveDataFormat/Models/Buehlmann.cs index dd544cc..eb6f786 100644 --- a/src/UniversalDiveDataFormat/Models/Buehlmann.cs +++ b/src/UniversalDiveDataFormat/Models/Buehlmann.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("buehlmann")] -public class Buehlmann: ILinkable +public class Buehlmann: UddfModel, ILinkable { [XmlAttribute("id")] public string? Id { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Built.cs b/src/UniversalDiveDataFormat/Models/Built.cs index a4a3311..f3ab580 100644 --- a/src/UniversalDiveDataFormat/Models/Built.cs +++ b/src/UniversalDiveDataFormat/Models/Built.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("built")] -public class Built +public class Built: UddfModel { [XmlElement("shipyard")] public string? Shipyard { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Business.cs b/src/UniversalDiveDataFormat/Models/Business.cs index ecd7ac2..99dfd60 100644 --- a/src/UniversalDiveDataFormat/Models/Business.cs +++ b/src/UniversalDiveDataFormat/Models/Business.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("business")] -public class Business +public class Business: UddfModel { [XmlElement("shop")] public List Shops { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/CalculateBottomTimeTable.cs b/src/UniversalDiveDataFormat/Models/CalculateBottomTimeTable.cs index 2d5a491..2c5fd63 100644 --- a/src/UniversalDiveDataFormat/Models/CalculateBottomTimeTable.cs +++ b/src/UniversalDiveDataFormat/Models/CalculateBottomTimeTable.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("calculatebottomtimetable")] -public class CalculateBottomTimeTable +public class CalculateBottomTimeTable: UddfModel { [XmlElement("bottomtimetable")] public List BottomTimeTables { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/CalculateProfile.cs b/src/UniversalDiveDataFormat/Models/CalculateProfile.cs index 37bd4f3..492021d 100644 --- a/src/UniversalDiveDataFormat/Models/CalculateProfile.cs +++ b/src/UniversalDiveDataFormat/Models/CalculateProfile.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("calculateprofile")] -public class CalculateProfile +public class CalculateProfile: UddfModel { [XmlElement("profile")] public List Profiles { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/CalculateTable.cs b/src/UniversalDiveDataFormat/Models/CalculateTable.cs index 3a0b7ce..cdcb8ad 100644 --- a/src/UniversalDiveDataFormat/Models/CalculateTable.cs +++ b/src/UniversalDiveDataFormat/Models/CalculateTable.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("calculatetable")] -public class CalculateTable +public class CalculateTable: UddfModel { [XmlElement("table")] public List Tables { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/Camera.cs b/src/UniversalDiveDataFormat/Models/Camera.cs index 309b6bc..5a66bcd 100644 --- a/src/UniversalDiveDataFormat/Models/Camera.cs +++ b/src/UniversalDiveDataFormat/Models/Camera.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("camera")] -public class Camera: ILinkable +public class Camera: UddfModel, ILinkable { [XmlAttribute("id")] public required string Id{ get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Certification.cs b/src/UniversalDiveDataFormat/Models/Certification.cs index 0447792..024bbee 100644 --- a/src/UniversalDiveDataFormat/Models/Certification.cs +++ b/src/UniversalDiveDataFormat/Models/Certification.cs @@ -4,7 +4,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("certification")] -public class Certification +public class Certification: UddfModel { [XmlElement("level")] public string? Level { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Contact.cs b/src/UniversalDiveDataFormat/Models/Contact.cs index f8a1874..58c8f72 100644 --- a/src/UniversalDiveDataFormat/Models/Contact.cs +++ b/src/UniversalDiveDataFormat/Models/Contact.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("contact")] -public class Contact +public class Contact: UddfModel { [XmlElement("email")] public List Emails { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/DateOfFlight.cs b/src/UniversalDiveDataFormat/Models/DateOfFlight.cs index 7801906..50167d2 100644 --- a/src/UniversalDiveDataFormat/Models/DateOfFlight.cs +++ b/src/UniversalDiveDataFormat/Models/DateOfFlight.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("dateofflight")] -public class DateOfFlight +public class DateOfFlight: UddfModel { [XmlElement("datetime")] public DateTime? DateTime { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/DateOfTrip.cs b/src/UniversalDiveDataFormat/Models/DateOfTrip.cs index 1edbe14..3a982ef 100644 --- a/src/UniversalDiveDataFormat/Models/DateOfTrip.cs +++ b/src/UniversalDiveDataFormat/Models/DateOfTrip.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("dateoftrip")] -public class DateOfTrip +public class DateOfTrip: UddfModel { [XmlAttribute("startdate")] public required DateTime StartDate { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/DecoModel.cs b/src/UniversalDiveDataFormat/Models/DecoModel.cs index cd8346d..bf512df 100644 --- a/src/UniversalDiveDataFormat/Models/DecoModel.cs +++ b/src/UniversalDiveDataFormat/Models/DecoModel.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("decomodel")] -public class DecoModel +public class DecoModel: UddfModel { [XmlElement("buehlmann")] public List BuehlmannModels { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/Descent.cs b/src/UniversalDiveDataFormat/Models/Descent.cs index c070959..b214b43 100644 --- a/src/UniversalDiveDataFormat/Models/Descent.cs +++ b/src/UniversalDiveDataFormat/Models/Descent.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("descent")] -public class Descent +public class Descent: UddfModel { [XmlElement("waypoint")] public List Waypoints { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/Dive.cs b/src/UniversalDiveDataFormat/Models/Dive.cs index 059863b..1d9bdb7 100644 --- a/src/UniversalDiveDataFormat/Models/Dive.cs +++ b/src/UniversalDiveDataFormat/Models/Dive.cs @@ -5,7 +5,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("dive")] -public class Dive : ILinkable +public class Dive: UddfModel, ILinkable { [XmlAttribute("id")] public string? Id { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/DiveBase.cs b/src/UniversalDiveDataFormat/Models/DiveBase.cs index ffc6baf..f8bad11 100644 --- a/src/UniversalDiveDataFormat/Models/DiveBase.cs +++ b/src/UniversalDiveDataFormat/Models/DiveBase.cs @@ -4,7 +4,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("divebase")] -public class DiveBase : ILinkable +public class DiveBase: UddfModel, ILinkable { [XmlAttribute("id")] public string? Id { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/DiveComputerAlarm.cs b/src/UniversalDiveDataFormat/Models/DiveComputerAlarm.cs index 26acbc2..db4107b 100644 --- a/src/UniversalDiveDataFormat/Models/DiveComputerAlarm.cs +++ b/src/UniversalDiveDataFormat/Models/DiveComputerAlarm.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("dcalarm")] -public class DiveComputerAlarm +public class DiveComputerAlarm: UddfModel { [XmlElement("acknowledge")] public Acknowledge? Acknowledge { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/DiveComputerControl.cs b/src/UniversalDiveDataFormat/Models/DiveComputerControl.cs index 867c73a..c4195ab 100644 --- a/src/UniversalDiveDataFormat/Models/DiveComputerControl.cs +++ b/src/UniversalDiveDataFormat/Models/DiveComputerControl.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("divecomputercontrol")] -public class DiveComputerControl +public class DiveComputerControl: UddfModel { [XmlElement("divecomputerdump")] public List DiveComputerDumps { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/DiveComputerDump.cs b/src/UniversalDiveDataFormat/Models/DiveComputerDump.cs index 94e93bb..25ad45e 100644 --- a/src/UniversalDiveDataFormat/Models/DiveComputerDump.cs +++ b/src/UniversalDiveDataFormat/Models/DiveComputerDump.cs @@ -4,7 +4,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("divecomputerdump")] -public class DiveComputerDump +public class DiveComputerDump: UddfModel { [XmlElement("datetime")] public DateTime? DateTime { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/DiveInsurances.cs b/src/UniversalDiveDataFormat/Models/DiveInsurances.cs index 28f0e92..7ad9282 100644 --- a/src/UniversalDiveDataFormat/Models/DiveInsurances.cs +++ b/src/UniversalDiveDataFormat/Models/DiveInsurances.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("diveinsurances")] -public class DiveInsurances +public class DiveInsurances: UddfModel { [XmlElement("insurance")] public List Insurances { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/DivePermissions.cs b/src/UniversalDiveDataFormat/Models/DivePermissions.cs index eedd99a..5fc17b6 100644 --- a/src/UniversalDiveDataFormat/Models/DivePermissions.cs +++ b/src/UniversalDiveDataFormat/Models/DivePermissions.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("divepermissions")] -public class DivePermissions +public class DivePermissions: UddfModel { [XmlElement("permit")] public List Permits { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/DiveSite.cs b/src/UniversalDiveDataFormat/Models/DiveSite.cs index 6e46c15..8ad1988 100644 --- a/src/UniversalDiveDataFormat/Models/DiveSite.cs +++ b/src/UniversalDiveDataFormat/Models/DiveSite.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("divesite")] -public class DiveSite +public class DiveSite: UddfModel { [XmlElement("site")] public List Sites { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/DiveTrips.cs b/src/UniversalDiveDataFormat/Models/DiveTrips.cs index c337e2e..c4a4058 100644 --- a/src/UniversalDiveDataFormat/Models/DiveTrips.cs +++ b/src/UniversalDiveDataFormat/Models/DiveTrips.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("divetrip")] -public class DiveTrips +public class DiveTrips: UddfModel { [XmlElement("trip")] public List Trips { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/Diver.cs b/src/UniversalDiveDataFormat/Models/Diver.cs index 8b4f5a9..e3d7777 100644 --- a/src/UniversalDiveDataFormat/Models/Diver.cs +++ b/src/UniversalDiveDataFormat/Models/Diver.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("diver")] -public class Diver +public class Diver: UddfModel { [XmlElement("owner")] public required Owner Owner { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/DiverDetails.cs b/src/UniversalDiveDataFormat/Models/DiverDetails.cs index 87af65a..bb0dcfc 100644 --- a/src/UniversalDiveDataFormat/Models/DiverDetails.cs +++ b/src/UniversalDiveDataFormat/Models/DiverDetails.cs @@ -44,10 +44,10 @@ public abstract class DiverDetails : ILinkable } [XmlRoot("buddy")] -public class Buddy : DiverDetails; +public class Buddy: DiverDetails; [XmlRoot("owner")] -public class Owner : DiverDetails; +public class Owner: DiverDetails; [XmlRoot("student")] -public class Student; \ No newline at end of file +public class Student: UddfModel; \ No newline at end of file diff --git a/src/UniversalDiveDataFormat/Models/Doctor.cs b/src/UniversalDiveDataFormat/Models/Doctor.cs index c93bc7c..5fe382c 100644 --- a/src/UniversalDiveDataFormat/Models/Doctor.cs +++ b/src/UniversalDiveDataFormat/Models/Doctor.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("doctor")] -public class Doctor: ILinkable +public class Doctor: UddfModel, ILinkable { [XmlAttribute("id")] public string? Id { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Drug.cs b/src/UniversalDiveDataFormat/Models/Drug.cs index a87282a..59a6a0b 100644 --- a/src/UniversalDiveDataFormat/Models/Drug.cs +++ b/src/UniversalDiveDataFormat/Models/Drug.cs @@ -21,8 +21,8 @@ public abstract class Drug } [XmlRoot("drink")] -public class Drink : Drug; +public class Drink: Drug; [XmlRoot("medicine")] -public class Medicine : Drug; \ No newline at end of file +public class Medicine: Drug; \ No newline at end of file diff --git a/src/UniversalDiveDataFormat/Models/Ecology.cs b/src/UniversalDiveDataFormat/Models/Ecology.cs index 37b5512..c7b7419 100644 --- a/src/UniversalDiveDataFormat/Models/Ecology.cs +++ b/src/UniversalDiveDataFormat/Models/Ecology.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("ecology")] -public class Ecology +public class Ecology: UddfModel { [XmlElement("flora")] public Flora? Flora { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Education.cs b/src/UniversalDiveDataFormat/Models/Education.cs index 3871270..2bf3672 100644 --- a/src/UniversalDiveDataFormat/Models/Education.cs +++ b/src/UniversalDiveDataFormat/Models/Education.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("education")] -public class Education +public class Education: UddfModel { [XmlElement("certification")] public required List Certifications { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Equipment.cs b/src/UniversalDiveDataFormat/Models/Equipment.cs index 8b37303..0f55e45 100644 --- a/src/UniversalDiveDataFormat/Models/Equipment.cs +++ b/src/UniversalDiveDataFormat/Models/Equipment.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("equipment")] -public class Equipment +public class Equipment: UddfModel { [XmlElement("boots")] public List Boots { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/EquipmentConfiguration.cs b/src/UniversalDiveDataFormat/Models/EquipmentConfiguration.cs index 071f895..3d3d6a5 100644 --- a/src/UniversalDiveDataFormat/Models/EquipmentConfiguration.cs +++ b/src/UniversalDiveDataFormat/Models/EquipmentConfiguration.cs @@ -4,7 +4,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("equipmentconfiguration")] -public class EquipmentConfiguration : ILinkable +public class EquipmentConfiguration: UddfModel, ILinkable { [XmlAttribute("id")] public string? Id { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/EquipmentDetails.cs b/src/UniversalDiveDataFormat/Models/EquipmentDetails.cs index 02194ca..cdc42b4 100644 --- a/src/UniversalDiveDataFormat/Models/EquipmentDetails.cs +++ b/src/UniversalDiveDataFormat/Models/EquipmentDetails.cs @@ -41,56 +41,56 @@ public abstract class EquipmentDetails : ILinkable } [XmlRoot("buoyancycontroldevice")] -public class BuoyancyControlDevice : EquipmentDetails; +public class BuoyancyControlDevice: EquipmentDetails; [XmlRoot("boots")] -public class Boots : EquipmentDetails; +public class Boots: EquipmentDetails; [XmlRoot("compass")] -public class Compass : EquipmentDetails; +public class Compass: EquipmentDetails; [XmlRoot("compressor")] -public class Compressor : EquipmentDetails; +public class Compressor: EquipmentDetails; [XmlRoot("divecomputer")] -public class DiveComputer : EquipmentDetails; +public class DiveComputer: EquipmentDetails; [XmlRoot("fins")] -public class Fins : EquipmentDetails; +public class Fins: EquipmentDetails; [XmlRoot("gloves")] -public class Gloves : EquipmentDetails; +public class Gloves: EquipmentDetails; [XmlRoot("knife")] -public class Knife : EquipmentDetails; +public class Knife: EquipmentDetails; [XmlRoot("lead")] -public class Lead : EquipmentDetails; +public class Lead: EquipmentDetails; [XmlRoot("light")] -public class Light : EquipmentDetails; +public class Light: EquipmentDetails; [XmlRoot("mask")] -public class Mask : EquipmentDetails; +public class Mask: EquipmentDetails; [XmlRoot("rebreather")] -public class Rebreather : EquipmentDetails; +public class Rebreather: EquipmentDetails; [XmlRoot("regulator")] -public class Regulator : EquipmentDetails; +public class Regulator: EquipmentDetails; [XmlRoot("scooter")] -public class Scooter : EquipmentDetails; +public class Scooter: EquipmentDetails; [XmlRoot("suit")] -public class Suit : EquipmentDetails +public class Suit: EquipmentDetails { [XmlElement("suittype")] public SuitType? SuitType { get; init; } } [XmlRoot("tank")] -public class Tank : EquipmentDetails +public class Tank: EquipmentDetails { [XmlElement("tankmaterial")] public TankMaterial? TankMaterial { get; init; } @@ -100,19 +100,19 @@ public class Tank : EquipmentDetails } [XmlRoot("variouspieces")] -public class VariousPieces : EquipmentDetails; +public class VariousPieces: EquipmentDetails; [XmlRoot("watch")] -public class Watch : EquipmentDetails; +public class Watch: EquipmentDetails; [XmlRoot("body")] public class Body: EquipmentDetails; [XmlRoot("flash")] -public class Flash : EquipmentDetails; +public class Flash: EquipmentDetails; [XmlRoot("housing")] -public class Housing : EquipmentDetails; +public class Housing: EquipmentDetails; [XmlRoot("lens")] -public class Lens : EquipmentDetails; +public class Lens: EquipmentDetails; diff --git a/src/UniversalDiveDataFormat/Models/EquipmentUsed.cs b/src/UniversalDiveDataFormat/Models/EquipmentUsed.cs index ec2da1e..6485a50 100644 --- a/src/UniversalDiveDataFormat/Models/EquipmentUsed.cs +++ b/src/UniversalDiveDataFormat/Models/EquipmentUsed.cs @@ -4,7 +4,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("equipmentused")] -public class EquipmentUsed +public class EquipmentUsed: UddfModel { [XmlElement("leadquantity")] public float? LeadQuantityInKg { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/ExposureToAltitude.cs b/src/UniversalDiveDataFormat/Models/ExposureToAltitude.cs index 17e1b08..28cb9d6 100644 --- a/src/UniversalDiveDataFormat/Models/ExposureToAltitude.cs +++ b/src/UniversalDiveDataFormat/Models/ExposureToAltitude.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("exposuretoaltitude")] -public class ExposureToAltitude +public class ExposureToAltitude: UddfModel { [XmlElement("altitudeofexposure")] diff --git a/src/UniversalDiveDataFormat/Models/Fauna.cs b/src/UniversalDiveDataFormat/Models/Fauna.cs index 02598ef..adf1fb2 100644 --- a/src/UniversalDiveDataFormat/Models/Fauna.cs +++ b/src/UniversalDiveDataFormat/Models/Fauna.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("fauna")] -public class Fauna +public class Fauna: UddfModel { [XmlElement("vertebrata")] public Vertebrata? Vertebrata { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Flora.cs b/src/UniversalDiveDataFormat/Models/Flora.cs index 222bd45..7cc435c 100644 --- a/src/UniversalDiveDataFormat/Models/Flora.cs +++ b/src/UniversalDiveDataFormat/Models/Flora.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("flora")] -public class Flora +public class Flora: UddfModel { [XmlElement("chlorophyceae")] public List Chlorophyceae { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/GasDefinitions.cs b/src/UniversalDiveDataFormat/Models/GasDefinitions.cs index acc799f..31f59f6 100644 --- a/src/UniversalDiveDataFormat/Models/GasDefinitions.cs +++ b/src/UniversalDiveDataFormat/Models/GasDefinitions.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("gasdefinitions")] -public class GasDefinitions +public class GasDefinitions: UddfModel { [XmlElement("mix")] public List Mixes { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/Generator.cs b/src/UniversalDiveDataFormat/Models/Generator.cs index 67d3c47..9ad431b 100644 --- a/src/UniversalDiveDataFormat/Models/Generator.cs +++ b/src/UniversalDiveDataFormat/Models/Generator.cs @@ -4,7 +4,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("generator")] -public class Generator +public class Generator: UddfModel { [XmlElement("name")] public required string Name { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Geography.cs b/src/UniversalDiveDataFormat/Models/Geography.cs index fbe7c8e..18d678c 100644 --- a/src/UniversalDiveDataFormat/Models/Geography.cs +++ b/src/UniversalDiveDataFormat/Models/Geography.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("geography")] -public class Geography +public class Geography: UddfModel { [XmlElement("address")] public Address? Address { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/GetDiveComputerData.cs b/src/UniversalDiveDataFormat/Models/GetDiveComputerData.cs index 2073fed..77d7dd0 100644 --- a/src/UniversalDiveDataFormat/Models/GetDiveComputerData.cs +++ b/src/UniversalDiveDataFormat/Models/GetDiveComputerData.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("getdcdata")] -public class GetDiveComputerData +public class GetDiveComputerData: UddfModel { [XmlElement("getdcalldata")] public GetDcAllData? GetDiveComputerAllData { get; init; } @@ -32,25 +32,25 @@ public class GetDiveComputerData [XmlRoot("getdcdata")] -public class GetDcAllData; +public class GetDcAllData: UddfModel; [XmlRoot("getdcbuddydata")] -public class GetDcBuddyData; +public class GetDcBuddyData: UddfModel; [XmlRoot("getdcdivesitedata")] -public class GetDcDiveSiteData; +public class GetDcDiveSiteData: UddfModel; [XmlRoot("getdcdivetripdata")] -public class GetDcDiveTripData; +public class GetDcDiveTripData: UddfModel; [XmlRoot("getdcgasdefinitionsdata")] -public class GetDcGasDefinitionsData; +public class GetDcGasDefinitionsData: UddfModel; [XmlRoot("getdcgeneratordata")] -public class GetDcGeneratorData; +public class GetDcGeneratorData: UddfModel; [XmlRoot("getdcownerdata")] -public class GetDcOwnerData; +public class GetDcOwnerData: UddfModel; [XmlRoot("getdcprofiledata")] -public class GetDcProfileData; \ No newline at end of file +public class GetDcProfileData: UddfModel; \ No newline at end of file diff --git a/src/UniversalDiveDataFormat/Models/GlobalAlarmsGiven.cs b/src/UniversalDiveDataFormat/Models/GlobalAlarmsGiven.cs index 6ddcc76..726b38b 100644 --- a/src/UniversalDiveDataFormat/Models/GlobalAlarmsGiven.cs +++ b/src/UniversalDiveDataFormat/Models/GlobalAlarmsGiven.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("globalalarmsgiven")] -public class GlobalAlarmsGiven +public class GlobalAlarmsGiven: UddfModel { [XmlElement("globalalarm")] public List GlobalAlarms { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/Guide.cs b/src/UniversalDiveDataFormat/Models/Guide.cs index 9af7411..6ebc2b8 100644 --- a/src/UniversalDiveDataFormat/Models/Guide.cs +++ b/src/UniversalDiveDataFormat/Models/Guide.cs @@ -4,7 +4,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("guide")] -public class Guide: ILinkable +public class Guide: UddfModel, ILinkable { [XmlAttribute("id")] public string Id { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Image.cs b/src/UniversalDiveDataFormat/Models/Image.cs index 6a2b2b7..7d3ec72 100644 --- a/src/UniversalDiveDataFormat/Models/Image.cs +++ b/src/UniversalDiveDataFormat/Models/Image.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("image")] -public class Image : ILinkable +public class Image: UddfModel, ILinkable { [XmlAttribute("id")] public string? Id { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/ImageData.cs b/src/UniversalDiveDataFormat/Models/ImageData.cs index 3a883a9..579d2df 100644 --- a/src/UniversalDiveDataFormat/Models/ImageData.cs +++ b/src/UniversalDiveDataFormat/Models/ImageData.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("imagedata")] -public class ImageData +public class ImageData: UddfModel { [XmlElement("aperture")] public float? Aperture { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Infinity.cs b/src/UniversalDiveDataFormat/Models/Infinity.cs index a8db056..a243292 100644 --- a/src/UniversalDiveDataFormat/Models/Infinity.cs +++ b/src/UniversalDiveDataFormat/Models/Infinity.cs @@ -3,4 +3,4 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("infinity")] -public class Infinity; \ No newline at end of file +public class Infinity: UddfModel; \ No newline at end of file diff --git a/src/UniversalDiveDataFormat/Models/InformationAfterDive.cs b/src/UniversalDiveDataFormat/Models/InformationAfterDive.cs index 1319b8e..0fa0d4f 100644 --- a/src/UniversalDiveDataFormat/Models/InformationAfterDive.cs +++ b/src/UniversalDiveDataFormat/Models/InformationAfterDive.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("informationafterdive")] -public class InformationAfterDive +public class InformationAfterDive: UddfModel { [XmlElement("anysymptoms")] diff --git a/src/UniversalDiveDataFormat/Models/InformationBeforeDive.cs b/src/UniversalDiveDataFormat/Models/InformationBeforeDive.cs index 05baf37..9af94a9 100644 --- a/src/UniversalDiveDataFormat/Models/InformationBeforeDive.cs +++ b/src/UniversalDiveDataFormat/Models/InformationBeforeDive.cs @@ -4,7 +4,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("informationbeforedive")] -public class InformationBeforeDive +public class InformationBeforeDive: UddfModel { [XmlElement("airtemperature")] public float? AirTemperatureInKelvin { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/InputProfile.cs b/src/UniversalDiveDataFormat/Models/InputProfile.cs index f5391cb..7ba7eba 100644 --- a/src/UniversalDiveDataFormat/Models/InputProfile.cs +++ b/src/UniversalDiveDataFormat/Models/InputProfile.cs @@ -4,7 +4,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("inputprofile")] -public class InputProfile +public class InputProfile: UddfModel { [XmlElement("link")] public List Links { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/Instructor.cs b/src/UniversalDiveDataFormat/Models/Instructor.cs index 4930411..49e34cc 100644 --- a/src/UniversalDiveDataFormat/Models/Instructor.cs +++ b/src/UniversalDiveDataFormat/Models/Instructor.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("instructor")] -public class Instructor: ILinkable +public class Instructor: UddfModel, ILinkable { [XmlAttribute("id")] public string? Id { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Insurance.cs b/src/UniversalDiveDataFormat/Models/Insurance.cs index c6974ab..95769e1 100644 --- a/src/UniversalDiveDataFormat/Models/Insurance.cs +++ b/src/UniversalDiveDataFormat/Models/Insurance.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("insurance")] -public class Insurance +public class Insurance: UddfModel { [XmlElement("name")] public string? Name { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Invertebrata.cs b/src/UniversalDiveDataFormat/Models/Invertebrata.cs index 6222b78..6f06bc2 100644 --- a/src/UniversalDiveDataFormat/Models/Invertebrata.cs +++ b/src/UniversalDiveDataFormat/Models/Invertebrata.cs @@ -4,7 +4,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("invertebrata")] -public class Invertebrata +public class Invertebrata: UddfModel { [XmlElement("amphibia")] public Amphibia? Amphibia { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/IssueDate.cs b/src/UniversalDiveDataFormat/Models/IssueDate.cs index 6eef5e0..30dca8a 100644 --- a/src/UniversalDiveDataFormat/Models/IssueDate.cs +++ b/src/UniversalDiveDataFormat/Models/IssueDate.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("issuedate")] -public class IssueDate +public class IssueDate: UddfModel { [XmlElement("datetime")] public required DateTime DateTime { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/LaunchingDate.cs b/src/UniversalDiveDataFormat/Models/LaunchingDate.cs index 5e04631..489b35b 100644 --- a/src/UniversalDiveDataFormat/Models/LaunchingDate.cs +++ b/src/UniversalDiveDataFormat/Models/LaunchingDate.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("LaunchingDate")] -public class LaunchingDate +public class LaunchingDate: UddfModel { [XmlElement("datetime")] public DateTime? DateTime { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Linking/Link.cs b/src/UniversalDiveDataFormat/Models/Linking/Link.cs index 7234357..62d7f51 100644 --- a/src/UniversalDiveDataFormat/Models/Linking/Link.cs +++ b/src/UniversalDiveDataFormat/Models/Linking/Link.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models.Linking; [XmlRoot("link")] -public class Link +public class Link: UddfModel { [XmlAttribute("ref")] public required string Ref { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/Maker.cs b/src/UniversalDiveDataFormat/Models/Maker.cs index d7588e9..acac3a4 100644 --- a/src/UniversalDiveDataFormat/Models/Maker.cs +++ b/src/UniversalDiveDataFormat/Models/Maker.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("maker")] -public class Maker +public class Maker: UddfModel { [XmlElement("manufacturer")] public List Manufacturers { get; init; } = []; diff --git a/src/UniversalDiveDataFormat/Models/Manufacturer.cs b/src/UniversalDiveDataFormat/Models/Manufacturer.cs index 82708a3..b28e522 100644 --- a/src/UniversalDiveDataFormat/Models/Manufacturer.cs +++ b/src/UniversalDiveDataFormat/Models/Manufacturer.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("manufacturer")] -public class Manufacturer: ILinkable +public class Manufacturer: UddfModel, ILinkable { [XmlAttribute("id")] public string? Id { get; init; } diff --git a/src/UniversalDiveDataFormat/Models/MediaData.cs b/src/UniversalDiveDataFormat/Models/MediaData.cs index 085ef72..e15b7a6 100644 --- a/src/UniversalDiveDataFormat/Models/MediaData.cs +++ b/src/UniversalDiveDataFormat/Models/MediaData.cs @@ -3,7 +3,7 @@ namespace UniversalDiveDataFormat.Models; [XmlRoot("mediadata")] -public class MediaData +public class MediaData: UddfModel { [XmlElement("audio")] public List