Beispiel #1
0
        private void ToString(string indent, object obj, SecurityElement.ToStringHelperFunc func)
        {
            func(obj, "<");
            switch (this.m_type)
            {
            case SecurityElementType.Format:
                func(obj, "?");
                break;

            case SecurityElementType.Comment:
                func(obj, "!");
                break;
            }
            func(obj, this.m_strTag);
            if (this.m_lAttributes != null && this.m_lAttributes.Count > 0)
            {
                func(obj, " ");
                int count = this.m_lAttributes.Count;
                int index = 0;
                while (index < count)
                {
                    string str1 = (string)this.m_lAttributes[index];
                    string str2 = (string)this.m_lAttributes[index + 1];
                    func(obj, str1);
                    func(obj, "=\"");
                    func(obj, str2);
                    func(obj, "\"");
                    if (index != this.m_lAttributes.Count - 2)
                    {
                        if (this.m_type == SecurityElementType.Regular)
                        {
                            func(obj, Environment.NewLine);
                        }
                        else
                        {
                            func(obj, " ");
                        }
                    }
                    index += 2;
                }
            }
            if (this.m_strText == null && (this.m_lChildren == null || this.m_lChildren.Count == 0))
            {
                switch (this.m_type)
                {
                case SecurityElementType.Format:
                    func(obj, " ?>");
                    break;

                case SecurityElementType.Comment:
                    func(obj, ">");
                    break;

                default:
                    func(obj, "/>");
                    break;
                }
                func(obj, Environment.NewLine);
            }
            else
            {
                func(obj, ">");
                func(obj, this.m_strText);
                if (this.m_lChildren != null)
                {
                    this.ConvertSecurityElementFactories();
                    func(obj, Environment.NewLine);
                    for (int index = 0; index < this.m_lChildren.Count; ++index)
                    {
                        ((SecurityElement)this.m_lChildren[index]).ToString("", obj, func);
                    }
                }
                func(obj, "</");
                func(obj, this.m_strTag);
                func(obj, ">");
                func(obj, Environment.NewLine);
            }
        }
        // Token: 0x06001BF6 RID: 7158 RVA: 0x00060194 File Offset: 0x0005E394
        private void ToString(string indent, object obj, SecurityElement.ToStringHelperFunc func)
        {
            func(obj, "<");
            SecurityElementType type = this.m_type;

            if (type != SecurityElementType.Format)
            {
                if (type == SecurityElementType.Comment)
                {
                    func(obj, "!");
                }
            }
            else
            {
                func(obj, "?");
            }
            func(obj, this.m_strTag);
            if (this.m_lAttributes != null && this.m_lAttributes.Count > 0)
            {
                func(obj, " ");
                int count = this.m_lAttributes.Count;
                for (int i = 0; i < count; i += 2)
                {
                    string str  = (string)this.m_lAttributes[i];
                    string str2 = (string)this.m_lAttributes[i + 1];
                    func(obj, str);
                    func(obj, "=\"");
                    func(obj, str2);
                    func(obj, "\"");
                    if (i != this.m_lAttributes.Count - 2)
                    {
                        if (this.m_type == SecurityElementType.Regular)
                        {
                            func(obj, Environment.NewLine);
                        }
                        else
                        {
                            func(obj, " ");
                        }
                    }
                }
            }
            if (this.m_strText == null && (this.m_lChildren == null || this.m_lChildren.Count == 0))
            {
                type = this.m_type;
                if (type != SecurityElementType.Format)
                {
                    if (type == SecurityElementType.Comment)
                    {
                        func(obj, ">");
                    }
                    else
                    {
                        func(obj, "/>");
                    }
                }
                else
                {
                    func(obj, " ?>");
                }
                func(obj, Environment.NewLine);
                return;
            }
            func(obj, ">");
            func(obj, this.m_strText);
            if (this.m_lChildren != null)
            {
                this.ConvertSecurityElementFactories();
                func(obj, Environment.NewLine);
                for (int j = 0; j < this.m_lChildren.Count; j++)
                {
                    ((SecurityElement)this.m_lChildren[j]).ToString("", obj, func);
                }
            }
            func(obj, "</");
            func(obj, this.m_strTag);
            func(obj, ">");
            func(obj, Environment.NewLine);
        }