Esempio n. 1
0
        public static LocalizedString GetConfigurableObjectChangedProperties(ConfigurableObject dataObject)
        {
            if (dataObject == null)
            {
                throw new ArgumentNullException("dataObject");
            }
            StringBuilder stringBuilder = new StringBuilder("{ ");
            IList <PropertyDefinition> changedPropertyDefinitions = dataObject.GetChangedPropertyDefinitions();

            for (int i = 0; i < changedPropertyDefinitions.Count; i++)
            {
                if (changedPropertyDefinitions[i] != ADObjectSchema.ObjectState)
                {
                    PropertyDefinition propertyDefinition = changedPropertyDefinitions[i];
                    if (propertyDefinition != ActiveDirectoryServerSchema.AssistantMaintenanceScheduleInternal)
                    {
                        stringBuilder.Append(propertyDefinition.Name);
                        ADPropertyDefinition adpropertyDefinition = propertyDefinition as ADPropertyDefinition;
                        if (adpropertyDefinition != null)
                        {
                            stringBuilder.Append('[');
                            stringBuilder.Append(TaskVerboseStringHelper.RetrieveLDAPPropertyNames(adpropertyDefinition));
                            stringBuilder.Append(']');
                        }
                        stringBuilder.Append('=');
                        if (dataObject[propertyDefinition] is IList)
                        {
                            IList list = (IList)dataObject[propertyDefinition];
                            stringBuilder.Append("{ ");
                            for (int j = 0; j < list.Count; j++)
                            {
                                stringBuilder.Append(TaskVerboseStringHelper.FormatParameterValue(list[j]));
                                if (j + 1 < list.Count)
                                {
                                    stringBuilder.Append(", ");
                                }
                            }
                            stringBuilder.Append(" }");
                        }
                        else
                        {
                            stringBuilder.Append(TaskVerboseStringHelper.FormatParameterValue(dataObject[propertyDefinition]));
                        }
                        stringBuilder.Append(", ");
                    }
                }
            }
            if (stringBuilder.Length > 2)
            {
                stringBuilder.Remove(stringBuilder.Length - 2, 2);
            }
            stringBuilder.Append(" }");
            LocalizedString result = LocalizedString.Empty;

            if (dataObject.Identity != null)
            {
                ADObject adobject = dataObject as ADObject;
                if (adobject != null)
                {
                    result = Strings.VerboseADObjectChangedPropertiesWithDn(adobject.Name, adobject.Id.ToDNString(), stringBuilder.ToString());
                }
                else
                {
                    result = Strings.VerboseADObjectChangedPropertiesWithId(dataObject.Identity.ToString(), stringBuilder.ToString());
                }
            }
            else
            {
                result = Strings.VerboseADObjectChangedProperties(stringBuilder.ToString());
            }
            return(result);
        }