XmlTransformer.XmlAttributePreservationDict.UpdatePreservationInfo C# (CSharp) Méthode

UpdatePreservationInfo() private méthode

private UpdatePreservationInfo ( XmlAttributeCollection updatedAttributes, XmlFormatter formatter ) : void
updatedAttributes System.Xml.XmlAttributeCollection
formatter XmlFormatter
Résultat void
        internal void UpdatePreservationInfo(XmlAttributeCollection updatedAttributes, XmlFormatter formatter)
        {
            if (updatedAttributes.Count == 0)
            {
                if (this.orderedAttributes.Count <= 0)
                    return;
                this.leadingSpaces.Clear();
                this.orderedAttributes.Clear();
            }
            else
            {
                Dictionary<string, bool> dictionary = new Dictionary<string, bool>();
                foreach (string index in this.orderedAttributes)
                    dictionary[index] = false;
                foreach (XmlAttribute xmlAttribute in (XmlNamedNodeMap)updatedAttributes)
                {
                    if (!dictionary.ContainsKey(xmlAttribute.Name))
                        this.orderedAttributes.Add(xmlAttribute.Name);
                    dictionary[xmlAttribute.Name] = true;
                }
                bool flag1 = true;
                string str = (string)null;
                foreach (string key in this.orderedAttributes)
                {
                    bool flag2 = dictionary[key];
                    if (!flag2)
                    {
                        if (this.leadingSpaces.ContainsKey(key))
                        {
                            string space = this.leadingSpaces[key];
                            if (flag1)
                            {
                                if (str == null)
                                    str = space;
                            }
                            else if (this.ContainsNewLine(space))
                                str = space;
                            this.leadingSpaces.Remove(key);
                        }
                    }
                    else if (str != null)
                    {
                        if (flag1 || !this.leadingSpaces.ContainsKey(key) || !this.ContainsNewLine(this.leadingSpaces[key]))
                            this.leadingSpaces[key] = str;
                        str = (string)null;
                    }
                    else if (!this.leadingSpaces.ContainsKey(key))
                    {
                        if (flag1)
                            this.leadingSpaces[key] = " ";
                        else if (this.OneAttributePerLine)
                            this.leadingSpaces[key] = this.GetAttributeNewLineString(formatter);
                        else
                            this.EnsureAttributeNewLineString(formatter);
                    }
                    flag1 = flag1 && !flag2;
                }
            }
        }