private void MoveProperties(IContentTypeBase item, IDictionary <string, string> moves)
        {
            logger.Debug(serializerType, "MoveProperties");

            foreach (var move in moves)
            {
                item.MovePropertyType(move.Key, move.Value);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Maps properties
        /// </summary>
        /// <param name="ct"></param>
        /// <param name="itemType"></param>
        /// <param name="overwrite"></param>
        protected void MapProperties(IContentTypeBase ct, Type itemType)
        {
            foreach (PropertyInfo propInfo in itemType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
            {
                PropertyAttribute propAttr = Attribute.GetCustomAttribute(propInfo, typeof(PropertyAttribute), false) as PropertyAttribute;

                if (propAttr != null)
                {
                    var newProp = propAttr.GetPropertyType();

                    if (ct.PropertyTypeExists(propAttr.Alias))
                    {
                        var existingProp = ct.PropertyTypes.First(x => x.Alias == propAttr.Alias);

                        existingProp.DataTypeDefinitionId = newProp.DataTypeDefinitionId;
                        existingProp.Name             = newProp.Name;
                        existingProp.Description      = newProp.Description;
                        existingProp.Mandatory        = newProp.Mandatory;
                        existingProp.ValidationRegExp = newProp.ValidationRegExp;

                        if (!String.IsNullOrEmpty(propAttr.TabName))
                        {
                            ct.MovePropertyType(propAttr.Alias, propAttr.TabName);
                        }
                    }
                    else
                    {
                        if (!String.IsNullOrEmpty(propAttr.TabName))
                        {
                            ct.AddPropertyGroup(propAttr.TabName);
                            ct.AddPropertyType(newProp, propAttr.TabName);
                        }
                        else
                        {
                            ct.AddPropertyType(newProp);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Maps properties
        /// </summary>
        /// <param name="ct"></param>
        /// <param name="itemType"></param>
        /// <param name="overwrite"></param>
        protected void MapProperties(IContentTypeBase ct, Type itemType)
        {
            var propAttrs = ReflectionHelper.GetPropertiesWithAttribute <PropertyAttribute>(itemType)
                            .Select(prop => prop.GetCustomAttribute <PropertyAttribute>(false));

            foreach (var propAttr in propAttrs)
            {
                var newProp = propAttr.GetPropertyType();

                if (ct.PropertyTypeExists(propAttr.Alias))
                {
                    var existingProp = ct.PropertyTypes.First(x => x.Alias == propAttr.Alias);

                    existingProp.DataTypeDefinitionId = newProp.DataTypeDefinitionId;
                    existingProp.Name             = newProp.Name;
                    existingProp.Description      = newProp.Description;
                    existingProp.Mandatory        = newProp.Mandatory;
                    existingProp.ValidationRegExp = newProp.ValidationRegExp;

                    if (!string.IsNullOrEmpty(propAttr.TabName))
                    {
                        ct.MovePropertyType(propAttr.Alias, propAttr.TabName);
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(propAttr.TabName))
                    {
                        ct.AddPropertyGroup(propAttr.TabName);
                        ct.AddPropertyType(newProp, propAttr.TabName);
                    }
                    else
                    {
                        ct.AddPropertyType(newProp);
                    }
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Checks whether a property exists and adds if if it does not. The data type, alias, description and mandatory flag are update for existing properties, but not persisted.
        /// Callers should persist the value.
        /// </summary>
        public PropertyRegistration VerifyExistingProperty(IContentTypeBase contentType, TabRegistration tab, PropertyInfo item, Type documentClrType, ref bool modified)
        {
            ContentPropertyAttribute attribute = item.GetCodeFirstAttribute <ContentPropertyAttribute>();
            var tabPostfix = tab == null || !attribute.AddTabAliasToPropertyAlias ? null : tab.OriginalName == null ? tab.Name : tab.OriginalName;
            var property   = new PropertyRegistration();
            var alias      = property.Alias = tabPostfix == null ? attribute.Alias : StringHelperExtensions.HyphenToUnderscore(StringHelperExtensions.ParseUrl(attribute.Alias + "_" + tabPostfix, false));
            var dataType   = property.DataType = _dataTypeModule.GetDataType(item);

            property.Name = attribute.Name;
            property.PropertyAttribute = attribute;
            property.Metadata          = item;

            LogPropertySyncInfo(contentType, tab, property, "Syncing");

            bool         alreadyExisted  = contentType.PropertyTypeExists(alias);
            PropertyType umbracoProperty = contentType.PropertyTypes.FirstOrDefault(x => x.Alias == alias);

            if (umbracoProperty == null && alreadyExisted)
            {
                //This is a property from an underlying tab. Leave it alone. Log a warning in case this is an orphaned property.
                LogPropertySyncInfo(contentType, tab, property, "Ignoring inherited");
                return(property);
            }

            if (alreadyExisted)
            {
                modified = modified ||
                           !umbracoProperty.Name.Equals(attribute.Name, StringComparison.InvariantCultureIgnoreCase) ||
                           umbracoProperty.Mandatory != attribute.Mandatory ||
                           (umbracoProperty.SortOrder != attribute.SortOrder && attribute.SortOrder != 0);     //don't count sort order changes if no sort order is specified, as Umbraco will have assigned an automatic one

                if (umbracoProperty.ValidationRegExp != attribute.ValidationRegularExpression)
                {
                    //If not both null/empty
                    if (!(string.IsNullOrEmpty(umbracoProperty.ValidationRegExp) && string.IsNullOrEmpty(attribute.ValidationRegularExpression)))
                    {
                        modified = true;
                        LogPropertySyncInfo(contentType, tab, property, "ValidationRegExp changed on");
                    }
                }

                if (umbracoProperty.Description != attribute.Description)
                {
                    //If not both null/empty
                    if (!(string.IsNullOrEmpty(umbracoProperty.Description) && string.IsNullOrEmpty(attribute.Description)))
                    {
                        modified = true;
                        LogPropertySyncInfo(contentType, tab, property, "Description changed on");
                    }
                }

                if (modified)
                {
                    if (!umbracoProperty.Name.Equals(attribute.Name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        LogPropertySyncInfo(contentType, tab, property, "Name changed on");
                    }

                    if (umbracoProperty.Mandatory != attribute.Mandatory)
                    {
                        LogPropertySyncInfo(contentType, tab, property, "Mandatory changed on");
                    }

                    if ((umbracoProperty.SortOrder != attribute.SortOrder && attribute.SortOrder != 0))
                    {
                        LogPropertySyncInfo(contentType, tab, property, "SortOrder changed on");
                    }
                }
            }

            if (umbracoProperty == null)
            {
                try
                {
                    modified        = true;
                    umbracoProperty = new PropertyType(dataType.Definition);
                    LogPropertySyncInfo(contentType, tab, property, "Creating new");
                }
                catch (Exception ex)
                {
                }
            }
            else if (umbracoProperty.DataTypeDefinitionId != dataType.Definition.Id)
            {
                modified = true;
                umbracoProperty.DataTypeDefinitionId = dataType.Definition.Id;
                LogPropertySyncInfo(contentType, tab, property, "Data type changed for");
            }

            umbracoProperty.Name             = attribute.Name;
            umbracoProperty.Alias            = alias;
            umbracoProperty.Description      = attribute.Description;
            umbracoProperty.Mandatory        = attribute.Mandatory;
            umbracoProperty.SortOrder        = attribute.SortOrder;
            umbracoProperty.ValidationRegExp = attribute.ValidationRegularExpression;

            var propertyDeclaredOnThisDocType = property.Metadata.DeclaringType == documentClrType;
            var propertyDeclaredOnThisTab     = tab == null ? false : property.Metadata.DeclaringType == tab.ClrType;
            var tabDeclaredOnThisDocType      = tab == null ? false : tab.PropertyOfParent.DeclaringType == documentClrType || tab.PropertyOfParent.DeclaringType.GetCustomAttribute <ContentTypeAttribute>() == null;
            var declaringTypeIsDocType        = property.Metadata.DeclaringType.GetCodeFirstAttribute <ContentTypeAttribute>(false) != null;
            var propertyIsFromCommonBase      = tab == null?
                                                property.Metadata.DeclaringType.GetCodeFirstAttribute <CodeFirstCommonBaseAttribute>() != null && property.Metadata.DeclaringType == documentClrType.BaseType
                                                :
                                                property.Metadata.DeclaringType.GetCodeFirstAttribute <CodeFirstCommonBaseAttribute>() != null && property.Metadata.DeclaringType == tab.ClrType.BaseType;

            if (alreadyExisted)
            {
                if (propertyIsFromCommonBase || (tabDeclaredOnThisDocType && propertyDeclaredOnThisTab))
                {
                    var currentTab = contentType.PropertyGroups.Where(x => x.PropertyTypes.Any(y => y.Alias == alias)).FirstOrDefault();
                    if (currentTab == null || !currentTab.Name.Equals(tab.Name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        modified = true;
                        contentType.MovePropertyType(alias, tab.Name);
                        LogPropertySyncInfo(contentType, tab, property, string.Format("Moved from tab {0}:", tab.Name));
                    }
                }
            }
            else
            {
                if (tab == null)
                {
                    if (propertyDeclaredOnThisDocType || !declaringTypeIsDocType)                                //only if property declared at this level (or inherited from common base)
                    {
                        if (!propertyIsFromCommonBase || !contentType.PropertyTypeExists(umbracoProperty.Alias)) //check if common base properties already exist
                        {
                            LogPropertySyncInfo(contentType, tab, property, "Adding");
                            contentType.AddPropertyType(umbracoProperty);
                        }
                    }
                }
                else if (tabDeclaredOnThisDocType || propertyIsFromCommonBase)                                                                 //only if tab declared at this level
                {
                    if (propertyDeclaredOnThisTab || propertyIsFromCommonBase)                                                                 //only if property declared at this level
                    {
                        if (!propertyIsFromCommonBase || (tabDeclaredOnThisDocType && !contentType.PropertyTypeExists(umbracoProperty.Alias))) //check if common base properties already exist
                        {
                            LogPropertySyncInfo(contentType, tab, property, "Adding");
                            contentType.AddPropertyType(umbracoProperty, tab.Name);
                        }
                    }
                }
            }

            return(property);
        }
        /// <summary>
        /// Checks whether a property exists and adds if if it does not. The data type, alias, description and mandatory flag are update for existing properties, but not persisted.
        /// Callers should persist the value.
        /// </summary>
        public PropertyRegistration VerifyExistingProperty(IContentTypeBase contentType, TabRegistration tab, PropertyInfo item, Type documentClrType, ref bool modified)
        {
            ContentPropertyAttribute attribute = item.GetCodeFirstAttribute<ContentPropertyAttribute>();
            var tabPostfix = tab == null || !attribute.AddTabAliasToPropertyAlias ? null : tab.OriginalName == null ? tab.Name : tab.OriginalName;
            var property = new PropertyRegistration();
            var alias = property.Alias = tabPostfix == null ? attribute.Alias : StringHelperExtensions.HyphenToUnderscore(StringHelperExtensions.ParseUrl(attribute.Alias + "_" + tabPostfix, false));
            var dataType = property.DataType = _dataTypeModule.GetDataType(item);
            property.Name = attribute.Name;
            property.PropertyAttribute = attribute;
            property.Metadata = item;

            LogPropertySyncInfo(contentType, tab, property, "Syncing");

            bool alreadyExisted = contentType.PropertyTypeExists(alias);
            PropertyType umbracoProperty = contentType.PropertyTypes.FirstOrDefault(x => x.Alias == alias);

            if (umbracoProperty == null && alreadyExisted)
            {
                //This is a property from an underlying tab. Leave it alone. Log a warning in case this is an orphaned property.
                LogPropertySyncInfo(contentType, tab, property, "Ignoring inherited");
                return property;
            }

            if(alreadyExisted)
            {
                modified = modified ||
                               !umbracoProperty.Name.Equals(attribute.Name, StringComparison.InvariantCultureIgnoreCase) ||
                               umbracoProperty.Mandatory != attribute.Mandatory ||
                               (umbracoProperty.SortOrder != attribute.SortOrder && attribute.SortOrder != 0); //don't count sort order changes if no sort order is specified, as Umbraco will have assigned an automatic one

                if (umbracoProperty.ValidationRegExp != attribute.ValidationRegularExpression)
                {
                    //If not both null/empty
                    if (!(string.IsNullOrEmpty(umbracoProperty.ValidationRegExp) && string.IsNullOrEmpty(attribute.ValidationRegularExpression)))
                    {
                        modified = true;
                        LogPropertySyncInfo(contentType, tab, property, "ValidationRegExp changed on");
                    }
                }

                if (umbracoProperty.Description != attribute.Description)
                {
                    //If not both null/empty
                    if (!(string.IsNullOrEmpty(umbracoProperty.Description) && string.IsNullOrEmpty(attribute.Description)))
                    {
                        modified = true;
                        LogPropertySyncInfo(contentType, tab, property, "Description changed on");
                    }
                }

                if (modified)
                {
                    if (!umbracoProperty.Name.Equals(attribute.Name, StringComparison.InvariantCultureIgnoreCase))
                        LogPropertySyncInfo(contentType, tab, property, "Name changed on");

                    if (umbracoProperty.Mandatory != attribute.Mandatory)
                        LogPropertySyncInfo(contentType, tab, property, "Mandatory changed on");

                    if ((umbracoProperty.SortOrder != attribute.SortOrder && attribute.SortOrder != 0))
                        LogPropertySyncInfo(contentType, tab, property, "SortOrder changed on");
                }
            }

            if (umbracoProperty == null)
            {
                try
                {
                    modified = true;
                    umbracoProperty = new PropertyType(dataType.Definition);
                    LogPropertySyncInfo(contentType, tab, property, "Creating new");
                }
                catch (Exception ex)
                {

                }
            }
            else if (umbracoProperty.DataTypeDefinitionId != dataType.Definition.Id)
            {
                modified = true;
                umbracoProperty.DataTypeDefinitionId = dataType.Definition.Id;
                LogPropertySyncInfo(contentType, tab, property, "Data type changed for");
            }

            umbracoProperty.Name = attribute.Name;
            umbracoProperty.Alias = alias;
            umbracoProperty.Description = attribute.Description;
            umbracoProperty.Mandatory = attribute.Mandatory;
            umbracoProperty.SortOrder = attribute.SortOrder;
            umbracoProperty.ValidationRegExp = attribute.ValidationRegularExpression;

            var propertyDeclaredOnThisDocType = property.Metadata.DeclaringType == documentClrType;
            var propertyDeclaredOnThisTab = tab == null ? false : property.Metadata.DeclaringType == tab.ClrType;
            var tabDeclaredOnThisDocType = tab == null ? false : tab.PropertyOfParent.DeclaringType == documentClrType || tab.PropertyOfParent.DeclaringType.GetCustomAttribute<ContentTypeAttribute>() == null;
            var declaringTypeIsDocType = property.Metadata.DeclaringType.GetCodeFirstAttribute<ContentTypeAttribute>(false) != null;
            var propertyIsFromCommonBase = tab == null ?
                property.Metadata.DeclaringType.GetCodeFirstAttribute<CodeFirstCommonBaseAttribute>() != null && property.Metadata.DeclaringType == documentClrType.BaseType
                :
                property.Metadata.DeclaringType.GetCodeFirstAttribute<CodeFirstCommonBaseAttribute>() != null && property.Metadata.DeclaringType == tab.ClrType.BaseType;

            if (alreadyExisted)
            {
                if (propertyIsFromCommonBase || (tabDeclaredOnThisDocType && propertyDeclaredOnThisTab))
                {
                    var currentTab = contentType.PropertyGroups.Where(x => x.PropertyTypes.Any(y => y.Alias == alias)).FirstOrDefault();
                    if (currentTab == null || !currentTab.Name.Equals(tab.Name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        modified = true;
                        contentType.MovePropertyType(alias, tab.Name);
                        LogPropertySyncInfo(contentType, tab, property, string.Format("Moved from tab {0}:", tab.Name));
                    }
                }
            }
            else
            {
                if (tab == null)
                {
                    if (propertyDeclaredOnThisDocType || !declaringTypeIsDocType) //only if property declared at this level (or inherited from common base)
                    {
                        if (!propertyIsFromCommonBase || !contentType.PropertyTypeExists(umbracoProperty.Alias)) //check if common base properties already exist
                        {
                            LogPropertySyncInfo(contentType, tab, property, "Adding");
                            contentType.AddPropertyType(umbracoProperty);
                        }
                    }
                }
                else if (tabDeclaredOnThisDocType || propertyIsFromCommonBase) //only if tab declared at this level
                {
                    if (propertyDeclaredOnThisTab || propertyIsFromCommonBase) //only if property declared at this level
                    {
                        if (!propertyIsFromCommonBase || (tabDeclaredOnThisDocType && !contentType.PropertyTypeExists(umbracoProperty.Alias))) //check if common base properties already exist
                        {
                            LogPropertySyncInfo(contentType, tab, property, "Adding");
                            contentType.AddPropertyType(umbracoProperty, tab.Name);
                        }
                    }
                }
            }

            return property;
        }
Exemplo n.º 6
0
        internal void DeserializeProperties(IContentTypeBase item, XElement node)
        {
            List <string> propertiesToRemove = new List <string>();
            Dictionary <string, string>        propertiesToMove = new Dictionary <string, string>();
            Dictionary <PropertyGroup, string> tabsToBlank      = new Dictionary <PropertyGroup, string>();

            var genericPropertyNode = node.Element("GenericProperties");

            if (genericPropertyNode != null)
            {
                // add or update properties
                foreach (var propertyNode in genericPropertyNode.Elements("GenericProperty"))
                {
                    bool newProperty = false;

                    var property = default(PropertyType);
                    var propKey  = propertyNode.Element("Key").ValueOrDefault(Guid.Empty);
                    if (propKey != Guid.Empty)
                    {
                        property = item.PropertyTypes.SingleOrDefault(x => x.Key == propKey);
                    }

                    var alias = propertyNode.Element("Alias").ValueOrDefault(string.Empty);

                    if (property == null)
                    {
                        // look up via alias?
                        property = item.PropertyTypes.SingleOrDefault(x => x.Alias == alias);
                    }

                    // we need to get element stuff now before we can create or update

                    var defGuid            = propertyNode.Element("Definition").ValueOrDefault(Guid.Empty);
                    var dataTypeDefinition = _dataTypeService.GetDataTypeDefinitionById(defGuid);

                    if (dataTypeDefinition == null)
                    {
                        var propEditorAlias = propertyNode.Element("Type").ValueOrDefault(string.Empty);
                        if (!string.IsNullOrEmpty(propEditorAlias))
                        {
                            dataTypeDefinition = _dataTypeService
                                                 .GetDataTypeDefinitionByPropertyEditorAlias(propEditorAlias)
                                                 .FirstOrDefault();
                        }
                    }

                    if (dataTypeDefinition == null)
                    {
                        LogHelper.Warn <Events>("Failed to get Definition for property type");
                        continue;
                    }

                    if (property == null)
                    {
                        // create the property
                        LogHelper.Debug <Events>("Creating new Property: {0} {1}", () => item.Alias, () => alias);
                        property    = new PropertyType(dataTypeDefinition, alias);
                        newProperty = true;
                    }

                    if (property != null)
                    {
                        LogHelper.Debug <Events>("Updating Property :{0} {1}", () => item.Alias, () => alias);

                        var key = propertyNode.Element("Key").ValueOrDefault(Guid.Empty);
                        if (key != Guid.Empty)
                        {
                            LogHelper.Debug <Events>("Setting Key :{0}", () => key);
                            property.Key = key;
                        }

                        LogHelper.Debug <Events>("Item Key    :{0}", () => property.Key);

                        // update settings.
                        property.Name = propertyNode.Element("Name").ValueOrDefault("unnamed" + DateTime.Now.ToString("yyyyMMdd_HHmmss"));

                        if (property.Alias != alias)
                        {
                            property.Alias = alias;
                        }

                        if (propertyNode.Element("Description") != null)
                        {
                            property.Description = propertyNode.Element("Description").Value;
                        }

                        if (propertyNode.Element("Mandatory") != null)
                        {
                            property.Mandatory = propertyNode.Element("Mandatory").Value.ToLowerInvariant().Equals("true");
                        }

                        if (propertyNode.Element("Validation") != null)
                        {
                            property.ValidationRegExp = propertyNode.Element("Validation").Value;
                        }

                        if (propertyNode.Element("SortOrder") != null)
                        {
                            property.SortOrder = int.Parse(propertyNode.Element("SortOrder").Value);
                        }

                        if (propertyNode.Element("Type") != null)
                        {
                            LogHelper.Debug <Events>("Setting Property Type : {0}", () => propertyNode.Element("Type").Value);
                            property.PropertyEditorAlias = propertyNode.Element("Type").Value;
                        }

                        if (property.DataTypeDefinitionId != dataTypeDefinition.Id)
                        {
                            property.DataTypeDefinitionId = dataTypeDefinition.Id;
                        }

                        var tabName = propertyNode.Element("Tab").ValueOrDefault(string.Empty);

                        if (_itemType == "MemberType")
                        {
                            ((IMemberType)item).SetMemberCanEditProperty(alias,
                                                                         propertyNode.Element("CanEdit").ValueOrDefault(false));

                            ((IMemberType)item).SetMemberCanViewProperty(alias,
                                                                         propertyNode.Element("CanView").ValueOrDefault(false));
                        }

                        if (!newProperty)
                        {
                            if (!string.IsNullOrEmpty(tabName))
                            {
                                var propGroup = item.PropertyGroups.FirstOrDefault(x => x.Name == tabName);
                                if (propGroup != null)
                                {
                                    if (!propGroup.PropertyTypes.Any(x => x.Alias == property.Alias))
                                    {
                                        // this tab currently doesn't contain this property, to we have to
                                        // move it (later)
                                        propertiesToMove.Add(property.Alias, tabName);
                                    }
                                }
                            }
                            else
                            {
                                // this property isn't in a tab (now!)
                                if (!newProperty)
                                {
                                    var existingTab = item.PropertyGroups.FirstOrDefault(x => x.PropertyTypes.Contains(property));
                                    if (existingTab != null)
                                    {
                                        // this item is now not in a tab (when it was)
                                        // so we have to remove it from tabs (later)
                                        tabsToBlank.Add(existingTab, property.Alias);
                                    }
                                }
                            }
                        }
                        else
                        {
                            // new propert needs to be added to content type..
                            if (string.IsNullOrEmpty(tabName))
                            {
                                item.AddPropertyType(property);
                            }
                            else
                            {
                                item.AddPropertyType(property, tabName);
                            }

                            // setting the key before here doesn't seem to work for new types.
                            if (key != Guid.Empty)
                            {
                                property.Key = key;
                            }
                        }
                    }
                } // end foreach property
            }     // end generic properties


            // look at what properties we need to remove.
            var propertyNodes = node.Elements("GenericProperties").Elements("GenericProperty");

            foreach (var property in item.PropertyTypes)
            {
                XElement propertyNode = propertyNodes
                                        .FirstOrDefault(x => x.Element("key") != null && x.Element("Key").Value == property.Key.ToString());

                if (propertyNode == null)
                {
                    LogHelper.Debug <uSync.Core.Events>("Looking up property type by alias {0}", () => property.Alias);
                    propertyNode = propertyNodes
                                   .SingleOrDefault(x => x.Element("Alias").Value == property.Alias);
                }

                if (propertyNode == null)
                {
                    propertiesToRemove.Add(property.Alias);
                }
            }


            // now we have gone through all the properties, we can do the moves and removes from the groups
            if (propertiesToMove.Any())
            {
                foreach (var move in propertiesToMove)
                {
                    LogHelper.Debug <Events>("Moving Property: {0} {1}", () => move.Key, () => move.Value);
                    item.MovePropertyType(move.Key, move.Value);
                }
            }

            if (propertiesToRemove.Any())
            {
                // removing properties can cause timeouts on installs with lots of content...
                foreach (var delete in propertiesToRemove)
                {
                    LogHelper.Debug <Events>("Removing Property: {0}", () => delete);
                    item.RemovePropertyType(delete);
                }
            }

            if (tabsToBlank.Any())
            {
                foreach (var blank in tabsToBlank)
                {
                    // there might be a bug here, we need to do some cheking of if this is
                    // possible with the public api

                    // blank.Key.PropertyTypes.Remove(blank.Value);
                }
            }
        }