From 9fa9597444446799175da5428ca6cd7d520f46ff Mon Sep 17 00:00:00 2001 From: Kevin Jump Date: Wed, 18 Dec 2019 21:11:24 +0000 Subject: [PATCH] serialize the creation date (will be a format change) --- uSync8.ContentEdition/Serializers/ContentSerializerBase.cs | 5 +++++ uSync8.ContentEdition/Tracker/ContentBaseTracker.cs | 1 + uSync8.ContentEdition/Tracker/ContentTracker.cs | 1 + 3 files changed, 7 insertions(+) diff --git a/uSync8.ContentEdition/Serializers/ContentSerializerBase.cs b/uSync8.ContentEdition/Serializers/ContentSerializerBase.cs index 687e2e20..303302cc 100644 --- a/uSync8.ContentEdition/Serializers/ContentSerializerBase.cs +++ b/uSync8.ContentEdition/Serializers/ContentSerializerBase.cs @@ -72,6 +72,7 @@ protected virtual XElement SerializeInfo(TObject item) info.Add(new XElement("Path", GetItemPath(item))); info.Add(new XElement("Trashed", item.Trashed)); info.Add(new XElement("ContentType", item.ContentType.Alias)); + info.Add(new XElement("CreateDate", item.CreateDate)); var title = new XElement("NodeName", new XAttribute("Default", item.Name)); foreach (var culture in item.AvailableCultures) @@ -166,6 +167,10 @@ protected virtual Attempt DeserializeBase(TObject item, XElement node) if (key != Guid.Empty && item.Key != key) item.Key = key; + var createDate = info.Element("CreateDate").ValueOrDefault(item.CreateDate); + if (item.CreateDate != createDate) + item.CreateDate = createDate; + DeserializeName(item, node); return Attempt.Succeed("Info Deserialized"); diff --git a/uSync8.ContentEdition/Tracker/ContentBaseTracker.cs b/uSync8.ContentEdition/Tracker/ContentBaseTracker.cs index fd8e99f3..f13440f2 100644 --- a/uSync8.ContentEdition/Tracker/ContentBaseTracker.cs +++ b/uSync8.ContentEdition/Tracker/ContentBaseTracker.cs @@ -29,6 +29,7 @@ protected override TrackedItem TrackChanges() new TrackedItem("Path", "/Path", true), new TrackedItem("SortOrder", "/SortOrder", true), new TrackedItem("ContentType", "/ContentType", true), + new TrackedItem("CreateDate", "/CreateDate", true), new TrackedItem("Name", "/NodeName", false) { diff --git a/uSync8.ContentEdition/Tracker/ContentTracker.cs b/uSync8.ContentEdition/Tracker/ContentTracker.cs index 86bce7d5..38afb60f 100644 --- a/uSync8.ContentEdition/Tracker/ContentTracker.cs +++ b/uSync8.ContentEdition/Tracker/ContentTracker.cs @@ -28,6 +28,7 @@ protected override TrackedItem TrackChanges() new TrackedItem("SortOrder", "/SortOrder", true), new TrackedItem("FileHash", "/FileHash", true), new TrackedItem("Template", "/Template", true), + new TrackedItem("CreateDate", "/CreateDate", true), new TrackedItem("Name", "/NodeName", false) {