diff --git a/uSync8.Core/Serialization/Serializers/DataTypeSerializer.cs b/uSync8.Core/Serialization/Serializers/DataTypeSerializer.cs index f323e03a..50f3daba 100644 --- a/uSync8.Core/Serialization/Serializers/DataTypeSerializer.cs +++ b/uSync8.Core/Serialization/Serializers/DataTypeSerializer.cs @@ -84,7 +84,11 @@ protected override SyncAttempt DeserializeCore(XElement node, SyncSer } // config - details.AddRange(DeserializeConfiguration(item, node)); + if (ShouldDeserilizeConfig(name, editorAlias, options)) + { + details.AddRange(DeserializeConfiguration(item, node)); + } + details.AddNotNull(SetFolderFromElement(item, info.Element("Folder"))); return SyncAttempt.Succeed(item.Name, item, ChangeType.Import, details); @@ -270,5 +274,36 @@ protected override void DeleteItem(IDataType item) protected override string ItemAlias(IDataType item) => item.Name; + + + + /// + /// Checks the config to see if we should be deserializing the config element of a data type. + /// + /// + /// a key value on the handler will allow users to add editorAliases that they don't want the + /// config importing for. + /// e.g - to not import all the colour picker values. + /// + /// + /// + /// + /// To ignore just specific colour pickers (so still import config for other colour pickers) + /// + /// + /// + /// + private bool ShouldDeserilizeConfig(string itemName, string editorAlias, SyncSerializerOptions options) + { + var noConfigEditors = options.GetSetting("NoConfigEditors", string.Empty); + if (!string.IsNullOrWhiteSpace(noConfigEditors) && noConfigEditors.InvariantContains(editorAlias)) + return false; + + var noConfigAliases = options.GetSetting("NoConfigNames", string.Empty); + if (!string.IsNullOrWhiteSpace(noConfigAliases) && noConfigAliases.InvariantContains(itemName)) + return false; + + return true; + } } }